idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
27,300
private void nextSegment ( ) { assert ( checkDir > 0 && seq == rawSeq && pos != limit ) ; int p = pos ; int prevCC = 0 ; for ( ; ; ) { int q = p ; int c = Character . codePointAt ( seq , p ) ; p += Character . charCount ( c ) ; int fcd16 = nfcImpl . getFCD16 ( c ) ; int leadCC = fcd16 >> 8 ; if ( leadCC == 0 && q != pos ) { limit = segmentLimit = q ; break ; } if ( leadCC != 0 && ( prevCC > leadCC || CollationFCD . isFCD16OfTibetanCompositeVowel ( fcd16 ) ) ) { do { q = p ; if ( p == rawLimit ) { break ; } c = Character . codePointAt ( seq , p ) ; p += Character . charCount ( c ) ; } while ( nfcImpl . getFCD16 ( c ) > 0xff ) ; normalize ( pos , q ) ; pos = start ; break ; } prevCC = fcd16 & 0xff ; if ( p == rawLimit || prevCC == 0 ) { limit = segmentLimit = p ; break ; } } assert ( pos != limit ) ; checkDir = 0 ; }
Extend the FCD text segment forward or normalize around pos . To be called when checkDir > 0 && pos ! = limit . Returns with checkDir == 0 and pos ! = limit .
27,301
private void previousSegment ( ) { assert ( checkDir < 0 && seq == rawSeq && pos != start ) ; int p = pos ; int nextCC = 0 ; for ( ; ; ) { int q = p ; int c = Character . codePointBefore ( seq , p ) ; p -= Character . charCount ( c ) ; int fcd16 = nfcImpl . getFCD16 ( c ) ; int trailCC = fcd16 & 0xff ; if ( trailCC == 0 && q != pos ) { start = segmentStart = q ; break ; } if ( trailCC != 0 && ( ( nextCC != 0 && trailCC > nextCC ) || CollationFCD . isFCD16OfTibetanCompositeVowel ( fcd16 ) ) ) { do { q = p ; if ( fcd16 <= 0xff || p == rawStart ) { break ; } c = Character . codePointBefore ( seq , p ) ; p -= Character . charCount ( c ) ; } while ( ( fcd16 = nfcImpl . getFCD16 ( c ) ) != 0 ) ; normalize ( q , pos ) ; pos = limit ; break ; } nextCC = fcd16 >> 8 ; if ( p == rawStart || nextCC == 0 ) { start = segmentStart = p ; break ; } } assert ( pos != start ) ; checkDir = 0 ; }
Extend the FCD text segment backward or normalize around pos . To be called when checkDir < 0 && pos ! = start . Returns with checkDir == 0 and pos ! = start .
27,302
private static void setBlocker ( Thread t , Object arg ) { U . putObject ( t , PARKBLOCKER , arg ) ; }
Cannot be instantiated .
27,303
public static void park ( Object blocker ) { Thread t = Thread . currentThread ( ) ; setBlocker ( t , blocker ) ; U . park ( false , 0L ) ; setBlocker ( t , null ) ; }
Disables the current thread for thread scheduling purposes unless the permit is available .
27,304
public static void parkUntil ( Object blocker , long deadline ) { Thread t = Thread . currentThread ( ) ; setBlocker ( t , blocker ) ; U . park ( true , deadline ) ; setBlocker ( t , null ) ; }
Disables the current thread for thread scheduling purposes until the specified deadline unless the permit is available .
27,305
private static void writeFullyImpl ( WritableByteChannel ch , ByteBuffer bb ) throws IOException { while ( bb . remaining ( ) > 0 ) { int n = ch . write ( bb ) ; if ( n <= 0 ) throw new RuntimeException ( "no bytes written" ) ; } }
Write all remaining bytes in buffer to the given channel . If the channel is selectable then it must be configured blocking .
27,306
private static void writeFully ( WritableByteChannel ch , ByteBuffer bb ) throws IOException { if ( ch instanceof SelectableChannel ) { SelectableChannel sc = ( SelectableChannel ) ch ; synchronized ( sc . blockingLock ( ) ) { if ( ! sc . isBlocking ( ) ) throw new IllegalBlockingModeException ( ) ; writeFullyImpl ( ch , bb ) ; } } else { writeFullyImpl ( ch , bb ) ; } }
Write all remaining bytes in buffer to the given channel .
27,307
public static InputStream newInputStream ( ReadableByteChannel ch ) { checkNotNull ( ch , "ch" ) ; return new sun . nio . ch . ChannelInputStream ( ch ) ; }
Constructs a stream that reads bytes from the given channel .
27,308
public static OutputStream newOutputStream ( final WritableByteChannel ch ) { checkNotNull ( ch , "ch" ) ; return new OutputStream ( ) { private ByteBuffer bb = null ; private byte [ ] bs = null ; private byte [ ] b1 = null ; public synchronized void write ( int b ) throws IOException { if ( b1 == null ) b1 = new byte [ 1 ] ; b1 [ 0 ] = ( byte ) b ; this . write ( b1 ) ; } public synchronized void write ( byte [ ] bs , int off , int len ) throws IOException { if ( ( off < 0 ) || ( off > bs . length ) || ( len < 0 ) || ( ( off + len ) > bs . length ) || ( ( off + len ) < 0 ) ) { throw new IndexOutOfBoundsException ( ) ; } else if ( len == 0 ) { return ; } ByteBuffer bb = ( ( this . bs == bs ) ? this . bb : ByteBuffer . wrap ( bs ) ) ; bb . limit ( Math . min ( off + len , bb . capacity ( ) ) ) ; bb . position ( off ) ; this . bb = bb ; this . bs = bs ; Channels . writeFully ( ch , bb ) ; } public void close ( ) throws IOException { ch . close ( ) ; } } ; }
Constructs a stream that writes bytes to the given channel .
27,309
public static ReadableByteChannel newChannel ( final InputStream in ) { checkNotNull ( in , "in" ) ; if ( in instanceof FileInputStream && FileInputStream . class . equals ( in . getClass ( ) ) ) { return ( ( FileInputStream ) in ) . getChannel ( ) ; } return new ReadableByteChannelImpl ( in ) ; }
Constructs a channel that reads bytes from the given stream .
27,310
public static Reader newReader ( ReadableByteChannel ch , CharsetDecoder dec , int minBufferCap ) { checkNotNull ( ch , "ch" ) ; return StreamDecoder . forDecoder ( ch , dec . reset ( ) , minBufferCap ) ; }
Constructs a reader that decodes bytes from the given channel using the given decoder .
27,311
public static Reader newReader ( ReadableByteChannel ch , String csName ) { checkNotNull ( csName , "csName" ) ; return newReader ( ch , Charset . forName ( csName ) . newDecoder ( ) , - 1 ) ; }
Constructs a reader that decodes bytes from the given channel according to the named charset .
27,312
public static Writer newWriter ( final WritableByteChannel ch , final CharsetEncoder enc , final int minBufferCap ) { checkNotNull ( ch , "ch" ) ; return StreamEncoder . forEncoder ( ch , enc . reset ( ) , minBufferCap ) ; }
Constructs a writer that encodes characters using the given encoder and writes the resulting bytes to the given channel .
27,313
public static Writer newWriter ( WritableByteChannel ch , String csName ) { checkNotNull ( csName , "csName" ) ; return newWriter ( ch , Charset . forName ( csName ) . newEncoder ( ) , - 1 ) ; }
Constructs a writer that encodes characters according to the named charset and writes the resulting bytes to the given channel .
27,314
public Enumeration < JarEntry > entries ( ) { final Enumeration enum_ = super . entries ( ) ; return new Enumeration < JarEntry > ( ) { public boolean hasMoreElements ( ) { return enum_ . hasMoreElements ( ) ; } public JarFileEntry nextElement ( ) { ZipEntry ze = ( ZipEntry ) enum_ . nextElement ( ) ; return new JarFileEntry ( ze ) ; } } ; }
Returns an enumeration of the zip file entries .
27,315
private void checkMemoryManagementOption ( MemoryManagementOption option ) { if ( memoryManagementOption != null && memoryManagementOption != option ) { usage ( "Multiple memory management options cannot be set." ) ; } setMemoryManagementOption ( option ) ; }
Check that the memory management option wasn t previously set to a different value . If okay then set the option .
27,316
public Iterable < VariableElement > getImplicitPrefixParams ( TypeElement type ) { return Iterables . transform ( getCaptures ( type ) , Capture :: getParam ) ; }
Returns all the implicit params that come before explicit params in a constructor .
27,317
public Iterable < VariableElement > getImplicitPostfixParams ( TypeElement type ) { if ( ElementUtil . isEnum ( type ) ) { return implicitEnumParams ; } return Collections . emptyList ( ) ; }
returns all the implicit params that come after explicit params in a constructor .
27,318
static Object find ( String factoryId , String fallbackClassName ) throws ConfigurationError { ClassLoader classLoader = findClassLoader ( ) ; String systemProp = System . getProperty ( factoryId ) ; if ( systemProp != null && systemProp . length ( ) > 0 ) { if ( debug ) debugPrintln ( "found " + systemProp + " in the system property " + factoryId ) ; return newInstance ( systemProp , classLoader ) ; } try { String factoryClassName = CacheHolder . cacheProps . getProperty ( factoryId ) ; if ( debug ) debugPrintln ( "found " + factoryClassName + " in $java.home/jaxp.properties" ) ; if ( factoryClassName != null ) { return newInstance ( factoryClassName , classLoader ) ; } } catch ( Exception ex ) { if ( debug ) { ex . printStackTrace ( ) ; } } Object provider = findJarServiceProvider ( factoryId ) ; if ( provider != null ) { return provider ; } if ( fallbackClassName == null ) { throw new ConfigurationError ( "Provider for " + factoryId + " cannot be found" , null ) ; } if ( debug ) debugPrintln ( "loaded from fallback value: " + fallbackClassName ) ; return newInstance ( fallbackClassName , classLoader ) ; }
Finds the implementation Class object in the specified order . Main entry point . Package private so this code can be shared .
27,319
private static String which ( Class clazz ) { try { String classnameAsResource = clazz . getName ( ) . replace ( '.' , '/' ) + ".class" ; ClassLoader loader = clazz . getClassLoader ( ) ; URL it ; if ( loader != null ) { it = loader . getResource ( classnameAsResource ) ; } else { it = ClassLoader . getSystemResource ( classnameAsResource ) ; } if ( it != null ) { return it . toString ( ) ; } } catch ( VirtualMachineError vme ) { throw vme ; } catch ( ThreadDeath td ) { throw td ; } catch ( Throwable t ) { if ( debug ) { t . printStackTrace ( ) ; } } return "unknown location" ; }
Returns the location where the given Class is loaded from .
27,320
private int getNextDelimiter ( int offset ) { if ( offset >= 0 ) { int result = offset ; int c = 0 ; if ( delims == null ) { do { c = UTF16 . charAt ( m_source_ , result ) ; if ( m_delimiters_ . contains ( c ) ) { break ; } result ++ ; } while ( result < m_length_ ) ; } else { do { c = UTF16 . charAt ( m_source_ , result ) ; if ( c < delims . length && delims [ c ] ) { break ; } result ++ ; } while ( result < m_length_ ) ; } if ( result < m_length_ ) { return result ; } } return - 1 - m_length_ ; }
Gets the index of the next delimiter after offset
27,321
public String getSetterMethodName ( ) { if ( null == m_setterString ) { if ( m_foreignAttr == this ) { return S_FOREIGNATTR_SETTER ; } else if ( m_name . equals ( "*" ) ) { m_setterString = "addLiteralResultAttribute" ; return m_setterString ; } StringBuffer outBuf = new StringBuffer ( ) ; outBuf . append ( "set" ) ; if ( ( m_namespace != null ) && m_namespace . equals ( Constants . S_XMLNAMESPACEURI ) ) { outBuf . append ( "Xml" ) ; } int n = m_name . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) { char c = m_name . charAt ( i ) ; if ( '-' == c ) { i ++ ; c = m_name . charAt ( i ) ; c = Character . toUpperCase ( c ) ; } else if ( 0 == i ) { c = Character . toUpperCase ( c ) ; } outBuf . append ( c ) ; } m_setterString = outBuf . toString ( ) ; } return m_setterString ; }
Return a string that should represent the setter method . The setter method name will be created algorithmically the first time this method is accessed and then cached for return by subsequent invocations of this method .
27,322
AVT processAVT ( StylesheetHandler handler , String uri , String name , String rawName , String value , ElemTemplateElement owner ) throws org . xml . sax . SAXException { try { AVT avt = new AVT ( handler , uri , name , rawName , value , owner ) ; return avt ; } catch ( TransformerException te ) { throw new org . xml . sax . SAXException ( te ) ; } }
Process an attribute string of type T_AVT into a AVT value .
27,323
Object processCHAR ( StylesheetHandler handler , String uri , String name , String rawName , String value , ElemTemplateElement owner ) throws org . xml . sax . SAXException { if ( getSupportsAVT ( ) ) { try { AVT avt = new AVT ( handler , uri , name , rawName , value , owner ) ; if ( ( avt . isSimple ( ) ) && ( value . length ( ) != 1 ) ) { handleError ( handler , XSLTErrorResources . INVALID_TCHAR , new Object [ ] { name , value } , null ) ; return null ; } return avt ; } catch ( TransformerException te ) { throw new org . xml . sax . SAXException ( te ) ; } } else { if ( value . length ( ) != 1 ) { handleError ( handler , XSLTErrorResources . INVALID_TCHAR , new Object [ ] { name , value } , null ) ; return null ; } return new Character ( value . charAt ( 0 ) ) ; } }
Process an attribute string of type T_CHAR into a Character value .
27,324
Object processENUM ( StylesheetHandler handler , String uri , String name , String rawName , String value , ElemTemplateElement owner ) throws org . xml . sax . SAXException { AVT avt = null ; if ( getSupportsAVT ( ) ) { try { avt = new AVT ( handler , uri , name , rawName , value , owner ) ; if ( ! avt . isSimple ( ) ) return avt ; } catch ( TransformerException te ) { throw new org . xml . sax . SAXException ( te ) ; } } int retVal = this . getEnum ( value ) ; if ( retVal == StringToIntTable . INVALID_KEY ) { StringBuffer enumNamesList = getListOfEnums ( ) ; handleError ( handler , XSLTErrorResources . INVALID_ENUM , new Object [ ] { name , value , enumNamesList . toString ( ) } , null ) ; return null ; } if ( getSupportsAVT ( ) ) return avt ; else return new Integer ( retVal ) ; }
Process an attribute string of type T_ENUM into a int value .
27,325
Object processENUM_OR_PQNAME ( StylesheetHandler handler , String uri , String name , String rawName , String value , ElemTemplateElement owner ) throws org . xml . sax . SAXException { Object objToReturn = null ; if ( getSupportsAVT ( ) ) { try { AVT avt = new AVT ( handler , uri , name , rawName , value , owner ) ; if ( ! avt . isSimple ( ) ) return avt ; else objToReturn = avt ; } catch ( TransformerException te ) { throw new org . xml . sax . SAXException ( te ) ; } } int key = this . getEnum ( value ) ; if ( key != StringToIntTable . INVALID_KEY ) { if ( objToReturn == null ) objToReturn = new Integer ( key ) ; } else { try { QName qname = new QName ( value , handler , true ) ; if ( objToReturn == null ) objToReturn = qname ; if ( qname . getPrefix ( ) == null ) { StringBuffer enumNamesList = getListOfEnums ( ) ; enumNamesList . append ( " <qname-but-not-ncname>" ) ; handleError ( handler , XSLTErrorResources . INVALID_ENUM , new Object [ ] { name , value , enumNamesList . toString ( ) } , null ) ; return null ; } } catch ( IllegalArgumentException ie ) { StringBuffer enumNamesList = getListOfEnums ( ) ; enumNamesList . append ( " <qname-but-not-ncname>" ) ; handleError ( handler , XSLTErrorResources . INVALID_ENUM , new Object [ ] { name , value , enumNamesList . toString ( ) } , ie ) ; return null ; } catch ( RuntimeException re ) { StringBuffer enumNamesList = getListOfEnums ( ) ; enumNamesList . append ( " <qname-but-not-ncname>" ) ; handleError ( handler , XSLTErrorResources . INVALID_ENUM , new Object [ ] { name , value , enumNamesList . toString ( ) } , re ) ; return null ; } } return objToReturn ; }
Process an attribute string of that is either an enumerated value or a qname - but - not - ncname . Returns an AVT if this attribute support AVT ; otherwise returns int or qname .
27,326
Object processEXPR ( StylesheetHandler handler , String uri , String name , String rawName , String value , ElemTemplateElement owner ) throws org . xml . sax . SAXException { try { XPath expr = handler . createXPath ( value , owner ) ; return expr ; } catch ( TransformerException te ) { throw new org . xml . sax . SAXException ( te ) ; } }
Process an attribute string of type T_EXPR into an XPath value .
27,327
Object processPATTERN ( StylesheetHandler handler , String uri , String name , String rawName , String value , ElemTemplateElement owner ) throws org . xml . sax . SAXException { try { XPath pattern = handler . createMatchPatternXPath ( value , owner ) ; return pattern ; } catch ( TransformerException te ) { throw new org . xml . sax . SAXException ( te ) ; } }
Process an attribute string of type T_PATTERN into an XPath match pattern value .
27,328
Object processNUMBER ( StylesheetHandler handler , String uri , String name , String rawName , String value , ElemTemplateElement owner ) throws org . xml . sax . SAXException { if ( getSupportsAVT ( ) ) { Double val ; AVT avt = null ; try { avt = new AVT ( handler , uri , name , rawName , value , owner ) ; if ( avt . isSimple ( ) ) { val = Double . valueOf ( value ) ; } } catch ( TransformerException te ) { throw new org . xml . sax . SAXException ( te ) ; } catch ( NumberFormatException nfe ) { handleError ( handler , XSLTErrorResources . INVALID_NUMBER , new Object [ ] { name , value } , nfe ) ; return null ; } return avt ; } else { try { return Double . valueOf ( value ) ; } catch ( NumberFormatException nfe ) { handleError ( handler , XSLTErrorResources . INVALID_NUMBER , new Object [ ] { name , value } , nfe ) ; return null ; } } }
Process an attribute string of type T_NUMBER into a double value .
27,329
Object processNCNAME ( StylesheetHandler handler , String uri , String name , String rawName , String value , ElemTemplateElement owner ) throws org . xml . sax . SAXException { if ( getSupportsAVT ( ) ) { AVT avt = null ; try { avt = new AVT ( handler , uri , name , rawName , value , owner ) ; if ( ( avt . isSimple ( ) ) && ( ! XML11Char . isXML11ValidNCName ( value ) ) ) { handleError ( handler , XSLTErrorResources . INVALID_NCNAME , new Object [ ] { name , value } , null ) ; return null ; } return avt ; } catch ( TransformerException te ) { throw new org . xml . sax . SAXException ( te ) ; } } else { if ( ! XML11Char . isXML11ValidNCName ( value ) ) { handleError ( handler , XSLTErrorResources . INVALID_NCNAME , new Object [ ] { name , value } , null ) ; return null ; } return value ; } }
Process an attribute string of type NCName into a String
27,330
Vector processSIMPLEPATTERNLIST ( StylesheetHandler handler , String uri , String name , String rawName , String value , ElemTemplateElement owner ) throws org . xml . sax . SAXException { try { StringTokenizer tokenizer = new StringTokenizer ( value , " \t\n\r\f" ) ; int nPatterns = tokenizer . countTokens ( ) ; Vector patterns = new Vector ( nPatterns ) ; for ( int i = 0 ; i < nPatterns ; i ++ ) { XPath pattern = handler . createMatchPatternXPath ( tokenizer . nextToken ( ) , owner ) ; patterns . addElement ( pattern ) ; } return patterns ; } catch ( TransformerException te ) { throw new org . xml . sax . SAXException ( te ) ; } }
Process an attribute string of type T_SIMPLEPATTERNLIST into a vector of XPath match patterns .
27,331
StringVector processSTRINGLIST ( StylesheetHandler handler , String uri , String name , String rawName , String value ) { StringTokenizer tokenizer = new StringTokenizer ( value , " \t\n\r\f" ) ; int nStrings = tokenizer . countTokens ( ) ; StringVector strings = new StringVector ( nStrings ) ; for ( int i = 0 ; i < nStrings ; i ++ ) { strings . addElement ( tokenizer . nextToken ( ) ) ; } return strings ; }
Process an attribute string of type T_STRINGLIST into a vector of XPath match patterns .
27,332
StringVector processPREFIX_URLLIST ( StylesheetHandler handler , String uri , String name , String rawName , String value ) throws org . xml . sax . SAXException { StringTokenizer tokenizer = new StringTokenizer ( value , " \t\n\r\f" ) ; int nStrings = tokenizer . countTokens ( ) ; StringVector strings = new StringVector ( nStrings ) ; for ( int i = 0 ; i < nStrings ; i ++ ) { String prefix = tokenizer . nextToken ( ) ; String url = handler . getNamespaceForPrefix ( prefix ) ; if ( url != null ) strings . addElement ( url ) ; else throw new org . xml . sax . SAXException ( XSLMessages . createMessage ( XSLTErrorResources . ER_CANT_RESOLVE_NSPREFIX , new Object [ ] { prefix } ) ) ; } return strings ; }
Process an attribute string of type T_URLLIST into a vector of prefixes that may be resolved to URLs .
27,333
private Boolean processYESNO ( StylesheetHandler handler , String uri , String name , String rawName , String value ) throws org . xml . sax . SAXException { if ( ! ( value . equals ( "yes" ) || value . equals ( "no" ) ) ) { handleError ( handler , XSLTErrorResources . INVALID_BOOLEAN , new Object [ ] { name , value } , null ) ; return null ; } return new Boolean ( value . equals ( "yes" ) ? true : false ) ; }
Process an attribute string of type T_YESNO into a Boolean value .
27,334
Object processValue ( StylesheetHandler handler , String uri , String name , String rawName , String value , ElemTemplateElement owner ) throws org . xml . sax . SAXException { int type = getType ( ) ; Object processedValue = null ; switch ( type ) { case T_AVT : processedValue = processAVT ( handler , uri , name , rawName , value , owner ) ; break ; case T_CDATA : processedValue = processCDATA ( handler , uri , name , rawName , value , owner ) ; break ; case T_CHAR : processedValue = processCHAR ( handler , uri , name , rawName , value , owner ) ; break ; case T_ENUM : processedValue = processENUM ( handler , uri , name , rawName , value , owner ) ; break ; case T_EXPR : processedValue = processEXPR ( handler , uri , name , rawName , value , owner ) ; break ; case T_NMTOKEN : processedValue = processNMTOKEN ( handler , uri , name , rawName , value , owner ) ; break ; case T_PATTERN : processedValue = processPATTERN ( handler , uri , name , rawName , value , owner ) ; break ; case T_NUMBER : processedValue = processNUMBER ( handler , uri , name , rawName , value , owner ) ; break ; case T_QNAME : processedValue = processQNAME ( handler , uri , name , rawName , value , owner ) ; break ; case T_QNAMES : processedValue = processQNAMES ( handler , uri , name , rawName , value ) ; break ; case T_QNAMES_RESOLVE_NULL : processedValue = processQNAMESRNU ( handler , uri , name , rawName , value ) ; break ; case T_SIMPLEPATTERNLIST : processedValue = processSIMPLEPATTERNLIST ( handler , uri , name , rawName , value , owner ) ; break ; case T_URL : processedValue = processURL ( handler , uri , name , rawName , value , owner ) ; break ; case T_YESNO : processedValue = processYESNO ( handler , uri , name , rawName , value ) ; break ; case T_STRINGLIST : processedValue = processSTRINGLIST ( handler , uri , name , rawName , value ) ; break ; case T_PREFIX_URLLIST : processedValue = processPREFIX_URLLIST ( handler , uri , name , rawName , value ) ; break ; case T_ENUM_OR_PQNAME : processedValue = processENUM_OR_PQNAME ( handler , uri , name , rawName , value , owner ) ; break ; case T_NCNAME : processedValue = processNCNAME ( handler , uri , name , rawName , value , owner ) ; break ; case T_AVT_QNAME : processedValue = processAVT_QNAME ( handler , uri , name , rawName , value , owner ) ; break ; case T_PREFIXLIST : processedValue = processPREFIX_LIST ( handler , uri , name , rawName , value ) ; break ; default : } return processedValue ; }
Process an attribute value .
27,335
void setDefAttrValue ( StylesheetHandler handler , ElemTemplateElement elem ) throws org . xml . sax . SAXException { setAttrValue ( handler , this . getNamespace ( ) , this . getName ( ) , this . getName ( ) , this . getDefault ( ) , elem ) ; }
Set the default value of an attribute .
27,336
private Class getPrimativeClass ( Object obj ) { if ( obj instanceof XPath ) return XPath . class ; Class cl = obj . getClass ( ) ; if ( cl == Double . class ) { cl = double . class ; } if ( cl == Float . class ) { cl = float . class ; } else if ( cl == Boolean . class ) { cl = boolean . class ; } else if ( cl == Byte . class ) { cl = byte . class ; } else if ( cl == Character . class ) { cl = char . class ; } else if ( cl == Short . class ) { cl = short . class ; } else if ( cl == Integer . class ) { cl = int . class ; } else if ( cl == Long . class ) { cl = long . class ; } return cl ; }
Get the primative type for the class if there is one . If the class is a Double for instance this will return double . class . If the class is not one of the 9 primative types it will return the same class that was passed in .
27,337
private StringBuffer getListOfEnums ( ) { StringBuffer enumNamesList = new StringBuffer ( ) ; String [ ] enumValues = this . getEnumNames ( ) ; for ( int i = 0 ; i < enumValues . length ; i ++ ) { if ( i > 0 ) { enumNamesList . append ( ' ' ) ; } enumNamesList . append ( enumValues [ i ] ) ; } return enumNamesList ; }
StringBuffer containing comma delimited list of valid values for ENUM type . Used to build error message .
27,338
boolean setAttrValue ( StylesheetHandler handler , String attrUri , String attrLocalName , String attrRawName , String attrValue , ElemTemplateElement elem ) throws org . xml . sax . SAXException { if ( attrRawName . equals ( "xmlns" ) || attrRawName . startsWith ( "xmlns:" ) ) return true ; String setterString = getSetterMethodName ( ) ; if ( null != setterString ) { try { Method meth ; Object [ ] args ; if ( setterString . equals ( S_FOREIGNATTR_SETTER ) ) { if ( attrUri == null ) attrUri = "" ; Class sclass = attrUri . getClass ( ) ; Class [ ] argTypes = new Class [ ] { sclass , sclass , sclass , sclass } ; meth = elem . getClass ( ) . getMethod ( setterString , argTypes ) ; args = new Object [ ] { attrUri , attrLocalName , attrRawName , attrValue } ; } else { Object value = processValue ( handler , attrUri , attrLocalName , attrRawName , attrValue , elem ) ; if ( null == value ) return false ; Class [ ] argTypes = new Class [ ] { getPrimativeClass ( value ) } ; try { meth = elem . getClass ( ) . getMethod ( setterString , argTypes ) ; } catch ( NoSuchMethodException nsme ) { Class cl = ( ( Object ) value ) . getClass ( ) ; argTypes [ 0 ] = cl ; meth = elem . getClass ( ) . getMethod ( setterString , argTypes ) ; } args = new Object [ ] { value } ; } meth . invoke ( elem , args ) ; } catch ( NoSuchMethodException nsme ) { if ( ! setterString . equals ( S_FOREIGNATTR_SETTER ) ) { handler . error ( XSLTErrorResources . ER_FAILED_CALLING_METHOD , new Object [ ] { setterString } , nsme ) ; return false ; } } catch ( IllegalAccessException iae ) { handler . error ( XSLTErrorResources . ER_FAILED_CALLING_METHOD , new Object [ ] { setterString } , iae ) ; return false ; } catch ( InvocationTargetException nsme ) { handleError ( handler , XSLTErrorResources . WG_ILLEGAL_ATTRIBUTE_VALUE , new Object [ ] { Constants . ATTRNAME_NAME , getName ( ) } , nsme ) ; return false ; } } return true ; }
Set a value on an attribute .
27,339
public Source getAssociatedStylesheet ( ) { int sz = m_stylesheets . size ( ) ; if ( sz > 0 ) { Source source = ( Source ) m_stylesheets . elementAt ( sz - 1 ) ; return source ; } else return null ; }
Return the last stylesheet found that match the constraints .
27,340
public void startElement ( String namespaceURI , String localName , String qName , Attributes atts ) throws org . xml . sax . SAXException { throw new StopParseException ( ) ; }
The spec notes that The xml - stylesheet processing instruction is allowed only in the prolog of an XML document . so at least for right now I m going to go ahead an throw a TransformerException in order to stop the parse .
27,341
public static boolean caseIgnoreMatch ( String s1 , String s2 ) { if ( s1 == s2 ) { return true ; } int len = s1 . length ( ) ; if ( len != s2 . length ( ) ) { return false ; } for ( int i = 0 ; i < len ; i ++ ) { char c1 = s1 . charAt ( i ) ; char c2 = s2 . charAt ( i ) ; if ( c1 != c2 && toLower ( c1 ) != toLower ( c2 ) ) { return false ; } } return true ; }
Compares two ASCII Strings s1 and s2 ignoring case .
27,342
public static String toLowerString ( String s ) { int len = s . length ( ) ; int idx = 0 ; for ( ; idx < len ; idx ++ ) { if ( isUpper ( s . charAt ( idx ) ) ) { break ; } } if ( idx == len ) { return s ; } char [ ] buf = new char [ len ] ; for ( int i = 0 ; i < len ; i ++ ) { char c = s . charAt ( i ) ; buf [ i ] = ( i < idx ) ? c : toLower ( c ) ; } return new String ( buf ) ; }
Converts the given ASCII String to lower - case .
27,343
public void loadPropertyFile ( String file , Properties target ) { try { SecuritySupport ss = SecuritySupport . getInstance ( ) ; InputStream is = ss . getResourceAsStream ( ObjectFactory . findClassLoader ( ) , file ) ; BufferedInputStream bis = new BufferedInputStream ( is ) ; target . load ( bis ) ; bis . close ( ) ; } catch ( Exception ex ) { throw new org . apache . xml . utils . WrappedRuntimeException ( ex ) ; } }
Retrieve a propery bundle from a specified file
27,344
public void setLeftRight ( Expression l , Expression r ) { m_left = l ; m_right = r ; l . exprSetParent ( this ) ; r . exprSetParent ( this ) ; }
Set the left and right operand expressions for this operation .
27,345
static int distance ( GeneralNameInterface base , GeneralNameInterface test , int incomparable ) { switch ( base . constrains ( test ) ) { case GeneralNameInterface . NAME_DIFF_TYPE : if ( debug != null ) { debug . println ( "Builder.distance(): Names are different types" ) ; } return incomparable ; case GeneralNameInterface . NAME_SAME_TYPE : if ( debug != null ) { debug . println ( "Builder.distance(): Names are same type but " + "in different subtrees" ) ; } return incomparable ; case GeneralNameInterface . NAME_MATCH : return 0 ; case GeneralNameInterface . NAME_WIDENS : break ; case GeneralNameInterface . NAME_NARROWS : break ; default : return incomparable ; } return test . subtreeDepth ( ) - base . subtreeDepth ( ) ; }
get distance of one GeneralName from another
27,346
static int targetDistance ( NameConstraintsExtension constraints , X509Certificate cert , GeneralNameInterface target ) throws IOException { if ( constraints != null && ! constraints . verify ( cert ) ) { throw new IOException ( "certificate does not satisfy existing name " + "constraints" ) ; } X509CertImpl certImpl ; try { certImpl = X509CertImpl . toImpl ( cert ) ; } catch ( CertificateException e ) { throw new IOException ( "Invalid certificate" , e ) ; } X500Name subject = X500Name . asX500Name ( certImpl . getSubjectX500Principal ( ) ) ; if ( subject . equals ( target ) ) { return 0 ; } SubjectAlternativeNameExtension altNameExt = certImpl . getSubjectAlternativeNameExtension ( ) ; if ( altNameExt != null ) { GeneralNames altNames = altNameExt . get ( SubjectAlternativeNameExtension . SUBJECT_NAME ) ; if ( altNames != null ) { for ( int j = 0 , n = altNames . size ( ) ; j < n ; j ++ ) { GeneralNameInterface altName = altNames . get ( j ) . getName ( ) ; if ( altName . equals ( target ) ) { return 0 ; } } } } NameConstraintsExtension ncExt = certImpl . getNameConstraintsExtension ( ) ; if ( ncExt == null ) { return - 1 ; } if ( constraints != null ) { constraints . merge ( ncExt ) ; } else { constraints = ( NameConstraintsExtension ) ncExt . clone ( ) ; } if ( debug != null ) { debug . println ( "Builder.targetDistance() merged constraints: " + String . valueOf ( constraints ) ) ; } GeneralSubtrees permitted = constraints . get ( NameConstraintsExtension . PERMITTED_SUBTREES ) ; GeneralSubtrees excluded = constraints . get ( NameConstraintsExtension . EXCLUDED_SUBTREES ) ; if ( permitted != null ) { permitted . reduce ( excluded ) ; } if ( debug != null ) { debug . println ( "Builder.targetDistance() reduced constraints: " + permitted ) ; } if ( ! constraints . verify ( target ) ) { throw new IOException ( "New certificate not allowed to sign " + "certificate for target" ) ; } if ( permitted == null ) { return - 1 ; } for ( int i = 0 , n = permitted . size ( ) ; i < n ; i ++ ) { GeneralNameInterface perName = permitted . get ( i ) . getName ( ) . getName ( ) ; int distance = distance ( perName , target , - 1 ) ; if ( distance >= 0 ) { return ( distance + 1 ) ; } } return - 1 ; }
Determine how close a given certificate gets you toward a given target .
27,347
boolean addMatchingCerts ( X509CertSelector selector , Collection < CertStore > certStores , Collection < X509Certificate > resultCerts , boolean checkAll ) { X509Certificate targetCert = selector . getCertificate ( ) ; if ( targetCert != null ) { if ( selector . match ( targetCert ) && ! X509CertImpl . isSelfSigned ( targetCert , buildParams . sigProvider ( ) ) ) { if ( debug != null ) { debug . println ( "Builder.addMatchingCerts: adding target cert" ) ; } return resultCerts . add ( targetCert ) ; } return false ; } boolean add = false ; for ( CertStore store : certStores ) { try { Collection < ? extends Certificate > certs = store . getCertificates ( selector ) ; for ( Certificate cert : certs ) { if ( ! X509CertImpl . isSelfSigned ( ( X509Certificate ) cert , buildParams . sigProvider ( ) ) ) { if ( resultCerts . add ( ( X509Certificate ) cert ) ) { add = true ; } } } if ( ! checkAll && add ) { return true ; } } catch ( CertStoreException cse ) { if ( debug != null ) { debug . println ( "Builder.addMatchingCerts, non-fatal " + "exception retrieving certs: " + cse ) ; cse . printStackTrace ( ) ; } } } return add ; }
Search the specified CertStores and add all certificates matching selector to resultCerts . Self - signed certs are not useful here and therefore ignored .
27,348
private void linkNodeLast ( LinkedHashMapEntry < K , V > p ) { LinkedHashMapEntry < K , V > last = tail ; tail = p ; if ( last == null ) head = p ; else { p . before = last ; last . after = p ; } }
link at the end of list
27,349
private void transferLinks ( LinkedHashMapEntry < K , V > src , LinkedHashMapEntry < K , V > dst ) { LinkedHashMapEntry < K , V > b = dst . before = src . before ; LinkedHashMapEntry < K , V > a = dst . after = src . after ; if ( b == null ) head = dst ; else b . after = dst ; if ( a == null ) tail = dst ; else a . before = dst ; }
apply src s links to dst
27,350
public static Locale [ ] getAvailableLocales ( ) { if ( shim == null ) { return ICUResourceBundle . getAvailableLocales ( ICUData . ICU_COLLATION_BASE_NAME , ICUResourceBundle . ICU_DATA_CLASS_LOADER ) ; } return shim . getAvailableLocales ( ) ; }
Returns the set of locales as Locale objects for which collators are installed . Note that Locale objects do not support RFC 3066 .
27,351
public int compare ( Object source , Object target ) { return doCompare ( ( CharSequence ) source , ( CharSequence ) target ) ; }
Compares the source Object to the target Object .
27,352
public String getName ( ) { String algName = nameTable . get ( algid ) ; if ( algName != null ) { return algName ; } if ( ( params != null ) && algid . equals ( specifiedWithECDSA_oid ) ) { try { AlgorithmId paramsId = AlgorithmId . parse ( new DerValue ( getEncodedParams ( ) ) ) ; String paramsName = paramsId . getName ( ) ; if ( paramsName . equals ( "SHA" ) ) { paramsName = "SHA1" ; } algName = paramsName + "withECDSA" ; } catch ( IOException e ) { } } synchronized ( oidTable ) { reinitializeMappingTableLocked ( ) ; algName = nameTable . get ( algid ) ; } return ( algName == null ) ? algid . toString ( ) : algName ; }
Returns a name for the algorithm which may be more intelligible to humans than the algorithm s OID but which won t necessarily be comprehensible on other systems . For example this might return a name such as MD5withRSA for a signature algorithm on some systems . It also returns names like OID . 1 . 2 . 3 . 4 when no particular name for the algorithm is known .
27,353
public static AlgorithmId get ( String algname ) throws NoSuchAlgorithmException { ObjectIdentifier oid ; try { oid = algOID ( algname ) ; } catch ( IOException ioe ) { throw new NoSuchAlgorithmException ( "Invalid ObjectIdentifier " + algname ) ; } if ( oid == null ) { throw new NoSuchAlgorithmException ( "unrecognized algorithm name: " + algname ) ; } return new AlgorithmId ( oid ) ; }
Returns one of the algorithm IDs most commonly associated with this algorithm name .
27,354
public static AlgorithmId get ( AlgorithmParameters algparams ) throws NoSuchAlgorithmException { ObjectIdentifier oid ; String algname = algparams . getAlgorithm ( ) ; try { oid = algOID ( algname ) ; } catch ( IOException ioe ) { throw new NoSuchAlgorithmException ( "Invalid ObjectIdentifier " + algname ) ; } if ( oid == null ) { throw new NoSuchAlgorithmException ( "unrecognized algorithm name: " + algname ) ; } return new AlgorithmId ( oid , algparams ) ; }
Returns one of the algorithm IDs most commonly associated with this algorithm parameters .
27,355
public static String makeSigAlg ( String digAlg , String encAlg ) { digAlg = digAlg . replace ( "-" , "" ) . toUpperCase ( Locale . ENGLISH ) ; if ( digAlg . equalsIgnoreCase ( "SHA" ) ) digAlg = "SHA1" ; encAlg = encAlg . toUpperCase ( Locale . ENGLISH ) ; if ( encAlg . equals ( "EC" ) ) encAlg = "ECDSA" ; return digAlg + "with" + encAlg ; }
Creates a signature algorithm name from a digest algorithm name and a encryption algorithm name .
27,356
public static String getEncAlgFromSigAlg ( String signatureAlgorithm ) { signatureAlgorithm = signatureAlgorithm . toUpperCase ( Locale . ENGLISH ) ; int with = signatureAlgorithm . indexOf ( "WITH" ) ; String keyAlgorithm = null ; if ( with > 0 ) { int and = signatureAlgorithm . indexOf ( "AND" , with + 4 ) ; if ( and > 0 ) { keyAlgorithm = signatureAlgorithm . substring ( with + 4 , and ) ; } else { keyAlgorithm = signatureAlgorithm . substring ( with + 4 ) ; } if ( keyAlgorithm . equalsIgnoreCase ( "ECDSA" ) ) { keyAlgorithm = "EC" ; } } return keyAlgorithm ; }
Extracts the encryption algorithm name from a signature algorithm name .
27,357
public static String getDigAlgFromSigAlg ( String signatureAlgorithm ) { signatureAlgorithm = signatureAlgorithm . toUpperCase ( Locale . ENGLISH ) ; int with = signatureAlgorithm . indexOf ( "WITH" ) ; if ( with > 0 ) { return signatureAlgorithm . substring ( 0 , with ) ; } return null ; }
Extracts the digest algorithm name from a signature algorithm name .
27,358
protected int _documentRoot ( int nodeIdentifier ) { if ( nodeIdentifier == NULL ) return NULL ; for ( int parent = _parent ( nodeIdentifier ) ; parent != NULL ; nodeIdentifier = parent , parent = _parent ( nodeIdentifier ) ) ; return nodeIdentifier ; }
Given a node identifier find the owning document node . Unlike the DOM this considers the owningDocument of a Document to be itself . Note that in shared DTMs this may not be zero .
27,359
public void startDocument ( ) throws SAXException { m_endDocumentOccured = false ; m_prefixMappings = new java . util . Vector ( ) ; m_contextIndexes = new IntStack ( ) ; m_parents = new IntStack ( ) ; m_currentDocumentNode = m_size ; super . startDocument ( ) ; }
Receive notification of the beginning of a new RTF document .
27,360
public TypeMirror unaryNumericPromotion ( TypeMirror type ) { TypeKind t = type . getKind ( ) ; if ( t == TypeKind . DECLARED ) { type = javacTypes . unboxedType ( type ) ; t = type . getKind ( ) ; } if ( t == TypeKind . BYTE || t == TypeKind . SHORT || t == TypeKind . CHAR ) { return getInt ( ) ; } else { return type ; } }
If type is a byte TypeMirror short TypeMirror or char TypeMirror an int TypeMirror is returned . Otherwise type is returned . See jls - 5 . 6 . 1 .
27,361
public TypeMirror binaryNumericPromotion ( TypeMirror type1 , TypeMirror type2 ) { TypeKind t1 = type1 . getKind ( ) ; TypeKind t2 = type2 . getKind ( ) ; if ( t1 == TypeKind . DECLARED ) { t1 = javacTypes . unboxedType ( type1 ) . getKind ( ) ; } if ( t2 == TypeKind . DECLARED ) { t2 = javacTypes . unboxedType ( type2 ) . getKind ( ) ; } if ( t1 == TypeKind . DOUBLE || t2 == TypeKind . DOUBLE ) { return getDouble ( ) ; } else if ( t1 == TypeKind . FLOAT || t2 == TypeKind . FLOAT ) { return getFloat ( ) ; } else if ( t1 == TypeKind . LONG || t2 == TypeKind . LONG ) { return getLong ( ) ; } else { return getInt ( ) ; } }
If either type is a double TypeMirror a double TypeMirror is returned . Otherwise if either type is a float TypeMirror a float TypeMirror is returned . Otherwise if either type is a long TypeMirror a long TypeMirror is returned . Otherwise an int TypeMirror is returned . See jls - 5 . 6 . 2 .
27,362
public TypeElement getObjcClass ( TypeMirror t ) { if ( isArray ( t ) ) { return getIosArray ( ( ( ArrayType ) t ) . getComponentType ( ) ) ; } else if ( isDeclaredType ( t ) ) { return getObjcClass ( ( TypeElement ) ( ( DeclaredType ) t ) . asElement ( ) ) ; } return null ; }
Maps the given type to it s Objective - C equivalent . Array types are mapped to their equivalent IOSArray type and common Java classes like String and Object are mapped to NSString and NSObject .
27,363
public DeclaredType findSupertype ( TypeMirror type , String qualifiedName ) { TypeElement element = asTypeElement ( type ) ; if ( element != null && element . getQualifiedName ( ) . toString ( ) . equals ( qualifiedName ) ) { return ( DeclaredType ) type ; } for ( TypeMirror t : directSupertypes ( type ) ) { DeclaredType result = findSupertype ( t , qualifiedName ) ; if ( result != null ) { return result ; } } return null ; }
Find a supertype matching the given qualified name .
27,364
public boolean visitTypeHierarchy ( TypeMirror type , TypeVisitor visitor ) { boolean result = true ; if ( type == null ) { return result ; } if ( type . getKind ( ) == TypeKind . DECLARED ) { result = visitor . accept ( ( DeclaredType ) type ) ; } for ( TypeMirror superType : directSupertypes ( type ) ) { if ( ! result ) { return false ; } result = visitTypeHierarchy ( superType , visitor ) ; } return result ; }
Visit all declared types in the hierarchy using a depth - first traversal visiting classes before interfaces .
27,365
public boolean visitTypeHierarchyObjcOrder ( TypeMirror type , TypeVisitor visitor ) { boolean result = true ; if ( type == null ) { return result ; } if ( type . getKind ( ) == TypeKind . DECLARED ) { result = visitor . accept ( ( DeclaredType ) type ) ; } TypeMirror classType = null ; for ( TypeMirror superType : directSupertypes ( type ) ) { if ( ! result ) { return false ; } if ( isClass ( superType ) ) { classType = superType ; } else { visitTypeHierarchyObjcOrder ( superType , visitor ) ; } } if ( classType != null && result ) { result = visitTypeHierarchyObjcOrder ( classType , visitor ) ; } return result ; }
Visit all declared types in the order that Objective - C compilation will visit when resolving the type signature of a method . Uses a depth - first traversal visiting interfaces before classes .
27,366
public static String getBinaryName ( TypeMirror t ) { switch ( t . getKind ( ) ) { case BOOLEAN : return "Z" ; case BYTE : return "B" ; case CHAR : return "C" ; case DOUBLE : return "D" ; case FLOAT : return "F" ; case INT : return "I" ; case LONG : return "J" ; case SHORT : return "S" ; case VOID : return "V" ; default : throw new AssertionError ( "Cannot resolve binary name for type: " + t ) ; } }
Returns the binary name for a primitive or void type .
27,367
public String getReferenceSignature ( ExecutableElement element ) { StringBuilder sb = new StringBuilder ( "(" ) ; if ( ElementUtil . isConstructor ( element ) ) { TypeElement declaringClass = ElementUtil . getDeclaringClass ( element ) ; if ( ElementUtil . hasOuterContext ( declaringClass ) ) { TypeElement outerClass = ElementUtil . getDeclaringClass ( declaringClass ) ; sb . append ( getSignatureName ( outerClass . asType ( ) ) ) ; } } for ( VariableElement param : element . getParameters ( ) ) { sb . append ( getSignatureName ( param . asType ( ) ) ) ; } sb . append ( ')' ) ; TypeMirror returnType = element . getReturnType ( ) ; if ( returnType != null ) { sb . append ( getSignatureName ( returnType ) ) ; } return sb . toString ( ) ; }
Get the Reference signature of a method .
27,368
public long getFilePointer ( ) throws IOException { try { return Libcore . os . lseek ( fd , 0L , SEEK_CUR ) ; } catch ( ErrnoException errnoException ) { throw errnoException . rethrowAsIOException ( ) ; } }
Gets the current position within this file . All reads and writes take place at the current file pointer position .
27,369
public long length ( ) throws IOException { try { return Libcore . os . fstat ( fd ) . st_size ; } catch ( ErrnoException errnoException ) { throw errnoException . rethrowAsIOException ( ) ; } }
Returns the length of this file in bytes .
27,370
public final int readInt ( ) throws IOException { readFully ( scratch , 0 , SizeOf . INT ) ; return Memory . peekInt ( scratch , 0 , ByteOrder . BIG_ENDIAN ) ; }
Reads a big - endian 32 - bit integer from the current position in this file . Blocks until four bytes have been read the end of the file is reached or an exception is thrown .
27,371
private void readObject ( ObjectInputStream ois ) throws IOException , ClassNotFoundException { ois . defaultReadObject ( ) ; myhash = - 1 ; timestamp = new Date ( timestamp . getTime ( ) ) ; }
Explicitly reset hash code value to - 1
27,372
public static void checkPackageAccess ( Class < ? > clazz ) { checkPackageAccess ( clazz . getName ( ) ) ; if ( isNonPublicProxyClass ( clazz ) ) { checkProxyPackageAccess ( clazz ) ; } }
Checks package access on the given class .
27,373
private static boolean isAncestor ( ClassLoader p , ClassLoader cl ) { ClassLoader acl = cl ; do { acl = acl . getParent ( ) ; if ( p == acl ) { return true ; } } while ( acl != null ) ; return false ; }
be found in the cl s delegation chain
27,374
public static boolean needsPackageAccessCheck ( ClassLoader from , ClassLoader to ) { if ( from == null || from == to ) return false ; if ( to == null ) return true ; return ! isAncestor ( from , to ) ; }
Returns true if package access check is needed for reflective access from a class loader from to classes or members in a class defined by class loader to . This method returns true if from is not the same as or an ancestor of to . All code in a system domain are granted with all permission and so this method returns false if from class loader is a class loader loading system classes . On the other hand if a class loader attempts to access system domain classes it requires package access check and this method will return true .
27,375
public static void checkProxyPackageAccess ( Class < ? > clazz ) { SecurityManager s = System . getSecurityManager ( ) ; if ( s != null ) { if ( Proxy . isProxyClass ( clazz ) ) { for ( Class < ? > intf : clazz . getInterfaces ( ) ) { checkPackageAccess ( intf ) ; } } } }
Check package access on the proxy interfaces that the given proxy class implements .
27,376
public static boolean isNonPublicProxyClass ( Class < ? > cls ) { String name = cls . getName ( ) ; int i = name . lastIndexOf ( '.' ) ; String pkg = ( i != - 1 ) ? name . substring ( 0 , i ) : "" ; return Proxy . isProxyClass ( cls ) && ! pkg . isEmpty ( ) ; }
Test if the given class is a proxy class that implements non - public interface . Such proxy class may be in a non - restricted package that bypasses checkPackageAccess .
27,377
public static Expression retainResult ( Expression node ) { switch ( node . getKind ( ) ) { case ARRAY_CREATION : ( ( ArrayCreation ) node ) . setHasRetainedResult ( true ) ; return TreeUtil . remove ( node ) ; case CLASS_INSTANCE_CREATION : ( ( ClassInstanceCreation ) node ) . setHasRetainedResult ( true ) ; return TreeUtil . remove ( node ) ; case FUNCTION_INVOCATION : { FunctionInvocation invocation = ( FunctionInvocation ) node ; if ( invocation . getFunctionElement ( ) . getRetainedResultName ( ) != null ) { invocation . setHasRetainedResult ( true ) ; return TreeUtil . remove ( node ) ; } return null ; } default : return null ; } }
If possible give this expression an unbalanced extra retain . If a non - null result is returned then the returned expression has an unbalanced extra retain and the passed in expression is removed from the tree and must be discarded . If null is returned then the passed in expression is left untouched . The caller must ensure the result is eventually consumed .
27,378
public static boolean hasSideEffect ( Expression expr ) { VariableElement var = TreeUtil . getVariableElement ( expr ) ; if ( var != null && ElementUtil . isVolatile ( var ) ) { return true ; } switch ( expr . getKind ( ) ) { case BOOLEAN_LITERAL : case CHARACTER_LITERAL : case NULL_LITERAL : case NUMBER_LITERAL : case QUALIFIED_NAME : case SIMPLE_NAME : case STRING_LITERAL : case SUPER_FIELD_ACCESS : case THIS_EXPRESSION : return false ; case CAST_EXPRESSION : return hasSideEffect ( ( ( CastExpression ) expr ) . getExpression ( ) ) ; case CONDITIONAL_EXPRESSION : { ConditionalExpression condExpr = ( ConditionalExpression ) expr ; return hasSideEffect ( condExpr . getExpression ( ) ) || hasSideEffect ( condExpr . getThenExpression ( ) ) || hasSideEffect ( condExpr . getElseExpression ( ) ) ; } case FIELD_ACCESS : return hasSideEffect ( ( ( FieldAccess ) expr ) . getExpression ( ) ) ; case INFIX_EXPRESSION : for ( Expression operand : ( ( InfixExpression ) expr ) . getOperands ( ) ) { if ( hasSideEffect ( operand ) ) { return true ; } } return false ; case PARENTHESIZED_EXPRESSION : return hasSideEffect ( ( ( ParenthesizedExpression ) expr ) . getExpression ( ) ) ; case PREFIX_EXPRESSION : { PrefixExpression preExpr = ( PrefixExpression ) expr ; PrefixExpression . Operator op = preExpr . getOperator ( ) ; return op == PrefixExpression . Operator . INCREMENT || op == PrefixExpression . Operator . DECREMENT || hasSideEffect ( preExpr . getOperand ( ) ) ; } default : return true ; } }
Reterns whether the expression might have any side effects . If true it would be unsafe to prune the given node from the tree .
27,379
public String getOperatorFunctionModifier ( Expression expr ) { VariableElement var = TreeUtil . getVariableElement ( expr ) ; if ( var == null ) { assert TreeUtil . trimParentheses ( expr ) instanceof ArrayAccess : "Expression cannot be resolved to a variable or array access." ; return "Array" ; } String modifier = "" ; if ( ElementUtil . isVolatile ( var ) ) { modifier += "Volatile" ; } if ( ! ElementUtil . isWeakReference ( var ) && ( var . getKind ( ) . isField ( ) || options . useARC ( ) ) ) { modifier += "Strong" ; } return modifier ; }
Returns the modifier for an assignment expression being converted to a function . The result will be Array if the lhs is an array access Strong if the lhs is a field with a strong reference and an empty string for local variables and weak fields .
27,380
public static Period at ( float count , TimeUnit unit ) { checkCount ( count ) ; return new Period ( ETimeLimit . NOLIMIT , false , count , unit ) ; }
Constructs a Period representing a duration of count units extending into the past .
27,381
public static Period moreThan ( float count , TimeUnit unit ) { checkCount ( count ) ; return new Period ( ETimeLimit . MT , false , count , unit ) ; }
Constructs a Period representing a duration more than count units extending into the past .
27,382
public static Period lessThan ( float count , TimeUnit unit ) { checkCount ( count ) ; return new Period ( ETimeLimit . LT , false , count , unit ) ; }
Constructs a Period representing a duration less than count units extending into the past .
27,383
public boolean isSet ( ) { for ( int i = 0 ; i < counts . length ; ++ i ) { if ( counts [ i ] != 0 ) { return true ; } } return false ; }
Returns true if any unit is set .
27,384
public float getCount ( TimeUnit unit ) { int ord = unit . ordinal ; if ( counts [ ord ] == 0 ) { return 0 ; } return ( counts [ ord ] - 1 ) / 1000f ; }
Returns the count for the specified unit . If the unit is not set returns 0 .
27,385
private Period setTimeUnitValue ( TimeUnit unit , float value ) { if ( value < 0 ) { throw new IllegalArgumentException ( "value: " + value ) ; } return setTimeUnitInternalValue ( unit , ( int ) ( value * 1000 ) + 1 ) ; }
Set the unit s internal value converting from float to int .
27,386
public final void init ( AlgorithmParameterSpec genParamSpec , SecureRandom random ) throws InvalidAlgorithmParameterException { paramGenSpi . engineInit ( genParamSpec , random ) ; }
Initializes this parameter generator with a set of algorithm - specific parameter generation values .
27,387
public boolean containsKey ( Object key ) { return key == null ? ( indexOfNull ( ) >= 0 ) : ( indexOf ( key , key . hashCode ( ) ) >= 0 ) ; }
Check whether a key exists in the array .
27,388
public V setValueAt ( int index , V value ) { index = ( index << 1 ) + 1 ; V old = ( V ) mArray [ index ] ; mArray [ index ] = value ; return old ; }
Set the value at a given index in the array .
27,389
public void append ( K key , V value ) { int index = mSize ; final int hash = key == null ? 0 : key . hashCode ( ) ; if ( index >= mHashes . length ) { throw new IllegalStateException ( "Array is full" ) ; } if ( index > 0 && mHashes [ index - 1 ] > hash ) { RuntimeException e = new RuntimeException ( "here" ) ; e . fillInStackTrace ( ) ; Log . w ( TAG , "New hash " + hash + " is before end of array hash " + mHashes [ index - 1 ] + " at index " + index + " key " + key , e ) ; put ( key , value ) ; return ; } mSize = index + 1 ; mHashes [ index ] = hash ; index <<= 1 ; mArray [ index ] = key ; mArray [ index + 1 ] = value ; }
Special fast path for appending items to the end of the array without validation . The array must already be large enough to contain the item .
27,390
void setPathToNamesInternal ( Set < GeneralNameInterface > names ) { pathToNames = Collections . < List < ? > > emptySet ( ) ; pathToGeneralNames = names ; }
called from CertPathHelper
27,391
public Principal getPeerPrincipal ( ) throws SSLPeerUnverifiedException { Principal principal ; try { principal = session . getPeerPrincipal ( ) ; } catch ( AbstractMethodError e ) { Certificate [ ] certs = getPeerCertificates ( ) ; principal = ( ( X509Certificate ) certs [ 0 ] ) . getSubjectX500Principal ( ) ; } return principal ; }
Returns the identity of the peer which was established as part of defining the session .
27,392
public Principal getLocalPrincipal ( ) { Principal principal ; try { principal = session . getLocalPrincipal ( ) ; } catch ( AbstractMethodError e ) { principal = null ; Certificate [ ] certs = getLocalCertificates ( ) ; if ( certs != null ) { principal = ( ( X509Certificate ) certs [ 0 ] ) . getSubjectX500Principal ( ) ; } } return principal ; }
Returns the principal that was sent to the peer during handshaking .
27,393
public void setOcspExtensions ( List < Extension > extensions ) { this . ocspExtensions = ( extensions == null ) ? Collections . < Extension > emptyList ( ) : new ArrayList < Extension > ( extensions ) ; }
Sets the optional OCSP request extensions .
27,394
public void setOcspResponses ( Map < X509Certificate , byte [ ] > responses ) { if ( responses == null ) { this . ocspResponses = Collections . < X509Certificate , byte [ ] > emptyMap ( ) ; } else { Map < X509Certificate , byte [ ] > copy = new HashMap < > ( responses . size ( ) ) ; for ( Map . Entry < X509Certificate , byte [ ] > e : responses . entrySet ( ) ) { copy . put ( e . getKey ( ) , e . getValue ( ) . clone ( ) ) ; } this . ocspResponses = copy ; } }
Sets the OCSP responses . These responses are used to determine the revocation status of the specified certificates when OCSP is used .
27,395
public Map < X509Certificate , byte [ ] > getOcspResponses ( ) { Map < X509Certificate , byte [ ] > copy = new HashMap < > ( ocspResponses . size ( ) ) ; for ( Map . Entry < X509Certificate , byte [ ] > e : ocspResponses . entrySet ( ) ) { copy . put ( e . getKey ( ) , e . getValue ( ) . clone ( ) ) ; } return copy ; }
Gets the OCSP responses . These responses are used to determine the revocation status of the specified certificates when OCSP is used .
27,396
public void setOptions ( Set < Option > options ) { this . options = ( options == null ) ? Collections . < Option > emptySet ( ) : new HashSet < Option > ( options ) ; }
Sets the revocation options .
27,397
public void runTo ( int index ) { if ( ! m_cacheNodes ) throw new RuntimeException ( XSLMessages . createXPATHMessage ( XPATHErrorResources . ER_NODESET_CANNOT_INDEX , null ) ) ; if ( ( index >= 0 ) && ( m_next < m_firstFree ) ) m_next = index ; else m_next = m_firstFree - 1 ; }
If an index is requested NodeSet will call this method to run the iterator to the index . By default this sets m_next to the index . If the index argument is - 1 this signals that the iterator should be run to the end .
27,398
public void addNode ( Node n ) { if ( ! m_mutable ) throw new RuntimeException ( XSLMessages . createXPATHMessage ( XPATHErrorResources . ER_NODESET_NOT_MUTABLE , null ) ) ; this . addElement ( n ) ; }
Add a node to the NodeSet . Not all types of NodeSets support this operation
27,399
private boolean addNodesInDocOrder ( int start , int end , int testIndex , NodeList nodelist , XPathContext support ) { if ( ! m_mutable ) throw new RuntimeException ( XSLMessages . createXPATHMessage ( XPATHErrorResources . ER_NODESET_NOT_MUTABLE , null ) ) ; boolean foundit = false ; int i ; Node node = nodelist . item ( testIndex ) ; for ( i = end ; i >= start ; i -- ) { Node child = ( Node ) elementAt ( i ) ; if ( child == node ) { i = - 2 ; break ; } if ( ! DOM2Helper . isNodeAfter ( node , child ) ) { insertElementAt ( node , i + 1 ) ; testIndex -- ; if ( testIndex > 0 ) { boolean foundPrev = addNodesInDocOrder ( 0 , i , testIndex , nodelist , support ) ; if ( ! foundPrev ) { addNodesInDocOrder ( i , size ( ) - 1 , testIndex , nodelist , support ) ; } } break ; } } if ( i == - 1 ) { insertElementAt ( node , 0 ) ; } return foundit ; }
Add the node list to this node set in document order .