idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
27,100 | private int insertNodeBetween ( int index , int nextIndex , long node ) { assert ( previousIndexFromNode ( node ) == 0 ) ; assert ( nextIndexFromNode ( node ) == 0 ) ; assert ( nextIndexFromNode ( nodes . elementAti ( index ) ) == nextIndex ) ; int newIndex = nodes . size ( ) ; node |= nodeFromPreviousIndex ( index ) | nodeFromNextIndex ( nextIndex ) ; nodes . addElement ( node ) ; node = nodes . elementAti ( index ) ; nodes . setElementAt ( changeNodeNextIndex ( node , newIndex ) , index ) ; if ( nextIndex != 0 ) { node = nodes . elementAti ( nextIndex ) ; nodes . setElementAt ( changeNodePreviousIndex ( node , newIndex ) , nextIndex ) ; } return newIndex ; } | Inserts a new node into the list between list - adjacent items . The node s previous and next indexes must not be set yet . |
27,101 | private static int countTailoredNodes ( long [ ] nodesArray , int i , int strength ) { int count = 0 ; for ( ; ; ) { if ( i == 0 ) { break ; } long node = nodesArray [ i ] ; if ( strengthFromNode ( node ) < strength ) { break ; } if ( strengthFromNode ( node ) == strength ) { if ( isTailoredNode ( node ) ) { ++ count ; } else { break ; } } i = nextIndexFromNode ( node ) ; } return count ; } | Counts the tailored nodes of the given strength up to the next node which is either stronger or has an explicit weight of this strength . |
27,102 | private void finalizeCEs ( ) { CollationDataBuilder newBuilder = new CollationDataBuilder ( ) ; newBuilder . initForTailoring ( baseData ) ; CEFinalizer finalizer = new CEFinalizer ( nodes . getBuffer ( ) ) ; newBuilder . copyFrom ( dataBuilder , finalizer ) ; dataBuilder = newBuilder ; } | Replaces temporary CEs with the final CEs they point to . |
27,103 | public void setStrategy ( int strategy ) { switch ( strategy ) { case DEFAULT_STRATEGY : case FILTERED : case HUFFMAN_ONLY : break ; default : throw new IllegalArgumentException ( ) ; } synchronized ( zsRef ) { if ( this . strategy != strategy ) { this . strategy = strategy ; setParams = true ; } } } | Sets the compression strategy to the specified value . |
27,104 | public void setLevel ( int level ) { if ( ( level < 0 || level > 9 ) && level != DEFAULT_COMPRESSION ) { throw new IllegalArgumentException ( "invalid compression level" ) ; } synchronized ( zsRef ) { if ( this . level != level ) { this . level = level ; setParams = true ; } } } | Sets the compression level to the specified value . |
27,105 | public int deflate ( byte [ ] b , int off , int len , int flush ) { if ( b == null ) { throw new NullPointerException ( ) ; } if ( off < 0 || len < 0 || off > b . length - len ) { throw new ArrayIndexOutOfBoundsException ( ) ; } synchronized ( zsRef ) { ensureOpen ( ) ; if ( flush == NO_FLUSH || flush == SYNC_FLUSH || flush == FULL_FLUSH ) { int thisLen = this . len ; int n = deflateBytes ( zsRef . address ( ) , b , off , len , flush ) ; bytesWritten += n ; bytesRead += ( thisLen - this . len ) ; return n ; } throw new IllegalArgumentException ( ) ; } } | Compresses the input data and fills the specified buffer with compressed data . Returns actual number of bytes of data compressed . |
27,106 | public void reset ( ) { synchronized ( zsRef ) { ensureOpen ( ) ; reset ( zsRef . address ( ) ) ; finish = false ; finished = false ; off = len = 0 ; bytesRead = bytesWritten = 0 ; } } | Resets deflater so that a new set of input data can be processed . Keeps current compression level and strategy settings . |
27,107 | public void encode ( DerOutputStream out ) throws IOException { DerOutputStream seq = new DerOutputStream ( ) ; name . encode ( seq ) ; if ( minimum != MIN_DEFAULT ) { DerOutputStream tmp = new DerOutputStream ( ) ; tmp . putInteger ( minimum ) ; seq . writeImplicit ( DerValue . createTag ( DerValue . TAG_CONTEXT , false , TAG_MIN ) , tmp ) ; } if ( maximum != - 1 ) { DerOutputStream tmp = new DerOutputStream ( ) ; tmp . putInteger ( maximum ) ; seq . writeImplicit ( DerValue . createTag ( DerValue . TAG_CONTEXT , false , TAG_MAX ) , tmp ) ; } out . write ( DerValue . tag_Sequence , seq ) ; } | Encode the GeneralSubtree . |
27,108 | public boolean getBoolean ( ) throws IOException { if ( tag != tag_Boolean ) { throw new IOException ( "DerValue.getBoolean, not a BOOLEAN " + tag ) ; } if ( length != 1 ) { throw new IOException ( "DerValue.getBoolean, invalid length " + length ) ; } if ( buffer . read ( ) != 0 ) { return true ; } return false ; } | Returns an ASN . 1 BOOLEAN |
27,109 | public byte [ ] getOctetString ( ) throws IOException { byte [ ] bytes ; if ( tag != tag_OctetString && ! isConstructed ( tag_OctetString ) ) { throw new IOException ( "DerValue.getOctetString, not an Octet String: " + tag ) ; } bytes = new byte [ length ] ; if ( length == 0 ) { return bytes ; } if ( buffer . read ( bytes ) != length ) throw new IOException ( "short read on DerValue buffer" ) ; if ( isConstructed ( ) ) { DerInputStream in = new DerInputStream ( bytes ) ; bytes = null ; while ( in . available ( ) != 0 ) { bytes = append ( bytes , in . getOctetString ( ) ) ; } } return bytes ; } | Returns an ASN . 1 OCTET STRING |
27,110 | public int getInteger ( ) throws IOException { if ( tag != tag_Integer ) { throw new IOException ( "DerValue.getInteger, not an int " + tag ) ; } return buffer . getInteger ( data . available ( ) ) ; } | Returns an ASN . 1 INTEGER value as an integer . |
27,111 | public BigInteger getBigInteger ( ) throws IOException { if ( tag != tag_Integer ) throw new IOException ( "DerValue.getBigInteger, not an int " + tag ) ; return buffer . getBigInteger ( data . available ( ) , false ) ; } | Returns an ASN . 1 INTEGER value as a BigInteger . |
27,112 | public int getEnumerated ( ) throws IOException { if ( tag != tag_Enumerated ) { throw new IOException ( "DerValue.getEnumerated, incorrect tag: " + tag ) ; } return buffer . getInteger ( data . available ( ) ) ; } | Returns an ASN . 1 ENUMERATED value . |
27,113 | public byte [ ] getBitString ( boolean tagImplicit ) throws IOException { if ( ! tagImplicit ) { if ( tag != tag_BitString ) throw new IOException ( "DerValue.getBitString, not a bit string " + tag ) ; } return buffer . getBitString ( ) ; } | Returns an ASN . 1 BIT STRING value with the tag assumed implicit based on the parameter . The bit string must be byte - aligned . |
27,114 | public BitArray getUnalignedBitString ( boolean tagImplicit ) throws IOException { if ( ! tagImplicit ) { if ( tag != tag_BitString ) throw new IOException ( "DerValue.getBitString, not a bit string " + tag ) ; } return buffer . getUnalignedBitString ( ) ; } | Returns an ASN . 1 BIT STRING value with the tag assumed implicit based on the parameter . The bit string need not be byte - aligned . |
27,115 | public byte [ ] getDataBytes ( ) throws IOException { byte [ ] retVal = new byte [ length ] ; synchronized ( data ) { data . reset ( ) ; data . getBytes ( retVal ) ; } return retVal ; } | Helper routine to return all the bytes contained in the DerInputStream associated with this object . |
27,116 | public Date getUTCTime ( ) throws IOException { if ( tag != tag_UtcTime ) { throw new IOException ( "DerValue.getUTCTime, not a UtcTime: " + tag ) ; } return buffer . getUTCTime ( data . available ( ) ) ; } | Returns a Date if the DerValue is UtcTime . |
27,117 | public Date getGeneralizedTime ( ) throws IOException { if ( tag != tag_GeneralizedTime ) { throw new IOException ( "DerValue.getGeneralizedTime, not a GeneralizedTime: " + tag ) ; } return buffer . getGeneralizedTime ( data . available ( ) ) ; } | Returns a Date if the DerValue is GeneralizedTime . |
27,118 | public byte [ ] toByteArray ( ) throws IOException { DerOutputStream out = new DerOutputStream ( ) ; encode ( out ) ; data . reset ( ) ; return out . toByteArray ( ) ; } | Returns a DER - encoded value such that if it s passed to the DerValue constructor a value equivalent to this is returned . |
27,119 | public DerInputStream toDerInputStream ( ) throws IOException { if ( tag == tag_Sequence || tag == tag_Set ) return new DerInputStream ( buffer ) ; throw new IOException ( "toDerInputStream rejects tag type " + tag ) ; } | For set and sequence types this function may be used to return a DER stream of the members of the set or sequence . This operation is not supported for primitive types such as integers or bit strings . |
27,120 | public static byte createTag ( byte tagClass , boolean form , byte val ) { byte tag = ( byte ) ( tagClass | val ) ; if ( form ) { tag |= ( byte ) 0x20 ; } return ( tag ) ; } | Create the tag of the attribute . |
27,121 | public void setCivil ( boolean beCivil ) { civil = beCivil ; if ( beCivil && cType != CalculationType . ISLAMIC_CIVIL ) { long m = getTimeInMillis ( ) ; cType = CalculationType . ISLAMIC_CIVIL ; clear ( ) ; setTimeInMillis ( m ) ; } else if ( ! beCivil && cType != CalculationType . ISLAMIC ) { long m = getTimeInMillis ( ) ; cType = CalculationType . ISLAMIC ; clear ( ) ; setTimeInMillis ( m ) ; } } | Determines whether this object uses the fixed - cycle Islamic civil calendar or an approximation of the religious astronomical calendar . |
27,122 | protected int handleGetYearLength ( int extendedYear ) { int length = 0 ; if ( cType == CalculationType . ISLAMIC_CIVIL || cType == CalculationType . ISLAMIC_TBLA || ( cType == CalculationType . ISLAMIC_UMALQURA && ( extendedYear < UMALQURA_YEAR_START || extendedYear > UMALQURA_YEAR_END ) ) ) { length = 354 + ( civilLeapYear ( extendedYear ) ? 1 : 0 ) ; } else if ( cType == CalculationType . ISLAMIC ) { int month = 12 * ( extendedYear - 1 ) ; length = ( int ) ( trueMonthStart ( month + 12 ) - trueMonthStart ( month ) ) ; } else if ( cType == CalculationType . ISLAMIC_UMALQURA ) { for ( int i = 0 ; i < 12 ; i ++ ) length += handleGetMonthLength ( extendedYear , i ) ; } return length ; } | Return the number of days in the given Islamic year |
27,123 | public void setCalculationType ( CalculationType type ) { cType = type ; if ( cType == CalculationType . ISLAMIC_CIVIL ) civil = true ; else civil = false ; } | sets the calculation type for this calendar . |
27,124 | private void a2 ( StringBuilder sb , int x ) { if ( x < 10 ) { sb . append ( '0' ) ; } sb . append ( x ) ; } | Append a two digit number . |
27,125 | private void appendISO8601 ( StringBuilder sb , long millis ) { GregorianCalendar cal = new GregorianCalendar ( ) ; cal . setTimeInMillis ( millis ) ; sb . append ( cal . get ( Calendar . YEAR ) ) ; sb . append ( '-' ) ; a2 ( sb , cal . get ( Calendar . MONTH ) + 1 ) ; sb . append ( '-' ) ; a2 ( sb , cal . get ( Calendar . DAY_OF_MONTH ) ) ; sb . append ( 'T' ) ; a2 ( sb , cal . get ( Calendar . HOUR_OF_DAY ) ) ; sb . append ( ':' ) ; a2 ( sb , cal . get ( Calendar . MINUTE ) ) ; sb . append ( ':' ) ; a2 ( sb , cal . get ( Calendar . SECOND ) ) ; } | Append the time and date in ISO 8601 format |
27,126 | public String getHead ( Handler h ) { StringBuilder sb = new StringBuilder ( ) ; String encoding ; sb . append ( "<?xml version=\"1.0\"" ) ; if ( h != null ) { encoding = h . getEncoding ( ) ; } else { encoding = null ; } if ( encoding == null ) { encoding = java . nio . charset . Charset . defaultCharset ( ) . name ( ) ; } try { Charset cs = Charset . forName ( encoding ) ; encoding = cs . name ( ) ; } catch ( Exception ex ) { } sb . append ( " encoding=\"" ) ; sb . append ( encoding ) ; sb . append ( "\"" ) ; sb . append ( " standalone=\"no\"?>\n" ) ; sb . append ( "<!DOCTYPE log SYSTEM \"logger.dtd\">\n" ) ; sb . append ( "<log>\n" ) ; return sb . toString ( ) ; } | Return the header string for a set of XML formatted records . |
27,127 | public void addListener ( EventListener l ) { if ( l == null ) { throw new NullPointerException ( ) ; } if ( acceptsListener ( l ) ) { synchronized ( notifyLock ) { if ( listeners == null ) { listeners = new ArrayList < EventListener > ( ) ; } else { for ( EventListener ll : listeners ) { if ( ll == l ) { return ; } } } listeners . add ( l ) ; } } else { throw new IllegalStateException ( "Listener invalid for this notifier." ) ; } } | Add a listener to be notified when notifyChanged is called . The listener must not be null . AcceptsListener must return true for the listener . Attempts to concurrently register the identical listener more than once will be silently ignored . |
27,128 | public void removeListener ( EventListener l ) { if ( l == null ) { throw new NullPointerException ( ) ; } synchronized ( notifyLock ) { if ( listeners != null ) { Iterator < EventListener > iter = listeners . iterator ( ) ; while ( iter . hasNext ( ) ) { if ( iter . next ( ) == l ) { iter . remove ( ) ; if ( listeners . size ( ) == 0 ) { listeners = null ; } return ; } } } } } | Stop notifying this listener . The listener must not be null . Attemps to remove a listener that is not registered will be silently ignored . |
27,129 | public void notifyChanged ( ) { if ( listeners != null ) { synchronized ( notifyLock ) { if ( listeners != null ) { if ( notifyThread == null ) { notifyThread = new NotifyThread ( this ) ; notifyThread . setDaemon ( true ) ; notifyThread . start ( ) ; } notifyThread . queue ( listeners . toArray ( new EventListener [ listeners . size ( ) ] ) ) ; } } } } | Queue a notification on the notification thread for the current listeners . When the thread unqueues the notification notifyListener is called on each listener from the notification thread . |
27,130 | private void writeObject ( java . io . ObjectOutputStream out ) throws java . io . IOException { out . writeUTF ( this . toString ( ) ) ; out . writeObject ( this . locale ) ; out . writeInt ( this . roundingMode ) ; } | Writes this object to a stream . |
27,131 | private void readObject ( java . io . ObjectInputStream in ) throws java . io . IOException { String description = in . readUTF ( ) ; ULocale loc ; try { loc = ( ULocale ) in . readObject ( ) ; } catch ( Exception e ) { loc = ULocale . getDefault ( Category . FORMAT ) ; } try { roundingMode = in . readInt ( ) ; } catch ( Exception ignored ) { } RuleBasedNumberFormat temp = new RuleBasedNumberFormat ( description , loc ) ; ruleSets = temp . ruleSets ; ruleSetsMap = temp . ruleSetsMap ; defaultRuleSet = temp . defaultRuleSet ; publicRuleSetNames = temp . publicRuleSetNames ; decimalFormatSymbols = temp . decimalFormatSymbols ; decimalFormat = temp . decimalFormat ; locale = temp . locale ; defaultInfinityRule = temp . defaultInfinityRule ; defaultNaNRule = temp . defaultNaNRule ; } | Reads this object in from a stream . |
27,132 | public ULocale [ ] getRuleSetDisplayNameLocales ( ) { if ( ruleSetDisplayNames != null ) { Set < String > s = ruleSetDisplayNames . keySet ( ) ; String [ ] locales = s . toArray ( new String [ s . size ( ) ] ) ; Arrays . sort ( locales , String . CASE_INSENSITIVE_ORDER ) ; ULocale [ ] result = new ULocale [ locales . length ] ; for ( int i = 0 ; i < locales . length ; ++ i ) { result [ i ] = new ULocale ( locales [ i ] ) ; } return result ; } return null ; } | Return a list of locales for which there are locale - specific display names for the rule sets in this formatter . If there are no localized display names return null . |
27,133 | public String getRuleSetDisplayName ( String ruleSetName , ULocale loc ) { String [ ] rsnames = publicRuleSetNames ; for ( int ix = 0 ; ix < rsnames . length ; ++ ix ) { if ( rsnames [ ix ] . equals ( ruleSetName ) ) { String [ ] names = getNameListForLocale ( loc ) ; if ( names != null ) { return names [ ix ] ; } return rsnames [ ix ] . substring ( 1 ) ; } } throw new IllegalArgumentException ( "unrecognized rule set name: " + ruleSetName ) ; } | Return the rule set display name for the provided rule set and locale . The locale is matched against the locales for which there is display name data using normal fallback rules . If no locale matches the default display name is returned . |
27,134 | public Number parse ( String text , ParsePosition parsePosition ) { String workingText = text . substring ( parsePosition . getIndex ( ) ) ; ParsePosition workingPos = new ParsePosition ( 0 ) ; Number tempResult = null ; Number result = NFRule . ZERO ; ParsePosition highWaterMark = new ParsePosition ( workingPos . getIndex ( ) ) ; for ( int i = ruleSets . length - 1 ; i >= 0 ; i -- ) { if ( ! ruleSets [ i ] . isPublic ( ) || ! ruleSets [ i ] . isParseable ( ) ) { continue ; } tempResult = ruleSets [ i ] . parse ( workingText , workingPos , Double . MAX_VALUE ) ; if ( workingPos . getIndex ( ) > highWaterMark . getIndex ( ) ) { result = tempResult ; highWaterMark . setIndex ( workingPos . getIndex ( ) ) ; } if ( highWaterMark . getIndex ( ) == workingText . length ( ) ) { break ; } workingPos . setIndex ( 0 ) ; } parsePosition . setIndex ( parsePosition . getIndex ( ) + highWaterMark . getIndex ( ) ) ; return result ; } | Parses the specified string beginning at the specified position according to this formatter s rules . This will match the string against all of the formatter s public rule sets and return the value corresponding to the longest parseable substring . This function s behavior is affected by the lenient parse mode . |
27,135 | public RbnfLenientScannerProvider getLenientScannerProvider ( ) { if ( scannerProvider == null && lenientParse && ! lookedForScanner ) { try { lookedForScanner = true ; Class < ? > cls = Class . forName ( "android.icu.impl.text.RbnfScannerProviderImpl" ) ; RbnfLenientScannerProvider provider = ( RbnfLenientScannerProvider ) cls . newInstance ( ) ; setLenientScannerProvider ( provider ) ; } catch ( Exception e ) { } } return scannerProvider ; } | Returns the lenient scanner provider . If none was set and lenient parse is enabled this will attempt to instantiate a default scanner setting it if it was successful . Otherwise this returns false . |
27,136 | public void setDefaultRuleSet ( String ruleSetName ) { if ( ruleSetName == null ) { if ( publicRuleSetNames . length > 0 ) { defaultRuleSet = findRuleSet ( publicRuleSetNames [ 0 ] ) ; } else { defaultRuleSet = null ; int n = ruleSets . length ; while ( -- n >= 0 ) { String currentName = ruleSets [ n ] . getName ( ) ; if ( currentName . equals ( "%spellout-numbering" ) || currentName . equals ( "%digits-ordinal" ) || currentName . equals ( "%duration" ) ) { defaultRuleSet = ruleSets [ n ] ; return ; } } n = ruleSets . length ; while ( -- n >= 0 ) { if ( ruleSets [ n ] . isPublic ( ) ) { defaultRuleSet = ruleSets [ n ] ; break ; } } } } else if ( ruleSetName . startsWith ( "%%" ) ) { throw new IllegalArgumentException ( "cannot use private rule set: " + ruleSetName ) ; } else { defaultRuleSet = findRuleSet ( ruleSetName ) ; } } | Override the default rule set to use . If ruleSetName is null reset to the initial default rule set . |
27,137 | public void setDecimalFormatSymbols ( DecimalFormatSymbols newSymbols ) { if ( newSymbols != null ) { decimalFormatSymbols = ( DecimalFormatSymbols ) newSymbols . clone ( ) ; if ( decimalFormat != null ) { decimalFormat . setDecimalFormatSymbols ( decimalFormatSymbols ) ; } if ( defaultInfinityRule != null ) { defaultInfinityRule = null ; getDefaultInfinityRule ( ) ; } if ( defaultNaNRule != null ) { defaultNaNRule = null ; getDefaultNaNRule ( ) ; } for ( NFRuleSet ruleSet : ruleSets ) { ruleSet . setDecimalFormatSymbols ( decimalFormatSymbols ) ; } } } | Sets the decimal format symbols used by this formatter . The formatter uses a copy of the provided symbols . |
27,138 | public void setContext ( DisplayContext context ) { super . setContext ( context ) ; if ( ! capitalizationInfoIsSet && ( context == DisplayContext . CAPITALIZATION_FOR_UI_LIST_OR_MENU || context == DisplayContext . CAPITALIZATION_FOR_STANDALONE ) ) { initCapitalizationContextInfo ( locale ) ; capitalizationInfoIsSet = true ; } if ( capitalizationBrkIter == null && ( context == DisplayContext . CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE || ( context == DisplayContext . CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForListOrMenu ) || ( context == DisplayContext . CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone ) ) ) { capitalizationBrkIter = BreakIterator . getSentenceInstance ( locale ) ; } } | lazily initialize relevant items |
27,139 | RbnfLenientScanner getLenientScanner ( ) { if ( lenientParse ) { RbnfLenientScannerProvider provider = getLenientScannerProvider ( ) ; if ( provider != null ) { return provider . get ( locale , lenientParseRules ) ; } } return null ; } | Returns the scanner to use for lenient parsing . The scanner is provided by the provider . |
27,140 | private void initLocalizations ( String [ ] [ ] localizations ) { if ( localizations != null ) { publicRuleSetNames = localizations [ 0 ] . clone ( ) ; Map < String , String [ ] > m = new HashMap < String , String [ ] > ( ) ; for ( int i = 1 ; i < localizations . length ; ++ i ) { String [ ] data = localizations [ i ] ; String loc = data [ 0 ] ; String [ ] names = new String [ data . length - 1 ] ; if ( names . length != publicRuleSetNames . length ) { throw new IllegalArgumentException ( "public name length: " + publicRuleSetNames . length + " != localized names[" + i + "] length: " + names . length ) ; } System . arraycopy ( data , 1 , names , 0 , names . length ) ; m . put ( loc , names ) ; } if ( ! m . isEmpty ( ) ) { ruleSetDisplayNames = m ; } } } | Take the localizations array and create a Map from the locale strings to the localization arrays . |
27,141 | private void initCapitalizationContextInfo ( ULocale theLocale ) { ICUResourceBundle rb = ( ICUResourceBundle ) UResourceBundle . getBundleInstance ( ICUData . ICU_BASE_NAME , theLocale ) ; try { ICUResourceBundle rdb = rb . getWithFallback ( "contextTransforms/number-spellout" ) ; int [ ] intVector = rdb . getIntVector ( ) ; if ( intVector . length >= 2 ) { capitalizationForListOrMenu = ( intVector [ 0 ] != 0 ) ; capitalizationForStandAlone = ( intVector [ 1 ] != 0 ) ; } } catch ( MissingResourceException e ) { } } | Set capitalizationForListOrMenu capitalizationForStandAlone |
27,142 | private void postProcess ( StringBuilder result , NFRuleSet ruleSet ) { if ( postProcessRules != null ) { if ( postProcessor == null ) { int ix = postProcessRules . indexOf ( ";" ) ; if ( ix == - 1 ) { ix = postProcessRules . length ( ) ; } String ppClassName = postProcessRules . substring ( 0 , ix ) . trim ( ) ; try { Class < ? > cls = Class . forName ( ppClassName ) ; postProcessor = ( RBNFPostProcessor ) cls . newInstance ( ) ; postProcessor . init ( this , postProcessRules ) ; } catch ( Exception e ) { if ( DEBUG ) System . out . println ( "could not locate " + ppClassName + ", error " + e . getClass ( ) . getName ( ) + ", " + e . getMessage ( ) ) ; postProcessor = null ; postProcessRules = null ; return ; } } postProcessor . process ( result , ruleSet ) ; } } | Post - process the rules if we have a post - processor . |
27,143 | private String adjustForContext ( String result ) { if ( result != null && result . length ( ) > 0 && UCharacter . isLowerCase ( result . codePointAt ( 0 ) ) ) { DisplayContext capitalization = getContext ( DisplayContext . Type . CAPITALIZATION ) ; if ( capitalization == DisplayContext . CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE || ( capitalization == DisplayContext . CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForListOrMenu ) || ( capitalization == DisplayContext . CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone ) ) { if ( capitalizationBrkIter == null ) { capitalizationBrkIter = BreakIterator . getSentenceInstance ( locale ) ; } return UCharacter . toTitleCase ( locale , result , capitalizationBrkIter , UCharacter . TITLECASE_NO_LOWERCASE | UCharacter . TITLECASE_NO_BREAK_ADJUSTMENT ) ; } } return result ; } | Adjust capitalization of formatted result for display context |
27,144 | NFRuleSet findRuleSet ( String name ) throws IllegalArgumentException { NFRuleSet result = ruleSetsMap . get ( name ) ; if ( result == null ) { throw new IllegalArgumentException ( "No rule set named " + name ) ; } return result ; } | Returns the named rule set . Throws an IllegalArgumentException if this formatter doesn t have a rule set with that name . |
27,145 | private E dequeue ( ) { Node < E > h = head ; Node < E > first = h . next ; h . next = sentinel ( ) ; head = first ; E x = first . item ; first . item = null ; return x ; } | Removes a node from head of queue . |
27,146 | public void put ( E e ) throws InterruptedException { if ( e == null ) throw new NullPointerException ( ) ; int c = - 1 ; Node < E > node = new Node < E > ( e ) ; final ReentrantLock putLock = this . putLock ; final AtomicInteger count = this . count ; putLock . lockInterruptibly ( ) ; try { while ( count . get ( ) == capacity ) { notFull . await ( ) ; } enqueue ( node ) ; c = count . getAndIncrement ( ) ; if ( c + 1 < capacity ) notFull . signal ( ) ; } finally { putLock . unlock ( ) ; } if ( c == 0 ) signalNotEmpty ( ) ; } | Inserts the specified element at the tail of this queue waiting if necessary for space to become available . |
27,147 | public boolean offer ( E e , long timeout , TimeUnit unit ) throws InterruptedException { if ( e == null ) throw new NullPointerException ( ) ; long nanos = unit . toNanos ( timeout ) ; int c = - 1 ; final ReentrantLock putLock = this . putLock ; final AtomicInteger count = this . count ; putLock . lockInterruptibly ( ) ; try { while ( count . get ( ) == capacity ) { if ( nanos <= 0L ) return false ; nanos = notFull . awaitNanos ( nanos ) ; } enqueue ( new Node < E > ( e ) ) ; c = count . getAndIncrement ( ) ; if ( c + 1 < capacity ) notFull . signal ( ) ; } finally { putLock . unlock ( ) ; } if ( c == 0 ) signalNotEmpty ( ) ; return true ; } | Inserts the specified element at the tail of this queue waiting if necessary up to the specified wait time for space to become available . |
27,148 | void unlink ( Node < E > p , Node < E > trail ) { p . item = null ; trail . next = p . next ; if ( last == p ) last = trail ; if ( count . getAndDecrement ( ) == capacity ) notFull . signal ( ) ; } | Unlinks interior Node p with predecessor trail . |
27,149 | public Console format ( String format , Object ... args ) { try ( Formatter f = new Formatter ( writer ) ) { f . format ( format , args ) ; f . flush ( ) ; return this ; } } | Writes a formatted string to the console using the specified format string and arguments . |
27,150 | public final void update ( byte input ) throws IllegalStateException { chooseFirstProvider ( ) ; if ( initialized == false ) { throw new IllegalStateException ( "MAC not initialized" ) ; } spi . engineUpdate ( input ) ; } | Processes the given byte . |
27,151 | public final byte [ ] doFinal ( byte [ ] input ) throws IllegalStateException { chooseFirstProvider ( ) ; if ( initialized == false ) { throw new IllegalStateException ( "MAC not initialized" ) ; } update ( input ) ; return doFinal ( ) ; } | Processes the given array of bytes and finishes the MAC operation . |
27,152 | private void readObject ( java . io . ObjectInputStream s ) throws java . io . IOException , ClassNotFoundException { s . defaultReadObject ( ) ; if ( encryptedContent != null ) encryptedContent = encryptedContent . clone ( ) ; if ( encodedParams != null ) encodedParams = encodedParams . clone ( ) ; } | Restores the state of the SealedObject from a stream . |
27,153 | public static synchronized ServerSocketFactory getDefault ( ) { if ( defaultServerSocketFactory != null && lastVersion == Security . getVersion ( ) ) { return defaultServerSocketFactory ; } lastVersion = Security . getVersion ( ) ; SSLServerSocketFactory previousDefaultServerSocketFactory = defaultServerSocketFactory ; defaultServerSocketFactory = null ; String clsName = SSLSocketFactory . getSecurityProperty ( "ssl.ServerSocketFactory.provider" ) ; if ( clsName != null ) { if ( previousDefaultServerSocketFactory != null && clsName . equals ( previousDefaultServerSocketFactory . getClass ( ) . getName ( ) ) ) { defaultServerSocketFactory = previousDefaultServerSocketFactory ; return defaultServerSocketFactory ; } Class cls = null ; log ( "setting up default SSLServerSocketFactory" ) ; try { log ( "setting up default SSLServerSocketFactory" ) ; try { cls = Class . forName ( clsName ) ; } catch ( ClassNotFoundException e ) { ClassLoader cl = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( cl == null ) { cl = ClassLoader . getSystemClassLoader ( ) ; } if ( cl != null ) { cls = Class . forName ( clsName , true , cl ) ; } } log ( "class " + clsName + " is loaded" ) ; SSLServerSocketFactory fac = ( SSLServerSocketFactory ) cls . newInstance ( ) ; log ( "instantiated an instance of class " + clsName ) ; defaultServerSocketFactory = fac ; if ( defaultServerSocketFactory != null ) { return defaultServerSocketFactory ; } } catch ( Exception e ) { log ( "SSLServerSocketFactory instantiation failed: " + e ) ; } } try { SSLContext context = SSLContext . getDefault ( ) ; if ( context != null ) { defaultServerSocketFactory = context . getServerSocketFactory ( ) ; } } catch ( NoSuchAlgorithmException e ) { } if ( defaultServerSocketFactory == null ) { defaultServerSocketFactory = new DefaultSSLServerSocketFactory ( new IllegalStateException ( "No ServerSocketFactory implementation found" ) ) ; } return defaultServerSocketFactory ; } | Returns the default SSL server socket factory . |
27,154 | public String getURI ( int index ) { String ns = m_dh . getNamespaceOfNode ( ( ( Attr ) m_attrs . item ( index ) ) ) ; if ( null == ns ) ns = "" ; return ns ; } | Look up an attribute s Namespace URI by index . |
27,155 | public String getValue ( String name ) { Attr attr = ( ( Attr ) m_attrs . getNamedItem ( name ) ) ; return ( null != attr ) ? attr . getValue ( ) : null ; } | Look up an attribute s value by name . |
27,156 | public String getValue ( String uri , String localName ) { Node a = m_attrs . getNamedItemNS ( uri , localName ) ; return ( a == null ) ? null : a . getNodeValue ( ) ; } | Look up an attribute s value by Namespace name . |
27,157 | public int getIndex ( String uri , String localPart ) { for ( int i = m_attrs . getLength ( ) - 1 ; i >= 0 ; -- i ) { Node a = m_attrs . item ( i ) ; String u = a . getNamespaceURI ( ) ; if ( ( u == null ? uri == null : u . equals ( uri ) ) && a . getLocalName ( ) . equals ( localPart ) ) return i ; } return - 1 ; } | Look up the index of an attribute by Namespace name . |
27,158 | public int getIndex ( String qName ) { for ( int i = m_attrs . getLength ( ) - 1 ; i >= 0 ; -- i ) { Node a = m_attrs . item ( i ) ; if ( a . getNodeName ( ) . equals ( qName ) ) return i ; } return - 1 ; } | Look up the index of an attribute by raw XML 1 . 0 name . |
27,159 | protected void connect ( String host , int port ) throws UnknownHostException , IOException { boolean connected = false ; try { InetAddress address = InetAddress . getByName ( host ) ; this . port = port ; this . address = address ; connectToAddress ( address , port , timeout ) ; connected = true ; } finally { if ( ! connected ) { try { close ( ) ; } catch ( IOException ioe ) { } } } } | Creates a socket and connects it to the specified port on the specified host . |
27,160 | protected synchronized void bind ( InetAddress address , int lport ) throws IOException { synchronized ( fdLock ) { if ( ! closePending && ( socket == null || ! socket . isBound ( ) ) ) { NetHooks . beforeTcpBind ( fd , address , lport ) ; } } socketBind ( address , lport ) ; if ( socket != null ) socket . setBound ( ) ; if ( serverSocket != null ) serverSocket . setBound ( ) ; } | Binds the socket to the specified address of the specified local port . |
27,161 | protected synchronized InputStream getInputStream ( ) throws IOException { if ( isClosedOrPending ( ) ) { throw new IOException ( "Socket Closed" ) ; } if ( shut_rd ) { throw new IOException ( "Socket input is shutdown" ) ; } if ( socketInputStream == null ) { socketInputStream = new SocketInputStream ( this ) ; } return socketInputStream ; } | Gets an InputStream for this socket . |
27,162 | protected void shutdownInput ( ) throws IOException { if ( fd != null && fd . valid ( ) ) { socketShutdown ( SHUT_RD ) ; if ( socketInputStream != null ) { socketInputStream . setEOF ( true ) ; } shut_rd = true ; } } | Shutdown read - half of the socket connection ; |
27,163 | protected void shutdownOutput ( ) throws IOException { if ( fd != null && fd . valid ( ) ) { socketShutdown ( SHUT_WR ) ; shut_wr = true ; } } | Shutdown write - half of the socket connection ; |
27,164 | public Enumeration < ? > propertyNames ( ) { Hashtable < String , Object > h = new Hashtable < > ( ) ; enumerate ( h ) ; return h . keys ( ) ; } | Returns an enumeration of all the keys in this property list including distinct keys in the default property list if a key of the same name has not already been found from the main properties list . |
27,165 | void setAttr ( String name , int flags ) { if ( null == m_attrs ) m_attrs = new StringToIntTable ( ) ; m_attrs . put ( name , flags ) ; } | Set an attribute name and it s bit properties . |
27,166 | public boolean isAttrFlagSet ( String name , int flags ) { return ( null != m_attrs ) ? ( ( m_attrs . getIgnoreCase ( name ) & flags ) != 0 ) : false ; } | Tell if any of the bits of interest are set for a named attribute type . |
27,167 | private ArrayListImpl < ChildLink < T > > modifiableDelegate ( ) { if ( delegate . getCount ( ) != 0 ) { delegate = new ArrayListImpl < > ( delegate ) ; } return delegate ; } | Returns an ArrayListImpl that is safe to modify . If delegate . count does not equal to zero returns a copy of delegate . |
27,168 | @ SuppressWarnings ( "unchecked" ) protected final void ensureCapacity ( long targetSize ) { long capacity = capacity ( ) ; if ( targetSize > capacity ) { inflateSpine ( ) ; for ( int i = spineIndex + 1 ; targetSize > capacity ; i ++ ) { if ( i >= spine . length ) { int newSpineSize = spine . length * 2 ; spine = Arrays . copyOf ( spine , newSpineSize ) ; priorElementCount = Arrays . copyOf ( priorElementCount , newSpineSize ) ; } int nextChunkSize = chunkSize ( i ) ; spine [ i ] = ( E [ ] ) new Object [ nextChunkSize ] ; priorElementCount [ i ] = priorElementCount [ i - 1 ] + spine [ i - 1 ] . length ; capacity += nextChunkSize ; } } } | Ensure that the buffer has at least capacity to hold the target size |
27,169 | public E get ( long index ) { if ( spineIndex == 0 ) { if ( index < elementIndex ) return curChunk [ ( ( int ) index ) ] ; else throw new IndexOutOfBoundsException ( Long . toString ( index ) ) ; } if ( index >= count ( ) ) throw new IndexOutOfBoundsException ( Long . toString ( index ) ) ; for ( int j = 0 ; j <= spineIndex ; j ++ ) if ( index < priorElementCount [ j ] + spine [ j ] . length ) return spine [ j ] [ ( ( int ) ( index - priorElementCount [ j ] ) ) ] ; throw new IndexOutOfBoundsException ( Long . toString ( index ) ) ; } | Retrieve the element at the specified index . |
27,170 | public void copyInto ( E [ ] array , int offset ) { long finalOffset = offset + count ( ) ; if ( finalOffset > array . length || finalOffset < offset ) { throw new IndexOutOfBoundsException ( "does not fit" ) ; } if ( spineIndex == 0 ) System . arraycopy ( curChunk , 0 , array , offset , elementIndex ) ; else { for ( int i = 0 ; i < spineIndex ; i ++ ) { System . arraycopy ( spine [ i ] , 0 , array , offset , spine [ i ] . length ) ; offset += spine [ i ] . length ; } if ( elementIndex > 0 ) System . arraycopy ( curChunk , 0 , array , offset , elementIndex ) ; } } | Copy the elements starting at the specified offset into the specified array . |
27,171 | public E [ ] asArray ( IntFunction < E [ ] > arrayFactory ) { long size = count ( ) ; if ( size >= Nodes . MAX_ARRAY_SIZE ) throw new IllegalArgumentException ( Nodes . BAD_SIZE ) ; E [ ] result = arrayFactory . apply ( ( int ) size ) ; copyInto ( result , 0 ) ; return result ; } | Create a new array using the specified array factory and copy the elements into it . |
27,172 | public static FileLockTable newSharedFileLockTable ( Channel channel , FileDescriptor fd ) throws IOException { return new SharedFileLockTable ( channel , fd ) ; } | Creates and returns a file lock table for a channel that is connected to the a system - wide map of all file locks for the Java virtual machine . |
27,173 | private void checkList ( List < FileLockReference > list , long position , long size ) throws OverlappingFileLockException { assert Thread . holdsLock ( list ) ; for ( FileLockReference ref : list ) { FileLock fl = ref . get ( ) ; if ( fl != null && fl . overlaps ( position , size ) ) throw new OverlappingFileLockException ( ) ; } } | Check for overlapping file locks |
27,174 | private void removeStaleEntries ( ) { FileLockReference ref ; while ( ( ref = ( FileLockReference ) queue . poll ( ) ) != null ) { FileKey fk = ref . fileKey ( ) ; List < FileLockReference > list = lockMap . get ( fk ) ; if ( list != null ) { synchronized ( list ) { list . remove ( ref ) ; removeKeyIfEmpty ( fk , list ) ; } } } } | Process the reference queue |
27,175 | public static boolean parseCompoundID ( String id , int dir , StringBuffer canonID , List < SingleID > list , UnicodeSet [ ] globalFilter ) { int [ ] pos = new int [ ] { 0 } ; int [ ] withParens = new int [ 1 ] ; list . clear ( ) ; UnicodeSet filter ; globalFilter [ 0 ] = null ; canonID . setLength ( 0 ) ; withParens [ 0 ] = 0 ; filter = parseGlobalFilter ( id , pos , dir , withParens , canonID ) ; if ( filter != null ) { if ( ! Utility . parseChar ( id , pos , ID_DELIM ) ) { canonID . setLength ( 0 ) ; pos [ 0 ] = 0 ; } if ( dir == FORWARD ) { globalFilter [ 0 ] = filter ; } } boolean sawDelimiter = true ; for ( ; ; ) { SingleID single = parseSingleID ( id , pos , dir ) ; if ( single == null ) { break ; } if ( dir == FORWARD ) { list . add ( single ) ; } else { list . add ( 0 , single ) ; } if ( ! Utility . parseChar ( id , pos , ID_DELIM ) ) { sawDelimiter = false ; break ; } } if ( list . size ( ) == 0 ) { return false ; } for ( int i = 0 ; i < list . size ( ) ; ++ i ) { SingleID single = list . get ( i ) ; canonID . append ( single . canonID ) ; if ( i != ( list . size ( ) - 1 ) ) { canonID . append ( ID_DELIM ) ; } } if ( sawDelimiter ) { withParens [ 0 ] = 1 ; filter = parseGlobalFilter ( id , pos , dir , withParens , canonID ) ; if ( filter != null ) { Utility . parseChar ( id , pos , ID_DELIM ) ; if ( dir == REVERSE ) { globalFilter [ 0 ] = filter ; } } } pos [ 0 ] = PatternProps . skipWhiteSpace ( id , pos [ 0 ] ) ; if ( pos [ 0 ] != id . length ( ) ) { return false ; } return true ; } | Parse a compound ID consisting of an optional forward global filter a separator one or more single IDs delimited by separators an an optional reverse global filter . The separator is a semicolon . The global filters are UnicodeSet patterns . The reverse global filter must be enclosed in parentheses . |
27,176 | static List < Transliterator > instantiateList ( List < SingleID > ids ) { Transliterator t ; List < Transliterator > translits = new ArrayList < Transliterator > ( ) ; for ( SingleID single : ids ) { if ( single . basicID . length ( ) == 0 ) { continue ; } t = single . getInstance ( ) ; if ( t == null ) { throw new IllegalArgumentException ( "Illegal ID " + single . canonID ) ; } translits . add ( t ) ; } if ( translits . size ( ) == 0 ) { t = Transliterator . getBasicInstance ( "Any-Null" , null ) ; if ( t == null ) { throw new IllegalArgumentException ( "Internal error; cannot instantiate Any-Null" ) ; } translits . add ( t ) ; } return translits ; } | Returns the list of Transliterator objects for the given list of SingleID objects . |
27,177 | private static SingleID specsToID ( Specs specs , int dir ) { String canonID = "" ; String basicID = "" ; String basicPrefix = "" ; if ( specs != null ) { StringBuilder buf = new StringBuilder ( ) ; if ( dir == FORWARD ) { if ( specs . sawSource ) { buf . append ( specs . source ) . append ( TARGET_SEP ) ; } else { basicPrefix = specs . source + TARGET_SEP ; } buf . append ( specs . target ) ; } else { buf . append ( specs . target ) . append ( TARGET_SEP ) . append ( specs . source ) ; } if ( specs . variant != null ) { buf . append ( VARIANT_SEP ) . append ( specs . variant ) ; } basicID = basicPrefix + buf . toString ( ) ; if ( specs . filter != null ) { buf . insert ( 0 , specs . filter ) ; } canonID = buf . toString ( ) ; } return new SingleID ( canonID , basicID ) ; } | Givens a Spec object convert it to a SingleID object . The Spec object is a more unprocessed parse result . The SingleID object contains information about canonical and basic IDs . |
27,178 | private static SingleID specsToSpecialInverse ( Specs specs ) { if ( ! specs . source . equalsIgnoreCase ( ANY ) ) { return null ; } String inverseTarget = SPECIAL_INVERSES . get ( new CaseInsensitiveString ( specs . target ) ) ; if ( inverseTarget != null ) { StringBuilder buf = new StringBuilder ( ) ; if ( specs . filter != null ) { buf . append ( specs . filter ) ; } if ( specs . sawSource ) { buf . append ( ANY ) . append ( TARGET_SEP ) ; } buf . append ( inverseTarget ) ; String basicID = ANY + TARGET_SEP + inverseTarget ; if ( specs . variant != null ) { buf . append ( VARIANT_SEP ) . append ( specs . variant ) ; basicID = basicID + VARIANT_SEP + specs . variant ; } return new SingleID ( buf . toString ( ) , basicID ) ; } return null ; } | Given a Specs object return a SingleID representing the special inverse of that ID . If there is no special inverse then return null . |
27,179 | public final Key translateKey ( Key key ) throws InvalidKeyException { if ( serviceIterator == null ) { return spi . engineTranslateKey ( key ) ; } Exception failure = null ; KeyFactorySpi mySpi = spi ; do { try { return mySpi . engineTranslateKey ( key ) ; } catch ( Exception e ) { if ( failure == null ) { failure = e ; } mySpi = nextSpi ( mySpi ) ; } } while ( mySpi != null ) ; if ( failure instanceof RuntimeException ) { throw ( RuntimeException ) failure ; } if ( failure instanceof InvalidKeyException ) { throw ( InvalidKeyException ) failure ; } throw new InvalidKeyException ( "Could not translate key" , failure ) ; } | Translates a key object whose provider may be unknown or potentially untrusted into a corresponding key object of this key factory . |
27,180 | private static String convertToStandardName ( String internalName ) { if ( internalName . equals ( "SHA" ) ) { return "SHA-1" ; } else if ( internalName . equals ( "SHA224" ) ) { return "SHA-224" ; } else if ( internalName . equals ( "SHA256" ) ) { return "SHA-256" ; } else if ( internalName . equals ( "SHA384" ) ) { return "SHA-384" ; } else if ( internalName . equals ( "SHA512" ) ) { return "SHA-512" ; } else { return internalName ; } } | Copied from com . sun . crypto . provider . OAEPParameters . |
27,181 | public List < AVA > avas ( ) { List < AVA > list = avaList ; if ( list == null ) { list = Collections . unmodifiableList ( Arrays . asList ( assertion ) ) ; avaList = list ; } return list ; } | Return an immutable List of the AVAs in this RDN . |
27,182 | public int compare ( AVA a1 , AVA a2 ) { boolean a1Has2253 = a1 . hasRFC2253Keyword ( ) ; boolean a2Has2253 = a2 . hasRFC2253Keyword ( ) ; if ( a1Has2253 ) { if ( a2Has2253 ) { return a1 . toRFC2253CanonicalString ( ) . compareTo ( a2 . toRFC2253CanonicalString ( ) ) ; } else { return - 1 ; } } else { if ( a2Has2253 ) { return 1 ; } else { int [ ] a1Oid = a1 . getObjectIdentifier ( ) . toIntArray ( ) ; int [ ] a2Oid = a2 . getObjectIdentifier ( ) . toIntArray ( ) ; int pos = 0 ; int len = ( a1Oid . length > a2Oid . length ) ? a2Oid . length : a1Oid . length ; while ( pos < len && a1Oid [ pos ] == a2Oid [ pos ] ) { ++ pos ; } return ( pos == len ) ? a1Oid . length - a2Oid . length : a1Oid [ pos ] - a2Oid [ pos ] ; } } } | AVA s containing a standard keyword are ordered alphabetically followed by AVA s containing an OID keyword ordered numerically |
27,183 | public static Region getInstance ( String id ) { if ( id == null ) { throw new NullPointerException ( ) ; } loadRegionData ( ) ; Region r = regionIDMap . get ( id ) ; if ( r == null ) { r = regionAliases . get ( id ) ; } if ( r == null ) { throw new IllegalArgumentException ( "Unknown region id: " + id ) ; } if ( r . type == RegionType . DEPRECATED && r . preferredValues . size ( ) == 1 ) { r = r . preferredValues . get ( 0 ) ; } return r ; } | Returns a Region using the given region ID . The region ID can be either a 2 - letter ISO code 3 - letter ISO code UNM . 49 numeric code or other valid Unicode Region Code as defined by the CLDR . |
27,184 | public static Region getInstance ( int code ) { loadRegionData ( ) ; Region r = numericCodeMap . get ( code ) ; if ( r == null ) { String pad = "" ; if ( code < 10 ) { pad = "00" ; } else if ( code < 100 ) { pad = "0" ; } String id = pad + Integer . toString ( code ) ; r = regionAliases . get ( id ) ; } if ( r == null ) { throw new IllegalArgumentException ( "Unknown region code: " + code ) ; } if ( r . type == RegionType . DEPRECATED && r . preferredValues . size ( ) == 1 ) { r = r . preferredValues . get ( 0 ) ; } return r ; } | Returns a Region using the given numeric code as defined by UNM . 49 |
27,185 | public static Set < Region > getAvailable ( RegionType type ) { loadRegionData ( ) ; return Collections . unmodifiableSet ( availableRegions . get ( type . ordinal ( ) ) ) ; } | Used to retrieve all available regions of a specific type . |
27,186 | public Region getContainingRegion ( RegionType type ) { loadRegionData ( ) ; if ( containingRegion == null ) { return null ; } if ( containingRegion . type . equals ( type ) ) { return containingRegion ; } else { return containingRegion . getContainingRegion ( type ) ; } } | Used to determine the macroregion that geographically contains this region and that matches the given type . |
27,187 | public Set < Region > getContainedRegions ( RegionType type ) { loadRegionData ( ) ; Set < Region > result = new TreeSet < Region > ( ) ; Set < Region > cr = getContainedRegions ( ) ; for ( Region r : cr ) { if ( r . getType ( ) == type ) { result . add ( r ) ; } else { result . addAll ( r . getContainedRegions ( type ) ) ; } } return Collections . unmodifiableSet ( result ) ; } | Used to determine all the regions that are contained within this region and that match the given type |
27,188 | private boolean isValid ( CharSequence text ) { for ( int i = 0 ; i < text . length ( ) ; i ++ ) { char c = text . charAt ( i ) ; boolean valid = c == 0x9 || c == 0xA || c == 0xD || ( c >= 0x20 && c <= 0xd7ff ) || ( c >= 0xe000 && c <= 0xfffd ) ; if ( ! valid ) { return false ; } } return true ; } | Returns true if all of the characters in the text are permitted for use in XML documents . |
27,189 | public int digest ( byte [ ] buf , int offset , int len ) throws DigestException { if ( buf == null ) { throw new IllegalArgumentException ( "No output buffer given" ) ; } if ( buf . length - offset < len ) { throw new IllegalArgumentException ( "Output buffer too small for specified offset and length" ) ; } int numBytes = engineDigest ( buf , offset , len ) ; state = INITIAL ; return numBytes ; } | Completes the hash computation by performing final operations such as padding . The digest is reset after this call is made . |
27,190 | public static boolean isEqual ( byte [ ] digesta , byte [ ] digestb ) { if ( digesta == digestb ) return true ; if ( digesta == null || digestb == null ) { return false ; } if ( digesta . length != digestb . length ) { return false ; } int result = 0 ; for ( int i = 0 ; i < digesta . length ; i ++ ) { result |= digesta [ i ] ^ digestb [ i ] ; } return result == 0 ; } | Compares two digests for equality . Does a simple byte compare . |
27,191 | public final int getDigestLength ( ) { int digestLen = engineGetDigestLength ( ) ; if ( digestLen == 0 ) { try { MessageDigest md = ( MessageDigest ) clone ( ) ; byte [ ] digest = md . digest ( ) ; return digest . length ; } catch ( CloneNotSupportedException e ) { return digestLen ; } } return digestLen ; } | Returns the length of the digest in bytes or 0 if this operation is not supported by the provider and the implementation is not cloneable . |
27,192 | public String toPattern ( ) { int lastOffset = 0 ; StringBuilder result = new StringBuilder ( ) ; for ( int i = 0 ; i <= maxOffset ; ++ i ) { copyAndFixQuotes ( pattern , lastOffset , offsets [ i ] , result ) ; lastOffset = offsets [ i ] ; result . append ( '{' ) . append ( argumentNumbers [ i ] ) ; Format fmt = formats [ i ] ; if ( fmt == null ) { } else if ( fmt instanceof NumberFormat ) { if ( fmt . equals ( NumberFormat . getInstance ( locale ) ) ) { result . append ( ",number" ) ; } else if ( fmt . equals ( NumberFormat . getCurrencyInstance ( locale ) ) ) { result . append ( ",number,currency" ) ; } else if ( fmt . equals ( NumberFormat . getPercentInstance ( locale ) ) ) { result . append ( ",number,percent" ) ; } else if ( fmt . equals ( NumberFormat . getIntegerInstance ( locale ) ) ) { result . append ( ",number,integer" ) ; } else { if ( fmt instanceof DecimalFormat ) { result . append ( ",number," ) . append ( ( ( DecimalFormat ) fmt ) . toPattern ( ) ) ; } else if ( fmt instanceof ChoiceFormat ) { result . append ( ",choice," ) . append ( ( ( ChoiceFormat ) fmt ) . toPattern ( ) ) ; } else { } } } else if ( fmt instanceof DateFormat ) { int index ; for ( index = MODIFIER_DEFAULT ; index < DATE_TIME_MODIFIERS . length ; index ++ ) { DateFormat df = DateFormat . getDateInstance ( DATE_TIME_MODIFIERS [ index ] , locale ) ; if ( fmt . equals ( df ) ) { result . append ( ",date" ) ; break ; } df = DateFormat . getTimeInstance ( DATE_TIME_MODIFIERS [ index ] , locale ) ; if ( fmt . equals ( df ) ) { result . append ( ",time" ) ; break ; } } if ( index >= DATE_TIME_MODIFIERS . length ) { if ( fmt instanceof SimpleDateFormat ) { result . append ( ",date," ) . append ( ( ( SimpleDateFormat ) fmt ) . toPattern ( ) ) ; } else { } } else if ( index != MODIFIER_DEFAULT ) { result . append ( ',' ) . append ( DATE_TIME_MODIFIER_KEYWORDS [ index ] ) ; } } else { } result . append ( '}' ) ; } copyAndFixQuotes ( pattern , lastOffset , pattern . length ( ) , result ) ; return result . toString ( ) ; } | Returns a pattern representing the current state of the message format . The string is constructed from internal information and therefore does not necessarily equal the previously applied pattern . |
27,193 | public String getSignature ( TypeMirror type ) { StringBuilder sb = new StringBuilder ( ) ; buildTypeSignature ( type , sb ) ; return sb . toString ( ) ; } | Generates a unique signature for this type that can be used as a key . |
27,194 | public static String getName ( TypeMirror type ) { StringBuilder sb = new StringBuilder ( ) ; buildTypeName ( type , sb ) ; return sb . toString ( ) ; } | Generates a readable name for this type . |
27,195 | public static String getQualifiedName ( TypeMirror type ) { switch ( type . getKind ( ) ) { case DECLARED : return getQualifiedNameForTypeElement ( ( TypeElement ) ( ( DeclaredType ) type ) . asElement ( ) ) ; case TYPEVAR : return getQualifiedNameForElement ( ( ( TypeVariable ) type ) . asElement ( ) ) ; case INTERSECTION : return "&" ; case WILDCARD : return "?" ; default : throw new AssertionError ( "Unexpected type: " + type + " with kind: " + type . getKind ( ) ) ; } } | Gets the qualified name for this type as expected by a NameList instance . |
27,196 | public void addIfAbsent ( CharSequence variant , String template ) { int idx = StandardPlural . indexFromString ( variant ) ; if ( templates [ idx ] != null ) { return ; } templates [ idx ] = SimpleFormatter . compileMinMaxArguments ( template , 0 , 1 ) ; } | Adds a template if there is none yet for the plural form . |
27,197 | public String format ( double number , NumberFormat numberFormat , PluralRules pluralRules ) { String formatStr = numberFormat . format ( number ) ; StandardPlural p = selectPlural ( number , numberFormat , pluralRules ) ; SimpleFormatter formatter = templates [ p . ordinal ( ) ] ; if ( formatter == null ) { formatter = templates [ StandardPlural . OTHER_INDEX ] ; assert formatter != null ; } return formatter . format ( formatStr ) ; } | Format formats a number with this object . |
27,198 | public SimpleFormatter getByVariant ( CharSequence variant ) { assert isValid ( ) ; int idx = StandardPlural . indexOrOtherIndexFromString ( variant ) ; SimpleFormatter template = templates [ idx ] ; return ( template == null && idx != StandardPlural . OTHER_INDEX ) ? templates [ StandardPlural . OTHER_INDEX ] : template ; } | Gets the SimpleFormatter for a particular variant . |
27,199 | public static StringBuilder format ( String compiledPattern , CharSequence value , StringBuilder appendTo , FieldPosition pos ) { int [ ] offsets = new int [ 1 ] ; SimpleFormatterImpl . formatAndAppend ( compiledPattern , appendTo , offsets , value ) ; if ( pos . getBeginIndex ( ) != 0 || pos . getEndIndex ( ) != 0 ) { if ( offsets [ 0 ] >= 0 ) { pos . setBeginIndex ( pos . getBeginIndex ( ) + offsets [ 0 ] ) ; pos . setEndIndex ( pos . getEndIndex ( ) + offsets [ 0 ] ) ; } else { pos . setBeginIndex ( 0 ) ; pos . setEndIndex ( 0 ) ; } } return appendTo ; } | Formats the pattern with the value and adjusts the FieldPosition . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.