idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
6,900 | protected Class < ? > defineClass ( String name , sun . misc . Resource res ) throws IOException { final int i = name . lastIndexOf ( '.' ) ; final URL url = res . getCodeSourceURL ( ) ; if ( i != - 1 ) { final String pkgname = name . substring ( 0 , i ) ; final Package pkg = getPackage ( pkgname ) ; final Manifest man = res . getManifest ( ) ; if ( pkg != null ) { if ( pkg . isSealed ( ) ) { if ( ! pkg . isSealed ( url ) ) { throw new SecurityException ( Locale . getString ( "E1" , pkgname ) ) ; } } else { if ( ( man != null ) && isSealed ( pkgname , man ) ) { throw new SecurityException ( Locale . getString ( "E2" , pkgname ) ) ; } } } else { if ( man != null ) { definePackage ( pkgname , man , url ) ; } else { definePackage ( pkgname , null , null , null , null , null , null , null ) ; } } } final java . nio . ByteBuffer bb = res . getByteBuffer ( ) ; if ( bb != null ) { final CodeSigner [ ] signers = res . getCodeSigners ( ) ; final CodeSource cs = new CodeSource ( url , signers ) ; return defineClass ( name , bb , cs ) ; } final byte [ ] b = res . getBytes ( ) ; final CodeSigner [ ] signers = res . getCodeSigners ( ) ; final CodeSource cs = new CodeSource ( url , signers ) ; return defineClass ( name , b , 0 , b . length , cs ) ; } | Defines a Class using the class bytes obtained from the specified Resource . The resulting Class must be resolved before it can be used . |
6,901 | @ SuppressWarnings ( "checkstyle:npathcomplexity" ) protected Package definePackage ( String name , Manifest man , URL url ) throws IllegalArgumentException { final String path = name . replace ( '.' , '/' ) . concat ( "/" ) ; String specTitle = null ; String specVersion = null ; String specVendor = null ; String implTitle = null ; String implVersion = null ; String implVendor = null ; String sealed = null ; URL sealBase = null ; Attributes attr = man . getAttributes ( path ) ; if ( attr != null ) { specTitle = attr . getValue ( Name . SPECIFICATION_TITLE ) ; specVersion = attr . getValue ( Name . SPECIFICATION_VERSION ) ; specVendor = attr . getValue ( Name . SPECIFICATION_VENDOR ) ; implTitle = attr . getValue ( Name . IMPLEMENTATION_TITLE ) ; implVersion = attr . getValue ( Name . IMPLEMENTATION_VERSION ) ; implVendor = attr . getValue ( Name . IMPLEMENTATION_VENDOR ) ; sealed = attr . getValue ( Name . SEALED ) ; } attr = man . getMainAttributes ( ) ; if ( attr != null ) { if ( specTitle == null ) { specTitle = attr . getValue ( Name . SPECIFICATION_TITLE ) ; } if ( specVersion == null ) { specVersion = attr . getValue ( Name . SPECIFICATION_VERSION ) ; } if ( specVendor == null ) { specVendor = attr . getValue ( Name . SPECIFICATION_VENDOR ) ; } if ( implTitle == null ) { implTitle = attr . getValue ( Name . IMPLEMENTATION_TITLE ) ; } if ( implVersion == null ) { implVersion = attr . getValue ( Name . IMPLEMENTATION_VERSION ) ; } if ( implVendor == null ) { implVendor = attr . getValue ( Name . IMPLEMENTATION_VENDOR ) ; } if ( sealed == null ) { sealed = attr . getValue ( Name . SEALED ) ; } } if ( "true" . equalsIgnoreCase ( sealed ) ) { sealBase = url ; } return definePackage ( name , specTitle , specVersion , specVendor , implTitle , implVersion , implVendor , sealBase ) ; } | Defines a new package by name in this ClassLoader . The attributes contained in the specified Manifest will be used to obtain package version and sealing information . For sealed packages the additional URL specifies the code source URL from which the package was loaded . |
6,902 | public URL findResource ( final String name ) { final URL url = AccessController . doPrivileged ( new PrivilegedAction < URL > ( ) { public URL run ( ) { return DynamicURLClassLoader . this . ucp . findResource ( name , true ) ; } } , this . acc ) ; return url != null ? this . ucp . checkURL ( url ) : null ; } | Finds the resource with the specified name on the URL search path . |
6,903 | public Enumeration < URL > findResources ( final String name ) throws IOException { final Enumeration < ? > e = this . ucp . findResources ( name , true ) ; return new Enumeration < URL > ( ) { private URL url ; private boolean next ( ) { if ( this . url != null ) { return true ; } do { final URL u = AccessController . doPrivileged ( new PrivilegedAction < URL > ( ) { public URL run ( ) { if ( ! e . hasMoreElements ( ) ) { return null ; } return ( URL ) e . nextElement ( ) ; } } , DynamicURLClassLoader . this . acc ) ; if ( u == null ) { break ; } this . url = DynamicURLClassLoader . this . ucp . checkURL ( u ) ; } while ( this . url == null ) ; return this . url != null ; } public URL nextElement ( ) { if ( ! next ( ) ) { throw new NoSuchElementException ( ) ; } final URL u = this . url ; this . url = null ; return u ; } public boolean hasMoreElements ( ) { return next ( ) ; } } ; } | Returns an Enumeration of URLs representing all of the resources on the URL search path having the specified name . |
6,904 | protected PermissionCollection getPermissions ( CodeSource codesource ) { final PermissionCollection perms = super . getPermissions ( codesource ) ; final URL url = codesource . getLocation ( ) ; Permission permission ; URLConnection urlConnection ; try { urlConnection = url . openConnection ( ) ; permission = urlConnection . getPermission ( ) ; } catch ( IOException ioe ) { permission = null ; urlConnection = null ; } if ( ( permission != null ) && ( permission instanceof FilePermission ) ) { String path = permission . getName ( ) ; if ( path . endsWith ( File . separator ) ) { path += "-" ; permission = new FilePermission ( path , sun . security . util . SecurityConstants . FILE_READ_ACTION ) ; } } else if ( ( permission == null ) && ( URISchemeType . FILE . isURL ( url ) ) ) { String path = url . getFile ( ) . replace ( '/' , File . separatorChar ) ; path = sun . net . www . ParseUtil . decode ( path ) ; if ( path . endsWith ( File . separator ) ) { path += "-" ; } permission = new FilePermission ( path , sun . security . util . SecurityConstants . FILE_READ_ACTION ) ; } else { URL locUrl = url ; if ( urlConnection instanceof JarURLConnection ) { locUrl = ( ( JarURLConnection ) urlConnection ) . getJarFileURL ( ) ; } String host = locUrl . getHost ( ) ; if ( host == null ) { host = "localhost" ; } permission = new SocketPermission ( host , sun . security . util . SecurityConstants . SOCKET_CONNECT_ACCEPT_ACTION ) ; } final SecurityManager sm = System . getSecurityManager ( ) ; if ( sm != null ) { final Permission fp = permission ; AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) throws SecurityException { sm . checkPermission ( fp ) ; return null ; } } , this . acc ) ; } perms . add ( permission ) ; return perms ; } | Returns the permissions for the given codesource object . The implementation of this method first calls super . getPermissions and then adds permissions based on the URL of the codesource . |
6,905 | private static URL [ ] mergeClassPath ( URL ... urls ) { final String path = System . getProperty ( "java.class.path" ) ; final String separator = System . getProperty ( "path.separator" ) ; final String [ ] parts = path . split ( Pattern . quote ( separator ) ) ; final URL [ ] u = new URL [ parts . length + urls . length ] ; for ( int i = 0 ; i < parts . length ; ++ i ) { try { u [ i ] = new File ( parts [ i ] ) . toURI ( ) . toURL ( ) ; } catch ( MalformedURLException exception ) { } } System . arraycopy ( urls , 0 , u , parts . length , urls . length ) ; return u ; } | Merge the specified URLs to the current classpath . |
6,906 | public static < E > int remove ( List < E > list , Comparator < ? super E > comparator , E data ) { assert list != null ; assert comparator != null ; assert data != null ; int first = 0 ; int last = list . size ( ) - 1 ; while ( last >= first ) { final int center = ( first + last ) / 2 ; final E dt = list . get ( center ) ; final int cmpR = comparator . compare ( data , dt ) ; if ( cmpR == 0 ) { list . remove ( center ) ; return center ; } else if ( cmpR < 0 ) { last = center - 1 ; } else { first = center + 1 ; } } return - 1 ; } | Remove the given element from the list using a dichotomic algorithm . |
6,907 | @ Inline ( value = "add($1, $2, $3, false, false)" ) public static < E > int addIfAbsent ( List < E > list , Comparator < ? super E > comparator , E data ) { return add ( list , comparator , data , false , false ) ; } | Add the given element in the main list using a dichotomic algorithm if the element is not already present . |
6,908 | public static < E > int add ( List < E > list , Comparator < ? super E > comparator , E data , boolean allowMultipleOccurencesOfSameValue , boolean allowReplacement ) { assert list != null ; assert comparator != null ; assert data != null ; int first = 0 ; int last = list . size ( ) - 1 ; while ( last >= first ) { final int center = ( first + last ) / 2 ; final E dt = list . get ( center ) ; final int cmpR = comparator . compare ( data , dt ) ; if ( cmpR == 0 && ! allowMultipleOccurencesOfSameValue ) { if ( allowReplacement ) { list . set ( center , data ) ; return center ; } return - 1 ; } if ( cmpR < 0 ) { last = center - 1 ; } else { first = center + 1 ; } } list . add ( first , data ) ; return first ; } | Add the given element in the main list using a dichotomic algorithm . |
6,909 | public static < E > boolean contains ( List < E > list , Comparator < ? super E > comparator , E data ) { assert list != null ; assert comparator != null ; assert data != null ; int first = 0 ; int last = list . size ( ) - 1 ; while ( last >= first ) { final int center = ( first + last ) / 2 ; final E dt = list . get ( center ) ; final int cmpR = comparator . compare ( data , dt ) ; if ( cmpR == 0 ) { return true ; } else if ( cmpR < 0 ) { last = center - 1 ; } else { first = center + 1 ; } } return false ; } | Replies if the given element is inside the list using a dichotomic algorithm . |
6,910 | public static < T > Iterator < T > reverseIterator ( final List < T > list ) { return new Iterator < T > ( ) { private int next = list . size ( ) - 1 ; public boolean hasNext ( ) { return this . next >= 0 ; } public T next ( ) { final int n = this . next ; -- this . next ; try { return list . get ( n ) ; } catch ( IndexOutOfBoundsException exception ) { throw new NoSuchElementException ( ) ; } } } ; } | Replies an iterator that goes from end to start of the given list . |
6,911 | public static Class < ? > getAttributeClassWithDefault ( Node document , boolean caseSensitive , Class < ? > defaultValue , String ... path ) { assert document != null : AssertMessages . notNullParameter ( 0 ) ; final String v = getAttributeValue ( document , caseSensitive , 0 , path ) ; if ( v != null && ! v . isEmpty ( ) ) { try { final ClassLoader loader = ClassLoaderFinder . findClassLoader ( ) ; return loader . loadClass ( v ) ; } catch ( Throwable e ) { } } return defaultValue ; } | Read a java class . |
6,912 | public static < T extends Node > T getChild ( Node parent , Class < T > type ) { assert parent != null : AssertMessages . notNullParameter ( 0 ) ; assert type != null : AssertMessages . notNullParameter ( 1 ) ; final NodeList children = parent . getChildNodes ( ) ; final int len = children . getLength ( ) ; for ( int i = 0 ; i < len ; ++ i ) { final Node child = children . item ( i ) ; if ( type . isInstance ( child ) ) { return type . cast ( child ) ; } } return null ; } | Replies the first child node that has the specified type . |
6,913 | public static Document getDocumentFor ( Node node ) { Node localnode = node ; while ( localnode != null ) { if ( localnode instanceof Document ) { return ( Document ) localnode ; } localnode = localnode . getParentNode ( ) ; } return null ; } | Replies the XML Document that is containing the given node . |
6,914 | public static String getText ( Node document , String ... path ) { assert document != null : AssertMessages . notNullParameter ( 0 ) ; Node parentNode = getNodeFromPath ( document , path ) ; if ( parentNode == null ) { parentNode = document ; } final StringBuilder text = new StringBuilder ( ) ; final NodeList children = parentNode . getChildNodes ( ) ; final int len = children . getLength ( ) ; for ( int i = 0 ; i < len ; ++ i ) { final Node child = children . item ( i ) ; if ( child instanceof Text ) { text . append ( ( ( Text ) child ) . getWholeText ( ) ) ; } } if ( text . length ( ) > 0 ) { return text . toString ( ) ; } return null ; } | Replies the text inside the node at the specified path . |
6,915 | public static Iterator < Node > iterate ( Node parent , String nodeName ) { assert parent != null : AssertMessages . notNullParameter ( 0 ) ; assert nodeName != null && ! nodeName . isEmpty ( ) : AssertMessages . notNullParameter ( 0 ) ; return new NameBasedIterator ( parent , nodeName ) ; } | Replies an iterator on nodes that have the specified node name . |
6,916 | public static Object parseObject ( String xmlSerializedObject ) throws IOException , ClassNotFoundException { assert xmlSerializedObject != null : AssertMessages . notNullParameter ( 0 ) ; try ( ByteArrayInputStream bais = new ByteArrayInputStream ( Base64 . getDecoder ( ) . decode ( xmlSerializedObject ) ) ) { final ObjectInputStream ois = new ObjectInputStream ( bais ) ; return ois . readObject ( ) ; } } | Deserialize an object from the given XML string . |
6,917 | public static byte [ ] parseString ( String text ) { return Base64 . getDecoder ( ) . decode ( Strings . nullToEmpty ( text ) . trim ( ) ) ; } | Parse a Base64 string with contains a set of bytes . |
6,918 | public static Document parseXML ( String xmlString ) { assert xmlString != null : AssertMessages . notNullParameter ( 0 ) ; try { return readXML ( new StringReader ( xmlString ) ) ; } catch ( Exception e ) { } return null ; } | Parse a string representation of an XML document . |
6,919 | public static void writeResources ( Element node , XMLResources resources , XMLBuilder builder ) { if ( resources != null ) { final Element resourcesNode = builder . createElement ( NODE_RESOURCES ) ; for ( final java . util . Map . Entry < Long , Entry > pair : resources . getPairs ( ) . entrySet ( ) ) { final Entry e = pair . getValue ( ) ; if ( e . isURL ( ) ) { final Element resourceNode = builder . createElement ( NODE_RESOURCE ) ; resourceNode . setAttribute ( ATTR_ID , XMLResources . getStringIdentifier ( pair . getKey ( ) ) ) ; resourceNode . setAttribute ( ATTR_URL , e . getURL ( ) . toExternalForm ( ) ) ; resourceNode . setAttribute ( ATTR_MIMETYPE , e . getMimeType ( ) ) ; resourcesNode . appendChild ( resourceNode ) ; } else if ( e . isFile ( ) ) { final Element resourceNode = builder . createElement ( NODE_RESOURCE ) ; resourceNode . setAttribute ( ATTR_ID , XMLResources . getStringIdentifier ( pair . getKey ( ) ) ) ; final File file = e . getFile ( ) ; final StringBuilder url = new StringBuilder ( ) ; url . append ( "file:" ) ; boolean addSlash = false ; for ( final String elt : FileSystem . split ( file ) ) { try { if ( addSlash ) { url . append ( "/" ) ; } url . append ( URLEncoder . encode ( elt , Charset . defaultCharset ( ) . name ( ) ) ) ; } catch ( UnsupportedEncodingException e1 ) { throw new Error ( e1 ) ; } addSlash = true ; } resourceNode . setAttribute ( ATTR_FILE , url . toString ( ) ) ; resourceNode . setAttribute ( ATTR_MIMETYPE , e . getMimeType ( ) ) ; resourcesNode . appendChild ( resourceNode ) ; } else if ( e . isEmbeddedData ( ) ) { final Element resourceNode = builder . createElement ( NODE_RESOURCE ) ; resourceNode . setAttribute ( ATTR_ID , XMLResources . getStringIdentifier ( pair . getKey ( ) ) ) ; resourceNode . setAttribute ( ATTR_MIMETYPE , e . getMimeType ( ) ) ; final byte [ ] data = e . getEmbeddedData ( ) ; final CDATASection cdata = builder . createCDATASection ( toString ( data ) ) ; resourceNode . appendChild ( cdata ) ; resourcesNode . appendChild ( resourceNode ) ; } } if ( resourcesNode . getChildNodes ( ) . getLength ( ) > 0 ) { node . appendChild ( resourcesNode ) ; } } } | Write the given resources into the given XML node . |
6,920 | public static URL readResourceURL ( Element node , XMLResources resources , String ... path ) { final String stringValue = getAttributeValue ( node , path ) ; if ( XMLResources . isStringIdentifier ( stringValue ) ) { try { final long id = XMLResources . getNumericalIdentifier ( stringValue ) ; return resources . getResourceURL ( id ) ; } catch ( Throwable exception ) { } } return null ; } | Replies the resource URL that is contained inside the XML attribute defined in the given node and with the given XML path . |
6,921 | protected static StackTraceElement getTraceElementAt ( int level ) { if ( level < 0 ) { return null ; } try { final StackTraceElement [ ] stackTrace = Thread . currentThread ( ) . getStackTrace ( ) ; int j = - 1 ; boolean found = false ; Class < ? > type ; for ( int i = 0 ; i < stackTrace . length ; ++ i ) { if ( found ) { if ( ( i - j ) == level ) { return stackTrace [ i ] ; } } else { type = loadClass ( stackTrace [ i ] . getClassName ( ) ) ; if ( type != null && Caller . class . isAssignableFrom ( type ) ) { j = i + 1 ; } else if ( j >= 0 ) { found = true ; if ( ( i - j ) == level ) { return stackTrace [ i ] ; } } } } } catch ( AssertionError e ) { throw e ; } catch ( Throwable exception ) { } return null ; } | Replies the stack trace element for the given level . |
6,922 | public boolean moveTo ( N newParent ) { if ( newParent == null ) { return false ; } return moveTo ( newParent , newParent . getChildCount ( ) ) ; } | Move this node in the given new parent node . |
6,923 | public final boolean addChild ( int index , N newChild ) { if ( newChild == null ) { return false ; } final int count = ( this . children == null ) ? 0 : this . children . size ( ) ; final N oldParent = newChild . getParentNode ( ) ; if ( oldParent != this && oldParent != null ) { newChild . removeFromParent ( ) ; } final int insertionIndex ; if ( this . children == null ) { this . children = newInternalList ( index + 1 ) ; } if ( index < count ) { insertionIndex = Math . max ( index , 0 ) ; this . children . add ( insertionIndex , newChild ) ; } else { insertionIndex = this . children . size ( ) ; this . children . add ( newChild ) ; } ++ this . notNullChildCount ; newChild . setParentNodeReference ( toN ( ) , true ) ; firePropertyChildAdded ( insertionIndex , newChild ) ; return true ; } | Add a child node at the specified index . |
6,924 | public static final < T extends Comparable < T > > Ordering < Scored < T > > ByScoreThenByItem ( Ordering < T > itemOrdering ) { final Ordering < Scored < T > > byItem = itemOrdering . onResultOf ( Scoreds . < T > itemsOnly ( ) ) ; final Ordering < Scored < T > > byScore = Scoreds . < T > ByScoreOnly ( ) ; return Ordering . compound ( ImmutableList . of ( byScore , byItem ) ) ; } | Comparator which compares Scoreds first by score then by item where the item ordering to use is explicitly specified . |
6,925 | public static final < T extends Comparable < T > > Ordering < Scored < T > > ByScoreThenByItem ( ) { final Ordering < Scored < T > > byItem = Scoreds . < T > ByItemOnly ( ) ; final Ordering < Scored < T > > byScore = Scoreds . < T > ByScoreOnly ( ) ; return Ordering . compound ( ImmutableList . of ( byScore , byItem ) ) ; } | Comparator which compares Scoreds first by score then by item . |
6,926 | protected void onFileChoose ( JFileChooser fileChooser , ActionEvent actionEvent ) { final int returnVal = fileChooser . showOpenDialog ( parent ) ; if ( returnVal == JFileChooser . APPROVE_OPTION ) { final File file = fileChooser . getSelectedFile ( ) ; onApproveOption ( file , actionEvent ) ; } else { onCancel ( actionEvent ) ; } } | Callback method to interact on file choose . |
6,927 | LayoutProcessorOutput applyLayout ( FileResource resource , Locale locale , Map < String , Object > model ) { Optional < Path > layout = findLayout ( resource ) ; return layout . map ( Path :: toString ) . map ( Files :: getFileExtension ) . map ( layoutEngines :: get ) . orElse ( lParam -> new LayoutProcessorOutput ( lParam . model . get ( "content" ) . toString ( ) , "none" , lParam . layoutTemplate , lParam . locale ) ) . apply ( new LayoutParameters ( layout , resource . getPath ( ) , locale , model ) ) ; } | has been found the file will be copied as it is |
6,928 | public Timex2Time modifiedCopy ( final Modifier modifier ) { return new Timex2Time ( val , modifier , set , granularity , periodicity , anchorVal , anchorDir , nonSpecific ) ; } | Returns a copy of this Timex which is the same except with the specified modifier |
6,929 | public static MACNumber [ ] parse ( String addresses ) { if ( ( addresses == null ) || ( "" . equals ( addresses ) ) ) { return new MACNumber [ 0 ] ; } final String [ ] adrs = addresses . split ( Pattern . quote ( Character . toString ( MACNUMBER_SEPARATOR ) ) ) ; final List < MACNumber > list = new ArrayList < > ( ) ; for ( final String adr : adrs ) { list . add ( new MACNumber ( adr ) ) ; } final MACNumber [ ] tab = new MACNumber [ list . size ( ) ] ; list . toArray ( tab ) ; list . clear ( ) ; return tab ; } | Parse the specified string an repleis the corresponding MAC numbers . |
6,930 | public static String join ( MACNumber ... addresses ) { if ( ( addresses == null ) || ( addresses . length == 0 ) ) { return null ; } final StringBuilder buf = new StringBuilder ( ) ; for ( final MACNumber number : addresses ) { if ( buf . length ( ) > 0 ) { buf . append ( MACNUMBER_SEPARATOR ) ; } buf . append ( number ) ; } return buf . toString ( ) ; } | Join the specified MAC numbers to reply a string . |
6,931 | public static Collection < MACNumber > getAllAdapters ( ) { final List < MACNumber > av = new ArrayList < > ( ) ; final Enumeration < NetworkInterface > interfaces ; try { interfaces = NetworkInterface . getNetworkInterfaces ( ) ; } catch ( SocketException exception ) { return av ; } if ( interfaces != null ) { NetworkInterface inter ; while ( interfaces . hasMoreElements ( ) ) { inter = interfaces . nextElement ( ) ; try { final byte [ ] addr = inter . getHardwareAddress ( ) ; if ( addr != null ) { av . add ( new MACNumber ( addr ) ) ; } } catch ( SocketException exception ) { } } } return av ; } | Get all of the ethernet addresses associated with the local machine . |
6,932 | public static Map < InetAddress , MACNumber > getAllMappings ( ) { final Map < InetAddress , MACNumber > av = new HashMap < > ( ) ; final Enumeration < NetworkInterface > interfaces ; try { interfaces = NetworkInterface . getNetworkInterfaces ( ) ; } catch ( SocketException exception ) { return av ; } if ( interfaces != null ) { NetworkInterface inter ; MACNumber mac ; InetAddress inet ; while ( interfaces . hasMoreElements ( ) ) { inter = interfaces . nextElement ( ) ; try { final byte [ ] addr = inter . getHardwareAddress ( ) ; if ( addr != null ) { mac = new MACNumber ( addr ) ; final Enumeration < InetAddress > inets = inter . getInetAddresses ( ) ; while ( inets . hasMoreElements ( ) ) { inet = inets . nextElement ( ) ; av . put ( inet , mac ) ; } } } catch ( SocketException exception ) { } } } return av ; } | Get all of the internet address and ethernet address mappings on the local machine . |
6,933 | public static MACNumber getPrimaryAdapter ( ) { final Enumeration < NetworkInterface > interfaces ; try { interfaces = NetworkInterface . getNetworkInterfaces ( ) ; } catch ( SocketException exception ) { return null ; } if ( interfaces != null ) { NetworkInterface inter ; while ( interfaces . hasMoreElements ( ) ) { inter = interfaces . nextElement ( ) ; try { final byte [ ] addr = inter . getHardwareAddress ( ) ; if ( addr != null ) { return new MACNumber ( addr ) ; } } catch ( SocketException exception ) { } } } return null ; } | Try to determine the primary ethernet address of the machine . |
6,934 | public static Collection < InetAddress > getPrimaryAdapterAddresses ( ) { final Enumeration < NetworkInterface > interfaces ; try { interfaces = NetworkInterface . getNetworkInterfaces ( ) ; } catch ( SocketException exception ) { return Collections . emptyList ( ) ; } if ( interfaces != null ) { NetworkInterface inter ; while ( interfaces . hasMoreElements ( ) ) { inter = interfaces . nextElement ( ) ; try { final byte [ ] addr = inter . getHardwareAddress ( ) ; if ( addr != null ) { final Collection < InetAddress > inetList = new ArrayList < > ( ) ; final Enumeration < InetAddress > inets = inter . getInetAddresses ( ) ; while ( inets . hasMoreElements ( ) ) { inetList . add ( inets . nextElement ( ) ) ; } return inetList ; } } catch ( SocketException exception ) { } } } return Collections . emptyList ( ) ; } | Try to determine the primary ethernet address of the machine and replies the associated internet addresses . |
6,935 | public boolean isNull ( ) { for ( int i = 0 ; i < this . bytes . length ; ++ i ) { if ( this . bytes [ i ] != 0 ) { return false ; } } return true ; } | Replies if all the MAC address number are equal to zero . |
6,936 | public Optional < Path > getSourcePath ( ) { File f = this . nytdoc . getSourceFile ( ) ; return f == null ? Optional . empty ( ) : Optional . of ( f . toPath ( ) ) ; } | Accessor for the sourceFile property . |
6,937 | public Optional < URL > getUrl ( ) { URL u = this . nytdoc . getUrl ( ) ; return Optional . ofNullable ( u ) ; } | Accessor for the url property . |
6,938 | public void load ( File authorizationFile ) throws AuthorizationFileException { FileInputStream fis = null ; try { fis = new FileInputStream ( authorizationFile ) ; ANTLRInputStream stream = new ANTLRInputStream ( fis ) ; SAFPLexer lexer = new SAFPLexer ( stream ) ; CommonTokenStream tokens = new CommonTokenStream ( lexer ) ; SAFPParser parser = new SAFPParser ( tokens ) ; parser . prog ( ) ; setAccessRules ( parser . getAccessRules ( ) ) ; setGroups ( parser . getGroups ( ) ) ; setAliases ( parser . getAliases ( ) ) ; } catch ( FileNotFoundException e ) { throw new AuthorizationFileException ( "FileNotFoundException: " , e ) ; } catch ( IOException e ) { throw new AuthorizationFileException ( "IOException: " , e ) ; } catch ( RecognitionException e ) { throw new AuthorizationFileException ( "Parser problem: " , e ) ; } finally { try { fis . close ( ) ; } catch ( IOException e ) { throw new AuthorizationFileException ( "IOExcetion during close: " , e ) ; } } } | Load the authorization file . |
6,939 | public static void deleteAlias ( final File keystoreFile , String alias , final String password ) throws NoSuchAlgorithmException , CertificateException , FileNotFoundException , KeyStoreException , IOException { KeyStore keyStore = KeyStoreFactory . newKeyStore ( KeystoreType . JKS . name ( ) , password , keystoreFile ) ; keyStore . deleteEntry ( alias ) ; keyStore . store ( new FileOutputStream ( keystoreFile ) , password . toCharArray ( ) ) ; } | Delete the given alias from the given keystore file . |
6,940 | public static EChange setResponseCompressionEnabled ( final boolean bResponseCompressionEnabled ) { return s_aRWLock . writeLocked ( ( ) -> { if ( s_bResponseCompressionEnabled == bResponseCompressionEnabled ) return EChange . UNCHANGED ; s_bResponseCompressionEnabled = bResponseCompressionEnabled ; LOGGER . info ( "CompressFilter responseCompressionEnabled=" + bResponseCompressionEnabled ) ; return EChange . CHANGED ; } ) ; } | Enable or disable the overall compression . |
6,941 | public static EChange setDebugModeEnabled ( final boolean bDebugModeEnabled ) { return s_aRWLock . writeLocked ( ( ) -> { if ( s_bDebugModeEnabled == bDebugModeEnabled ) return EChange . UNCHANGED ; s_bDebugModeEnabled = bDebugModeEnabled ; LOGGER . info ( "CompressFilter debugMode=" + bDebugModeEnabled ) ; return EChange . CHANGED ; } ) ; } | Enable or disable debug mode |
6,942 | public SAMFileHeader makeSAMFileHeader ( ReadGroupSet readGroupSet , List < Reference > references ) { return ReadUtils . makeSAMFileHeader ( readGroupSet , references ) ; } | Generates a SAMFileHeader from a ReadGroupSet and Reference metadata |
6,943 | public boolean hasUser ( String userName ) { boolean result = false ; for ( User item : getUsersList ( ) ) { if ( item . getName ( ) . equals ( userName ) ) { result = true ; } } return result ; } | Check to see if a given user name is within the list of users . Checking will be done case sensitive . |
6,944 | public User getUser ( String userName ) { User result = null ; for ( User item : getUsersList ( ) ) { if ( item . getName ( ) . equals ( userName ) ) { result = item ; } } return result ; } | Get the particular User instance if the user can be found . Null otherwise . |
6,945 | public CSP2SourceList addScheme ( final String sScheme ) { ValueEnforcer . notEmpty ( sScheme , "Scheme" ) ; ValueEnforcer . isTrue ( sScheme . length ( ) > 1 && sScheme . endsWith ( ":" ) , ( ) -> "Passed scheme '" + sScheme + "' is invalid!" ) ; m_aList . add ( sScheme ) ; return this ; } | Add a scheme |
6,946 | public final void setProxy ( final HttpHost aProxy , final Credentials aProxyCredentials ) { m_aProxy = aProxy ; m_aProxyCredentials = aProxyCredentials ; } | Set proxy host and proxy credentials . |
6,947 | public final HttpClientFactory setRetries ( final int nRetries ) { ValueEnforcer . isGE0 ( nRetries , "Retries" ) ; m_nRetries = nRetries ; return this ; } | Set the number of internal retries . |
6,948 | public final HttpClientFactory setRetryMode ( final ERetryMode eRetryMode ) { ValueEnforcer . notNull ( eRetryMode , "RetryMode" ) ; m_eRetryMode = eRetryMode ; return this ; } | Set the retry mode to use . |
6,949 | public static String dnsResolve ( final String sHostName ) { final InetAddress aAddress = resolveByName ( sHostName ) ; if ( aAddress == null ) return null ; return new IPV4Addr ( aAddress . getAddress ( ) ) . getAsString ( ) ; } | JavaScript callback function! Do not rename! |
6,950 | public EContinue onFilterBefore ( final HttpServletRequest aHttpRequest , final HttpServletResponse aHttpResponse , final IRequestWebScope aRequestScope ) throws IOException , ServletException { return EContinue . CONTINUE ; } | Invoked before the rest of the request is processed . |
6,951 | public boolean supportsMimeType ( final IMimeType aMimeType ) { if ( aMimeType == null ) return false ; return getQValueOfMimeType ( aMimeType ) . isAboveMinimumQuality ( ) ; } | Check if the passed MIME type is supported incl . fallback handling |
6,952 | public void configure ( String rootUrl , Settings settings ) { Data < Read , ReadGroupSet , Reference > data = dataSources . get ( rootUrl ) ; if ( data == null ) { data = new Data < Read , ReadGroupSet , Reference > ( settings , null ) ; dataSources . put ( rootUrl , data ) ; } else { data . settings = settings ; } } | Sets the settings for a given root url that will be used for creating the data source . Has no effect if the data source has already been created . |
6,953 | public GenomicsDataSource < Read , ReadGroupSet , Reference > get ( String rootUrl ) { Data < Read , ReadGroupSet , Reference > data = dataSources . get ( rootUrl ) ; if ( data == null ) { data = new Data < Read , ReadGroupSet , Reference > ( new Settings ( ) , null ) ; dataSources . put ( rootUrl , data ) ; } if ( data . dataSource == null ) { data . dataSource = makeDataSource ( rootUrl , data . settings ) ; } return data . dataSource ; } | Lazily creates and returns the data source for a given root url . |
6,954 | public EChange setConnectionTimeoutMilliSecs ( final long nMilliSecs ) { if ( m_nConnectionTimeoutMilliSecs == nMilliSecs ) return EChange . UNCHANGED ; m_nConnectionTimeoutMilliSecs = nMilliSecs ; return EChange . CHANGED ; } | Set the connection timeout in milliseconds . Values &le ; 0 are interpreted as indefinite timeout which is not recommended! |
6,955 | public EChange setTimeoutMilliSecs ( final long nMilliSecs ) { if ( m_nTimeoutMilliSecs == nMilliSecs ) return EChange . UNCHANGED ; m_nTimeoutMilliSecs = nMilliSecs ; return EChange . CHANGED ; } | Set the socket timeout in milliseconds . Values &le ; 0 are interpreted as indefinite timeout which is not recommended! |
6,956 | public static HttpHeaderMap getResponseHeaderMap ( final HttpServletResponse aHttpResponse ) { ValueEnforcer . notNull ( aHttpResponse , "HttpResponse" ) ; final HttpHeaderMap ret = new HttpHeaderMap ( ) ; for ( final String sName : aHttpResponse . getHeaderNames ( ) ) for ( final String sValue : aHttpResponse . getHeaders ( sName ) ) ret . addHeader ( sName , sValue ) ; return ret ; } | Get a complete response header map as a copy . |
6,957 | public final UnifiedResponse setContentAndCharset ( final String sContent , final Charset aCharset ) { ValueEnforcer . notNull ( sContent , "Content" ) ; setCharset ( aCharset ) ; setContent ( sContent . getBytes ( aCharset ) ) ; return this ; } | Utility method to set content and charset at once . |
6,958 | public final UnifiedResponse setContent ( final IHasInputStream aISP ) { ValueEnforcer . notNull ( aISP , "InputStreamProvider" ) ; if ( hasContent ( ) ) logInfo ( "Overwriting content with content provider!" ) ; m_aContentArray = null ; m_nContentArrayOfs = - 1 ; m_nContentArrayLength = - 1 ; m_aContentISP = aISP ; return this ; } | Set the response content provider . |
6,959 | public final UnifiedResponse setContentDispositionFilename ( final String sFilename ) { ValueEnforcer . notEmpty ( sFilename , "Filename" ) ; final String sFilenameToUse = FilenameHelper . getWithoutPath ( FilenameHelper . getAsSecureValidFilename ( sFilename ) ) ; if ( ! sFilename . equals ( sFilenameToUse ) ) logWarn ( "Content-Dispostion filename was internally modified from '" + sFilename + "' to '" + sFilenameToUse + "'" ) ; if ( false ) { if ( m_aContentDispositionEncoder == null ) m_aContentDispositionEncoder = StandardCharsets . ISO_8859_1 . newEncoder ( ) ; if ( ! m_aContentDispositionEncoder . canEncode ( sFilenameToUse ) ) logError ( "Content-Dispostion filename '" + sFilenameToUse + "' cannot be encoded to ISO-8859-1!" ) ; } if ( m_sContentDispositionFilename != null ) logInfo ( "Overwriting Content-Dispostion filename from '" + m_sContentDispositionFilename + "' to '" + sFilenameToUse + "'" ) ; m_sContentDispositionFilename = sFilenameToUse ; return this ; } | Set the content disposition filename for attachment download . |
6,960 | public final UnifiedResponse removeCaching ( ) { removeExpires ( ) ; removeCacheControl ( ) ; removeETag ( ) ; removeLastModified ( ) ; m_aResponseHeaderMap . removeHeaders ( CHttpHeader . PRAGMA ) ; return this ; } | Remove all settings and headers relevant to caching . |
6,961 | public final UnifiedResponse disableCaching ( ) { removeCaching ( ) ; if ( m_eHttpVersion . is10 ( ) ) { m_aResponseHeaderMap . setHeader ( CHttpHeader . EXPIRES , ResponseHelperSettings . EXPIRES_NEVER_STRING ) ; m_aResponseHeaderMap . setHeader ( CHttpHeader . PRAGMA , "no-cache" ) ; } else { final CacheControlBuilder aCacheControlBuilder = new CacheControlBuilder ( ) . setNoStore ( true ) . setNoCache ( true ) . setMustRevalidate ( true ) . setProxyRevalidate ( true ) ; if ( false ) aCacheControlBuilder . addExtension ( "post-check=0" ) . addExtension ( "pre-check=0" ) ; setCacheControl ( aCacheControlBuilder ) ; } return this ; } | A utility method that disables caching for this response . |
6,962 | public final UnifiedResponse enableCaching ( final int nSeconds ) { ValueEnforcer . isGT0 ( nSeconds , "Seconds" ) ; removeExpires ( ) ; removeCacheControl ( ) ; m_aResponseHeaderMap . removeHeaders ( CHttpHeader . PRAGMA ) ; if ( m_eHttpVersion . is10 ( ) ) { m_aResponseHeaderMap . setDateHeader ( CHttpHeader . EXPIRES , PDTFactory . getCurrentLocalDateTime ( ) . plusSeconds ( nSeconds ) ) ; } else { final CacheControlBuilder aCacheControlBuilder = new CacheControlBuilder ( ) . setPublic ( true ) . setMaxAgeSeconds ( nSeconds ) ; setCacheControl ( aCacheControlBuilder ) ; } return this ; } | Enable caching of this resource for the specified number of seconds . |
6,963 | public final UnifiedResponse setStatusUnauthorized ( final String sAuthenticate ) { _setStatus ( HttpServletResponse . SC_UNAUTHORIZED ) ; if ( StringHelper . hasText ( sAuthenticate ) ) m_aResponseHeaderMap . setHeader ( CHttpHeader . WWW_AUTHENTICATE , sAuthenticate ) ; return this ; } | Special handling for returning status code 401 UNAUTHORIZED . |
6,964 | public final void setCustomResponseHeaders ( final HttpHeaderMap aOther ) { m_aResponseHeaderMap . removeAll ( ) ; if ( aOther != null ) m_aResponseHeaderMap . setAllHeaders ( aOther ) ; } | Set many custom headers at once . All existing headers are unconditionally removed . |
6,965 | static private JsonTransformer factory ( Object jsonObject ) throws InvalidTransformerException { if ( jsonObject instanceof JSONObject ) { return factory ( ( JSONObject ) jsonObject ) ; } else if ( jsonObject instanceof JSONArray ) { return factory ( ( JSONArray ) jsonObject ) ; } else if ( jsonObject instanceof String ) { return factoryAction ( ( String ) jsonObject ) ; } throw new InvalidTransformerException ( "Not supported transformer type: " + jsonObject ) ; } | Convenient private method |
6,966 | public void invalidate ( ) { if ( m_bInvalidated ) throw new IllegalStateException ( "Request scope already invalidated!" ) ; m_bInvalidated = true ; if ( m_aServletContext != null ) { final ServletRequestEvent aSRE = new ServletRequestEvent ( m_aServletContext , this ) ; for ( final ServletRequestListener aListener : MockHttpListener . getAllServletRequestListeners ( ) ) aListener . requestDestroyed ( aSRE ) ; } close ( ) ; clearAttributes ( ) ; } | Invalidate this request clearing its state and invoking all HTTP event listener . |
6,967 | public QValue getQValueOfEncoding ( final String sEncoding ) { ValueEnforcer . notNull ( sEncoding , "Encoding" ) ; QValue aQuality = m_aMap . get ( _unify ( sEncoding ) ) ; if ( aQuality == null ) { aQuality = m_aMap . get ( AcceptEncodingHandler . ANY_ENCODING ) ; if ( aQuality == null ) { return QValue . MIN_QVALUE ; } } return aQuality ; } | Return the associated quality of the given encoding . |
6,968 | public void bind ( ) { program . use ( ) ; if ( textures != null ) { final TIntObjectIterator < Texture > iterator = textures . iterator ( ) ; while ( iterator . hasNext ( ) ) { iterator . advance ( ) ; final int unit = iterator . key ( ) ; iterator . value ( ) . bind ( unit ) ; program . bindSampler ( unit ) ; } } } | Binds the material to the OpenGL context . |
6,969 | public void setProgram ( Program program ) { if ( program == null ) { throw new IllegalStateException ( "Program cannot be null" ) ; } program . checkCreated ( ) ; this . program = program ; } | Sets the program to be used by this material to shade the models . |
6,970 | public void addTexture ( int unit , Texture texture ) { if ( texture == null ) { throw new IllegalStateException ( "Texture cannot be null" ) ; } texture . checkCreated ( ) ; if ( textures == null ) { textures = new TIntObjectHashMap < > ( ) ; } textures . put ( unit , texture ) ; } | Adds a texture to the material . If a texture is a already present in the same unit as this one it will be replaced . |
6,971 | public boolean maybeAddRead ( Read read ) { if ( ! isUnmappedMateOfMappedRead ( read ) ) { return false ; } final String reference = read . getNextMatePosition ( ) . getReferenceName ( ) ; String key = getReadKey ( read ) ; Map < String , ArrayList < Read > > reads = unmappedReads . get ( reference ) ; if ( reads == null ) { reads = new HashMap < String , ArrayList < Read > > ( ) ; unmappedReads . put ( reference , reads ) ; } ArrayList < Read > mates = reads . get ( key ) ; if ( mates == null ) { mates = new ArrayList < Read > ( ) ; reads . put ( key , mates ) ; } if ( getReadCount ( ) < MAX_READS ) { mates . add ( read ) ; readCount ++ ; return true ; } else { LOG . warning ( "Reached the limit of in-memory unmapped mates for injection." ) ; } return false ; } | Checks and adds the read if we need to remember it for injection . Returns true if the read was added . |
6,972 | public ArrayList < Read > getUnmappedMates ( Read read ) { if ( read . getNumberReads ( ) < 2 || ( read . hasNextMatePosition ( ) && read . getNextMatePosition ( ) != null ) || ! read . hasAlignment ( ) || read . getAlignment ( ) == null || ! read . getAlignment ( ) . hasPosition ( ) || read . getAlignment ( ) . getPosition ( ) == null || read . getAlignment ( ) . getPosition ( ) . getReferenceName ( ) == null || read . getAlignment ( ) . getPosition ( ) . getReferenceName ( ) . isEmpty ( ) || read . getFragmentName ( ) == null || read . getFragmentName ( ) . isEmpty ( ) ) { return null ; } final String reference = read . getAlignment ( ) . getPosition ( ) . getReferenceName ( ) ; final String key = getReadKey ( read ) ; Map < String , ArrayList < Read > > reads = unmappedReads . get ( reference ) ; if ( reads != null ) { final ArrayList < Read > mates = reads . get ( key ) ; if ( mates != null && mates . size ( ) > 1 ) { Collections . sort ( mates , matesComparator ) ; } return mates ; } return null ; } | Checks if the passed read has unmapped mates that need to be injected and if so - returns them . The returned list is sorted by read number to handle the case of multi - read fragments . |
6,973 | public static void setSessionPassivationAllowed ( final boolean bSessionPassivationAllowed ) { s_aSessionPassivationAllowed . set ( bSessionPassivationAllowed ) ; if ( LOGGER . isInfoEnabled ( ) ) LOGGER . info ( "Session passivation is now " + ( bSessionPassivationAllowed ? "enabled" : "disabled" ) ) ; final ScopeSessionManager aSSM = ScopeSessionManager . getInstance ( ) ; aSSM . setDestroyAllSessionsOnScopeEnd ( ! bSessionPassivationAllowed ) ; aSSM . setEndAllSessionsOnScopeEnd ( ! bSessionPassivationAllowed ) ; for ( final ISessionWebScope aSessionWebScope : WebScopeSessionManager . getAllSessionWebScopes ( ) ) { final HttpSession aHttpSession = aSessionWebScope . getSession ( ) ; if ( bSessionPassivationAllowed ) { if ( aHttpSession . getAttribute ( SESSION_ATTR_SESSION_SCOPE_ACTIVATOR ) == null ) aHttpSession . setAttribute ( SESSION_ATTR_SESSION_SCOPE_ACTIVATOR , new SessionWebScopeActivator ( aSessionWebScope ) ) ; } else { aHttpSession . removeAttribute ( SESSION_ATTR_SESSION_SCOPE_ACTIVATOR ) ; } } } | Allow or disallow session passivation |
6,974 | @ DevelopersNote ( "This is only for project-internal use!" ) public static ISessionWebScope internalGetOrCreateSessionScope ( final HttpSession aHttpSession , final boolean bCreateIfNotExisting , final boolean bItsOkayToCreateANewScope ) { ValueEnforcer . notNull ( aHttpSession , "HttpSession" ) ; final String sSessionID = aHttpSession . getId ( ) ; ISessionScope aSessionWebScope = ScopeSessionManager . getInstance ( ) . getSessionScopeOfID ( sSessionID ) ; if ( aSessionWebScope == null && bCreateIfNotExisting ) { if ( ! bItsOkayToCreateANewScope ) { if ( LOGGER . isWarnEnabled ( ) ) LOGGER . warn ( "Creating a new session web scope for ID '" + sSessionID + "' but there should already be one!" + " Check your HttpSessionListener implementation." ) ; } aSessionWebScope = onSessionBegin ( aHttpSession ) ; } try { return ( ISessionWebScope ) aSessionWebScope ; } catch ( final ClassCastException ex ) { throw new IllegalStateException ( "Session scope object is not a web scope but: " + aSessionWebScope , ex ) ; } } | Internal method which does the main logic for session web scope creation |
6,975 | @ DevelopersNote ( "This is only for project-internal use!" ) public static ISessionWebScope internalGetSessionScope ( final boolean bCreateIfNotExisting , final boolean bItsOkayToCreateANewSession ) { final IRequestWebScope aRequestScope = getRequestScopeOrNull ( ) ; return internalGetSessionScope ( aRequestScope , bCreateIfNotExisting , bItsOkayToCreateANewSession ) ; } | Get the session scope from the current request scope . |
6,976 | @ DevelopersNote ( "This is only for project-internal use!" ) public static ISessionWebScope internalGetSessionScope ( final IRequestWebScope aRequestScope , final boolean bCreateIfNotExisting , final boolean bItsOkayToCreateANewSession ) { if ( aRequestScope != null ) { final HttpSession aHttpSession = aRequestScope . getSession ( bCreateIfNotExisting ) ; if ( aHttpSession != null ) return internalGetOrCreateSessionScope ( aHttpSession , bCreateIfNotExisting , bItsOkayToCreateANewSession ) ; } else { if ( bCreateIfNotExisting ) throw new IllegalStateException ( "No request scope is present, so no session scope can be retrieved!" ) ; } return null ; } | Get the session scope of the provided request scope . |
6,977 | public ByteBuffer getIndicesBuffer ( ) { final ByteBuffer buffer = CausticUtil . createByteBuffer ( indices . size ( ) * DataType . INT . getByteSize ( ) ) ; for ( int i = 0 ; i < indices . size ( ) ; i ++ ) { buffer . putInt ( indices . get ( i ) ) ; } buffer . flip ( ) ; return buffer ; } | Returns a byte buffer containing all the current indices . |
6,978 | public void addAttribute ( int index , VertexAttribute attribute ) { attributes . put ( index , attribute ) ; nameToIndex . put ( attribute . getName ( ) , index ) ; } | Adds an attribute . |
6,979 | public int getAttributeSize ( int index ) { final VertexAttribute attribute = getAttribute ( index ) ; if ( attribute == null ) { return - 1 ; } return attribute . getSize ( ) ; } | Returns the size of the attribute at the provided index or - 1 if none can be found . |
6,980 | public DataType getAttributeType ( int index ) { final VertexAttribute attribute = getAttribute ( index ) ; if ( attribute == null ) { return null ; } return attribute . getType ( ) ; } | Returns the type of the attribute at the provided index or null if none can be found . |
6,981 | public String getAttributeName ( int index ) { final VertexAttribute attribute = getAttribute ( index ) ; if ( attribute == null ) { return null ; } return attribute . getName ( ) ; } | Returns the name of the attribute at the provided index or null if none can be found . |
6,982 | public ByteBuffer getAttributeBuffer ( int index ) { final VertexAttribute attribute = getAttribute ( index ) ; if ( attribute == null ) { return null ; } return attribute . getData ( ) ; } | Returns the buffer for the attribute at the provided index or null if none can be found . The buffer is returned filled and ready for reading . |
6,983 | public void copy ( VertexData data ) { clear ( ) ; indices . addAll ( data . indices ) ; final TIntObjectIterator < VertexAttribute > iterator = data . attributes . iterator ( ) ; while ( iterator . hasNext ( ) ) { iterator . advance ( ) ; attributes . put ( iterator . key ( ) , iterator . value ( ) . clone ( ) ) ; } nameToIndex . putAll ( data . nameToIndex ) ; } | Replaces the contents of this vertex data by the provided one . This is a deep copy . The vertex attribute are each individually cloned . |
6,984 | public QValue getQValueOfLanguage ( final String sLanguage ) { ValueEnforcer . notNull ( sLanguage , "Language" ) ; QValue aQuality = m_aMap . get ( _unify ( sLanguage ) ) ; if ( aQuality == null ) { aQuality = m_aMap . get ( AcceptLanguageHandler . ANY_LANGUAGE ) ; if ( aQuality == null ) { return QValue . MIN_QVALUE ; } } return aQuality ; } | Return the associated quality of the given language . |
6,985 | public void setVertexArray ( VertexArray vertexArray ) { if ( vertexArray == null ) { throw new IllegalArgumentException ( "Vertex array cannot be null" ) ; } vertexArray . checkCreated ( ) ; this . vertexArray = vertexArray ; } | Sets the vertex array for this model . |
6,986 | public Matrix4f getMatrix ( ) { if ( updateMatrix ) { final Matrix4f matrix = Matrix4f . createScaling ( scale . toVector4 ( 1 ) ) . rotate ( rotation ) . translate ( position ) ; if ( parent == null ) { this . matrix = matrix ; } else { childMatrix = matrix ; } updateMatrix = false ; } if ( parent != null ) { final Matrix4f parentMatrix = parent . getMatrix ( ) ; if ( parentMatrix != lastParentMatrix ) { matrix = parentMatrix . mul ( childMatrix ) ; lastParentMatrix = parentMatrix ; } } return matrix ; } | Returns the transformation matrix that represent the model s current scale rotation and position . |
6,987 | public void setParent ( Model parent ) { if ( parent == this ) { throw new IllegalArgumentException ( "The model can't be its own parent" ) ; } if ( parent == null ) { this . parent . children . remove ( this ) ; } else { parent . children . add ( this ) ; } this . parent = parent ; } | Sets the parent model . This model s position rotation and scale will be relative to that model if not null . |
6,988 | public boolean hasAlias ( String aliasName ) { boolean result = false ; for ( Alias item : getAliasesList ( ) ) { if ( item . getName ( ) . equals ( aliasName ) ) { result = true ; } } return result ; } | Check if the given alias exists in the list of aliases or not . |
6,989 | public static String encode ( final String sValue , final Charset aCharset , final ECodec eCodec ) { if ( sValue == null ) return null ; try { switch ( eCodec ) { case Q : return new RFC1522QCodec ( aCharset ) . getEncoded ( sValue ) ; case B : default : return new RFC1522BCodec ( aCharset ) . getEncoded ( sValue ) ; } } catch ( final Exception ex ) { return sValue ; } } | Used to encode a string as specified by RFC 2047 |
6,990 | public static String decode ( final String sValue ) { if ( sValue == null ) return null ; try { return new RFC1522BCodec ( ) . getDecoded ( sValue ) ; } catch ( final DecodeException de ) { try { return new RFC1522QCodec ( ) . getDecoded ( sValue ) ; } catch ( final Exception ex ) { return sValue ; } } catch ( final Exception e ) { return sValue ; } } | Used to decode a string as specified by RFC 2047 |
6,991 | public static void addRequest ( final String sRequestID , final IRequestWebScope aRequestScope ) { getInstance ( ) . m_aRequestTrackingMgr . addRequest ( sRequestID , aRequestScope , s_aParallelRunningCallbacks ) ; } | Add new request to the tracking |
6,992 | public static void removeRequest ( final String sRequestID ) { final RequestTracker aTracker = getGlobalSingletonIfInstantiated ( RequestTracker . class ) ; if ( aTracker != null ) aTracker . m_aRequestTrackingMgr . removeRequest ( sRequestID , s_aParallelRunningCallbacks ) ; } | Remove a request from the tracking . |
6,993 | public ESuccess queueMail ( final ISMTPSettings aSMTPSettings , final IMutableEmailData aMailData ) { return MailAPI . queueMail ( aSMTPSettings , aMailData ) ; } | Unconditionally queue a mail |
6,994 | public int queueMails ( final ISMTPSettings aSMTPSettings , final Collection < ? extends IMutableEmailData > aMailDataList ) { return MailAPI . queueMails ( aSMTPSettings , aMailDataList ) ; } | Queue multiple mails at once . |
6,995 | public static void setPerformMXRecordCheck ( final boolean bPerformMXRecordCheck ) { s_aPerformMXRecordCheck . set ( bPerformMXRecordCheck ) ; if ( LOGGER . isInfoEnabled ( ) ) LOGGER . info ( "Email address record check is " + ( bPerformMXRecordCheck ? "enabled" : "disabled" ) ) ; } | Set the global check MX record flag . |
6,996 | private static boolean _hasMXRecord ( final String sHostName ) { try { final Record [ ] aRecords = new Lookup ( sHostName , Type . MX ) . run ( ) ; return aRecords != null && aRecords . length > 0 ; } catch ( final Exception ex ) { if ( LOGGER . isWarnEnabled ( ) ) LOGGER . warn ( "Failed to check for MX record on host '" + sHostName + "': " + ex . getClass ( ) . getName ( ) + " - " + ex . getMessage ( ) ) ; return false ; } } | Check if the passed host name has an MX record . |
6,997 | public static boolean isValid ( final String sEmail ) { return s_aPerformMXRecordCheck . get ( ) ? isValidWithMXCheck ( sEmail ) : EmailAddressHelper . isValid ( sEmail ) ; } | Checks if a value is a valid e - mail address . Depending on the global value for the MX record check the check is performed incl . the MX record check or without . |
6,998 | public static boolean isValidWithMXCheck ( final String sEmail ) { if ( ! EmailAddressHelper . isValid ( sEmail ) ) return false ; final String sUnifiedEmail = EmailAddressHelper . getUnifiedEmailAddress ( sEmail ) ; final int i = sUnifiedEmail . indexOf ( '@' ) ; final String sHostName = sUnifiedEmail . substring ( i + 1 ) ; return _hasMXRecord ( sHostName ) ; } | Checks if a value is a valid e - mail address according to a complex regular expression . Additionally an MX record lookup is performed to see whether this host provides SMTP services . |
6,999 | public String getResponseBodyAsString ( final Charset aCharset ) { return m_aResponseBody == null ? null : new String ( m_aResponseBody , aCharset ) ; } | Get the response body as a string in the provided charset . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.