idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
27,900
private void initialize ( ULocale locale ) { ICUResourceBundle bundle = ( ICUResourceBundle ) ICUResourceBundle . getBundleInstance ( ICUData . ICU_ZONE_BASE_NAME , locale ) ; _zoneStrings = ( ICUResourceBundle ) bundle . get ( ZONE_STRINGS_BUNDLE ) ; _tzNamesMap = new ConcurrentHashMap < String , ZNames > ( ) ; _mzNam...
Initialize the transient fields called from the constructor and readObject .
27,901
private synchronized void loadStrings ( String tzCanonicalID ) { if ( tzCanonicalID == null || tzCanonicalID . length ( ) == 0 ) { return ; } loadTimeZoneNames ( tzCanonicalID ) ; Set < String > mzIDs = getAvailableMetaZoneIDs ( tzCanonicalID ) ; for ( String mzID : mzIDs ) { loadMetaZoneNames ( mzID ) ; } }
Load all strings used by the specified time zone . This is called from the initializer to load default zone s strings .
27,902
private synchronized ZNames loadMetaZoneNames ( String mzID ) { ZNames mznames = _mzNamesMap . get ( mzID ) ; if ( mznames == null ) { ZNamesLoader loader = new ZNamesLoader ( ) ; loader . loadMetaZone ( _zoneStrings , mzID ) ; mznames = ZNames . createMetaZoneAndPutInCache ( _mzNamesMap , loader . getNames ( ) , mzID ...
Returns a set of names for the given meta zone ID . This method loads the set of names into the internal map and trie for future references .
27,903
private synchronized ZNames loadTimeZoneNames ( String tzID ) { ZNames tznames = _tzNamesMap . get ( tzID ) ; if ( tznames == null ) { ZNamesLoader loader = new ZNamesLoader ( ) ; loader . loadTimeZone ( _zoneStrings , tzID ) ; tznames = ZNames . createTimeZoneAndPutInCache ( _tzNamesMap , loader . getNames ( ) , tzID ...
Returns a set of names for the given time zone ID . This method loads the set of names into the internal map and trie for future references .
27,904
public void setStrength ( int value ) { int noStrength = options & ~ STRENGTH_MASK ; switch ( value ) { case Collator . PRIMARY : case Collator . SECONDARY : case Collator . TERTIARY : case Collator . QUATERNARY : case Collator . IDENTICAL : options = noStrength | ( value << STRENGTH_SHIFT ) ; break ; default : throw n...
except that this class uses bits in its own bit set for simple values .
27,905
public long completeSegmentByteCount ( ) { long result = size ; if ( result == 0 ) return 0 ; Segment tail = head . prev ; if ( tail . limit < Segment . SIZE && tail . owner ) { result -= tail . limit - tail . pos ; } return result ; }
Returns the number of bytes in segments that are not writable . This is the number of bytes that can be flushed immediately to an underlying sink without harming throughput .
27,906
List < Integer > segmentSizes ( ) { if ( head == null ) return Collections . emptyList ( ) ; List < Integer > result = new ArrayList < > ( ) ; result . add ( head . limit - head . pos ) ; for ( Segment s = head . next ; s != head ; s = s . next ) { result . add ( s . limit - s . pos ) ; } return result ; }
For testing . This returns the sizes of the segments in this buffer .
27,907
public synchronized Set < Map . Entry < Object , Object > > entrySet ( ) { checkInitialized ( ) ; if ( entrySet == null ) { if ( entrySetCallCount ++ == 0 ) entrySet = Collections . unmodifiableMap ( this ) . entrySet ( ) ; else return super . entrySet ( ) ; } if ( entrySetCallCount != 2 ) throw new RuntimeException ( ...
Returns an unmodifiable Set view of the property entries contained in this Provider .
27,908
private void putId ( ) { super . put ( "Provider.id name" , String . valueOf ( name ) ) ; super . put ( "Provider.id version" , String . valueOf ( version ) ) ; super . put ( "Provider.id info" , String . valueOf ( info ) ) ; super . put ( "Provider.id className" , this . getClass ( ) . getName ( ) ) ; }
report to different provider objects as the same
27,909
private void implPutAll ( Map t ) { for ( Map . Entry e : ( ( Map < ? , ? > ) t ) . entrySet ( ) ) { implPut ( e . getKey ( ) , e . getValue ( ) ) ; } if ( registered ) { Security . increaseVersion ( ) ; } }
Copies all of the mappings from the specified Map to this provider . Internal method to be called AFTER the security check has been performed .
27,910
private void ensureLegacyParsed ( ) { if ( ( legacyChanged == false ) || ( legacyStrings == null ) ) { return ; } serviceSet = null ; if ( legacyMap == null ) { legacyMap = new LinkedHashMap < ServiceKey , Service > ( ) ; } else { legacyMap . clear ( ) ; } for ( Map . Entry < String , String > entry : legacyStrings . e...
Ensure all the legacy String properties are fully parsed into service objects .
27,911
private void removeInvalidServices ( Map < ServiceKey , Service > map ) { for ( Iterator t = map . entrySet ( ) . iterator ( ) ; t . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) t . next ( ) ; Service s = ( Service ) entry . getValue ( ) ; if ( s . isValid ( ) == false ) { t . remove ( ) ; } } }
Remove all invalid services from the Map . Invalid services can only occur if the legacy properties are inconsistent or incomplete .
27,912
public synchronized Set < Service > getServices ( ) { checkInitialized ( ) ; if ( legacyChanged || servicesChanged ) { serviceSet = null ; } if ( serviceSet == null ) { ensureLegacyParsed ( ) ; Set < Service > set = new LinkedHashSet < > ( ) ; if ( serviceMap != null ) { set . addAll ( serviceMap . values ( ) ) ; } if ...
Get an unmodifiable Set of all services supported by this Provider .
27,913
private void putPropertyStrings ( Service s ) { String type = s . getType ( ) ; String algorithm = s . getAlgorithm ( ) ; super . put ( type + "." + algorithm , s . getClassName ( ) ) ; for ( String alias : s . getAliases ( ) ) { super . put ( ALIAS_PREFIX + type + "." + alias , algorithm ) ; } for ( Map . Entry < UStr...
Put the string properties for this Service in this Provider s Hashtable .
27,914
private void removePropertyStrings ( Service s ) { String type = s . getType ( ) ; String algorithm = s . getAlgorithm ( ) ; super . remove ( type + "." + algorithm ) ; for ( String alias : s . getAliases ( ) ) { super . remove ( ALIAS_PREFIX + type + "." + alias ) ; } for ( Map . Entry < UString , String > entry : s ....
Remove the string properties for this Service from this Provider s Hashtable .
27,915
public final LongStream asLongStream ( ) { return new LongPipeline . StatelessOp < Integer > ( this , StreamShape . INT_VALUE , StreamOpFlag . NOT_SORTED | StreamOpFlag . NOT_DISTINCT ) { public Sink < Integer > opWrapSink ( int flags , Sink < Long > sink ) { return new Sink . ChainedInt < Long > ( sink ) { public void...
Stateless intermediate ops from IntStream
27,916
public final IntStream limit ( long maxSize ) { if ( maxSize < 0 ) throw new IllegalArgumentException ( Long . toString ( maxSize ) ) ; return SliceOps . makeInt ( this , 0 , maxSize ) ; }
Stateful intermediate ops from IntStream
27,917
public synchronized Object getInstanceIfFree ( ) { if ( ! freeStack . isEmpty ( ) ) { Object result = freeStack . remove ( freeStack . size ( ) - 1 ) ; return result ; } return null ; }
Get an instance of the given object in this pool if available
27,918
public XObject getValue ( TransformerImpl transformer , int sourceNode ) throws TransformerException { XObject var ; XPathContext xctxt = transformer . getXPathContext ( ) ; xctxt . pushCurrentNode ( sourceNode ) ; try { if ( null != m_selectPattern ) { var = m_selectPattern . execute ( xctxt , sourceNode , this ) ; va...
Get the XObject representation of the variable .
27,919
public void parseRules ( String description ) { List < NFRule > tempRules = new ArrayList < NFRule > ( ) ; NFRule predecessor = null ; int oldP = 0 ; int descriptionLen = description . length ( ) ; int p ; do { p = description . indexOf ( ';' , oldP ) ; if ( p < 0 ) { p = descriptionLen ; } NFRule . makeRules ( descrip...
Construct the subordinate data structures used by this object . This function is called by the RuleBasedNumberFormat constructor after all the rule sets have been created to actually parse the description and build rules from it . Since any rule set can refer to any other rule set we have to have created all of them be...
27,920
void setNonNumericalRule ( NFRule rule ) { long baseValue = rule . getBaseValue ( ) ; if ( baseValue == NFRule . NEGATIVE_NUMBER_RULE ) { nonNumericalRules [ NFRuleSet . NEGATIVE_RULE_INDEX ] = rule ; } else if ( baseValue == NFRule . IMPROPER_FRACTION_RULE ) { setBestFractionRule ( NFRuleSet . IMPROPER_FRACTION_RULE_I...
Set one of the non - numerical rules .
27,921
private void setBestFractionRule ( int originalIndex , NFRule newRule , boolean rememberRule ) { if ( rememberRule ) { if ( fractionRules == null ) { fractionRules = new LinkedList < NFRule > ( ) ; } fractionRules . add ( newRule ) ; } NFRule bestResult = nonNumericalRules [ originalIndex ] ; if ( bestResult == null ) ...
Determine the best fraction rule to use . Rules matching the decimal point from DecimalFormatSymbols become the main set of rules to use .
27,922
public void format ( long number , StringBuilder toInsertInto , int pos , int recursionCount ) { if ( recursionCount >= RECURSION_LIMIT ) { throw new IllegalStateException ( "Recursion limit exceeded when applying ruleSet " + name ) ; } NFRule applicableRule = findNormalRule ( number ) ; applicableRule . doFormat ( num...
Formats a long . Selects an appropriate rule and dispatches control to it .
27,923
NFRule findRule ( double number ) { if ( isFractionRuleSet ) { return findFractionRuleSetRule ( number ) ; } if ( Double . isNaN ( number ) ) { NFRule rule = nonNumericalRules [ NAN_RULE_INDEX ] ; if ( rule == null ) { rule = owner . getDefaultNaNRule ( ) ; } return rule ; } if ( number < 0 ) { if ( nonNumericalRules [...
Selects an appropriate rule for formatting the number .
27,924
private static long lcm ( long x , long y ) { long x1 = x ; long y1 = y ; int p2 = 0 ; while ( ( x1 & 1 ) == 0 && ( y1 & 1 ) == 0 ) { ++ p2 ; x1 >>= 1 ; y1 >>= 1 ; } long t ; if ( ( x1 & 1 ) == 1 ) { t = - y1 ; } else { t = x1 ; } while ( t != 0 ) { while ( ( t & 1 ) == 0 ) { t >>= 1 ; } if ( t > 0 ) { x1 = t ; } else ...
Calculates the least common multiple of x and y .
27,925
public static String jarVersion ( Class < ? > jarClass ) { String j2objcVersion = null ; String path = jarClass . getProtectionDomain ( ) . getCodeSource ( ) . getLocation ( ) . getPath ( ) ; try ( JarFile jar = new JarFile ( URLDecoder . decode ( path , "UTF-8" ) ) ) { Manifest manifest = jar . getManifest ( ) ; j2obj...
Returns the version entry from a jar file s manifest if available . If the class isn t in a jar file or that jar file doesn t define a version entry then a not available string is returned .
27,926
public void endVisit ( PropertyAnnotation node ) { FieldDeclaration field = ( FieldDeclaration ) node . getParent ( ) ; TypeMirror fieldType = field . getTypeMirror ( ) ; String getter = node . getGetter ( ) ; String setter = node . getSetter ( ) ; if ( field . getFragments ( ) . size ( ) > 1 ) { if ( getter != null ) ...
Make sure attempt isn t made to specify an accessor method for fields with multiple fragments since each variable needs unique accessors .
27,927
public boolean contains ( Object key ) { return key == null ? ( indexOfNull ( ) >= 0 ) : ( indexOf ( key , key . hashCode ( ) ) >= 0 ) ; }
Check whether a value exists in the set .
27,928
public boolean add ( E value ) { final int hash ; int index ; if ( value == null ) { hash = 0 ; index = indexOfNull ( ) ; } else { hash = value . hashCode ( ) ; index = indexOf ( value , hash ) ; } if ( index >= 0 ) { return false ; } index = ~ index ; if ( mSize >= mHashes . length ) { final int n = mSize >= ( BASE_SI...
Adds the specified object to this set . The set is not modified if it already contains the object .
27,929
public boolean remove ( Object object ) { int index = object == null ? indexOfNull ( ) : indexOf ( object , object . hashCode ( ) ) ; if ( index >= 0 ) { removeAt ( index ) ; return true ; } return false ; }
Removes the specified object from this set .
27,930
public final StringBuffer format ( Object obj , StringBuffer appendTo , FieldPosition fieldPosition ) { if ( obj instanceof DateInterval ) { return format ( ( DateInterval ) obj , appendTo , fieldPosition ) ; } else { throw new IllegalArgumentException ( "Cannot format given Object (" + obj . getClass ( ) . getName ( )...
Format an object to produce a string . This method handles Formattable objects with a DateInterval type . If a the Formattable object type is not a DateInterval IllegalArgumentException is thrown .
27,931
public final synchronized StringBuffer format ( DateInterval dtInterval , StringBuffer appendTo , FieldPosition fieldPosition ) { fFromCalendar . setTimeInMillis ( dtInterval . getFromDate ( ) ) ; fToCalendar . setTimeInMillis ( dtInterval . getToDate ( ) ) ; return format ( fFromCalendar , fToCalendar , appendTo , fie...
Format a DateInterval to produce a string .
27,932
public void setDateIntervalInfo ( DateIntervalInfo newItvPattern ) { fInfo = ( DateIntervalInfo ) newItvPattern . clone ( ) ; this . isDateIntervalInfoDefault = false ; fInfo . freeze ( ) ; if ( fDateFormat != null ) { initializePattern ( null ) ; } }
Set the date time interval patterns .
27,933
public TimeZone getTimeZone ( ) { if ( fDateFormat != null ) { return ( TimeZone ) ( fDateFormat . getTimeZone ( ) . clone ( ) ) ; } return TimeZone . getDefault ( ) ; }
Get the TimeZone
27,934
public void setTimeZone ( TimeZone zone ) { TimeZone zoneToSet = ( TimeZone ) zone . clone ( ) ; if ( fDateFormat != null ) { fDateFormat . setTimeZone ( zoneToSet ) ; } if ( fFromCalendar != null ) { fFromCalendar . setTimeZone ( zoneToSet ) ; } if ( fToCalendar != null ) { fToCalendar . setTimeZone ( zoneToSet ) ; } ...
Set the TimeZone for the calendar used by this DateIntervalFormat object .
27,935
private String getConcatenationPattern ( ULocale locale ) { ICUResourceBundle rb = ( ICUResourceBundle ) UResourceBundle . getBundleInstance ( ICUData . ICU_BASE_NAME , locale ) ; ICUResourceBundle dtPatternsRb = rb . getWithFallback ( "calendar/gregorian/DateTimePatterns" ) ; ICUResourceBundle concatenationPatternRb =...
Retrieves the concatenation DateTime pattern from the resource bundle .
27,936
public static < T extends Object & Comparable < ? super T > > boolean hasRelation ( SortedSet < T > a , int allow , SortedSet < T > b ) { if ( allow < NONE || allow > ANY ) { throw new IllegalArgumentException ( "Relation " + allow + " out of range" ) ; } boolean anb = ( allow & A_NOT_B ) != 0 ; boolean ab = ( allow & ...
Utility that could be on SortedSet . Faster implementation than what is in Java for doing contains equals etc .
27,937
final long internalNextLong ( long origin , long bound ) { long r = mix64 ( nextSeed ( ) ) ; if ( origin < bound ) { long n = bound - origin , m = n - 1 ; if ( ( n & m ) == 0L ) r = ( r & m ) + origin ; else if ( n > 0L ) { for ( long u = r >>> 1 ; u + m - ( r = u % n ) < 0L ; u = mix64 ( nextSeed ( ) ) >>> 1 ) ; r += ...
The form of nextLong used by LongStream Spliterators . If origin is greater than bound acts as unbounded form of nextLong else as bounded form .
27,938
final int internalNextInt ( int origin , int bound ) { int r = mix32 ( nextSeed ( ) ) ; if ( origin < bound ) { int n = bound - origin , m = n - 1 ; if ( ( n & m ) == 0 ) r = ( r & m ) + origin ; else if ( n > 0 ) { for ( int u = r >>> 1 ; u + m - ( r = u % n ) < 0 ; u = mix32 ( nextSeed ( ) ) >>> 1 ) ; r += origin ; }...
The form of nextInt used by IntStream Spliterators . Exactly the same as long version except for types .
27,939
final double internalNextDouble ( double origin , double bound ) { double r = ( nextLong ( ) >>> 11 ) * DOUBLE_UNIT ; if ( origin < bound ) { r = r * ( bound - origin ) + origin ; if ( r >= bound ) r = Double . longBitsToDouble ( Double . doubleToLongBits ( bound ) - 1 ) ; } return r ; }
The form of nextDouble used by DoubleStream Spliterators .
27,940
public static Currency getInstance ( ULocale locale ) { String currency = locale . getKeywordValue ( "currency" ) ; if ( currency != null ) { return getInstance ( currency ) ; } if ( shim == null ) { return createCurrency ( locale ) ; } return shim . createInstance ( locale ) ; }
Returns a currency object for the default currency in the given locale .
27,941
public static String [ ] getAvailableCurrencyCodes ( ULocale loc , Date d ) { String region = ULocale . getRegionForSupplementalData ( loc , false ) ; CurrencyFilter filter = CurrencyFilter . onDate ( d ) . withRegion ( region ) ; List < String > list = getTenderCurrencies ( filter ) ; if ( list . isEmpty ( ) ) { retur...
Returns an array of Strings which contain the currency identifiers that are valid for the given locale on the given date . If there are no such identifiers returns null . Returned identifiers are in preference order .
27,942
public static Set < Currency > getAvailableCurrencies ( ) { CurrencyMetaInfo info = CurrencyMetaInfo . getInstance ( ) ; List < String > list = info . currencies ( CurrencyFilter . all ( ) ) ; HashSet < Currency > resultSet = new HashSet < Currency > ( list . size ( ) ) ; for ( String code : list ) { resultSet . add ( ...
Returns the set of available currencies . The returned set of currencies contains all of the available currencies including obsolete ones . The result set can be modified without affecting the available currencies in the runtime .
27,943
public static Currency getInstance ( String theISOCode ) { if ( theISOCode == null ) { throw new NullPointerException ( "The input currency code is null." ) ; } if ( ! isAlpha3Code ( theISOCode ) ) { throw new IllegalArgumentException ( "The input currency code is not 3-letter alphabetic code." ) ; } return ( Currency ...
Returns a currency object given an ISO 4217 3 - letter code .
27,944
public static Object registerInstance ( Currency currency , ULocale locale ) { return getShim ( ) . registerInstance ( currency , locale ) ; }
Registers a new currency for the provided locale . The returned object is a key that can be used to unregister this currency object .
27,945
public static String parse ( ULocale locale , String text , int type , ParsePosition pos ) { List < TextTrieMap < CurrencyStringInfo > > currencyTrieVec = CURRENCY_NAME_CACHE . get ( locale ) ; if ( currencyTrieVec == null ) { TextTrieMap < CurrencyStringInfo > currencyNameTrie = new TextTrieMap < CurrencyStringInfo > ...
Attempt to parse the given string as a currency either as a display name in the given locale or as a 3 - letter ISO 4217 code . If multiple display names match then the longest one is selected . If both a display name and a 3 - letter ISO code match then the display name is preferred unless it s length is less than 3 .
27,946
public int getDefaultFractionDigits ( CurrencyUsage Usage ) { CurrencyMetaInfo info = CurrencyMetaInfo . getInstance ( ) ; CurrencyDigits digits = info . currencyDigits ( subType , Usage ) ; return digits . fractionDigits ; }
Returns the number of the number of fraction digits that should be displayed for this currency with Usage .
27,947
public double getRoundingIncrement ( CurrencyUsage Usage ) { CurrencyMetaInfo info = CurrencyMetaInfo . getInstance ( ) ; CurrencyDigits digits = info . currencyDigits ( subType , Usage ) ; int data1 = digits . roundingIncrement ; if ( data1 == 0 ) { return 0.0 ; } int data0 = digits . fractionDigits ; if ( data0 < 0 |...
Returns the rounding increment for this currency or 0 . 0 if no rounding is done by this currency with the Usage .
27,948
private static List < String > getTenderCurrencies ( CurrencyFilter filter ) { CurrencyMetaInfo info = CurrencyMetaInfo . getInstance ( ) ; return info . currencies ( filter . withTender ( ) ) ; }
Returns the list of remaining tender currencies after a filter is applied .
27,949
public boolean visitFunction ( ExpressionOwner owner , Function func ) { if ( func instanceof FuncExtFunction ) { String namespace = ( ( FuncExtFunction ) func ) . getNamespace ( ) ; m_sroot . getExtensionNamespacesManager ( ) . registerExtension ( namespace ) ; } else if ( func instanceof FuncExtFunctionAvailable ) { ...
If the function is an extension function register the namespace .
27,950
@ SuppressWarnings ( "fallthrough" ) private boolean findSection ( int offset , Position pos ) { int i = offset , len = rawBytes . length ; int last = offset ; int next ; boolean allBlank = true ; pos . endOfFirstLine = - 1 ; while ( i < len ) { byte b = rawBytes [ i ] ; switch ( b ) { case '\r' : if ( pos . endOfFirst...
find a section in the manifest .
27,951
DataBundle get ( ULocale locale ) { DataBundle result = cache . get ( locale ) ; if ( result == null ) { result = load ( locale ) ; cache . put ( locale , result ) ; } return result ; }
Fetch data for a particular locale . Clients must not modify any part of the returned data . Portions of returned data may be shared so modifying it will have unpredictable results .
27,952
private static long calculateDivisor ( long power10 , int numZeros ) { long divisor = power10 ; for ( int i = 1 ; i < numZeros ; i ++ ) { divisor /= 10 ; } return divisor ; }
Calculate a divisor based on the magnitude and number of zeros in the template string .
27,953
private static void checkForOtherVariants ( Data data , ULocale locale , String style ) { DecimalFormat . Unit [ ] otherByBase = data . units . get ( OTHER ) ; if ( otherByBase == null ) { throw new IllegalArgumentException ( "No 'other' plural variants defined in " + localeAndStyle ( locale , style ) ) ; } for ( Map ....
Checks to make sure that an other variant is present in all powers of 10 .
27,954
private static void fillInMissing ( Data result ) { long lastDivisor = 1L ; for ( int i = 0 ; i < result . divisors . length ; i ++ ) { if ( result . units . get ( OTHER ) [ i ] == null ) { result . divisors [ i ] = lastDivisor ; copyFromPreviousIndex ( i , result . units ) ; } else { lastDivisor = result . divisors [ ...
After reading information from resource bundle into a Data object there is guarantee that it is complete .
27,955
static DecimalFormat . Unit getUnit ( Map < String , DecimalFormat . Unit [ ] > units , String variant , int base ) { DecimalFormat . Unit [ ] byBase = units . get ( variant ) ; if ( byBase == null ) { byBase = units . get ( CompactDecimalDataCache . OTHER ) ; } return byBase [ base ] ; }
Fetches a prefix or suffix given a plural variant and log10 value . If it can t find the given variant it falls back to other .
27,956
public String lookupNamespace ( String prefix ) { String uri = null ; final Stack stack = getPrefixStack ( prefix ) ; if ( stack != null && ! stack . isEmpty ( ) ) { uri = ( ( MappingRecord ) stack . peek ( ) ) . m_uri ; } if ( uri == null ) uri = EMPTYSTRING ; return uri ; }
Use a namespace prefix to lookup a namespace URI .
27,957
public String lookupPrefix ( String uri ) { String foundPrefix = null ; Enumeration prefixes = m_namespaces . keys ( ) ; while ( prefixes . hasMoreElements ( ) ) { String prefix = ( String ) prefixes . nextElement ( ) ; String uri2 = lookupNamespace ( prefix ) ; if ( uri2 != null && uri2 . equals ( uri ) ) { foundPrefi...
Given a namespace uri and the namespaces mappings for the current element return the current prefix for that uri .
27,958
boolean popNamespace ( String prefix ) { if ( prefix . startsWith ( XML_PREFIX ) ) { return false ; } Stack stack ; if ( ( stack = getPrefixStack ( prefix ) ) != null ) { stack . pop ( ) ; return true ; } return false ; }
Undeclare the namespace that is currently pointed to by a given prefix
27,959
public boolean pushNamespace ( String prefix , String uri , int elemDepth ) { if ( prefix . startsWith ( XML_PREFIX ) ) { return false ; } Stack stack ; if ( ( stack = ( Stack ) m_namespaces . get ( prefix ) ) == null ) { m_namespaces . put ( prefix , stack = new Stack ( ) ) ; } if ( ! stack . empty ( ) ) { MappingReco...
Declare a mapping of a prefix to namespace URI at the given element depth .
27,960
void popNamespaces ( int elemDepth , ContentHandler saxHandler ) { while ( true ) { if ( m_nodeStack . isEmpty ( ) ) return ; MappingRecord map = ( MappingRecord ) ( m_nodeStack . peek ( ) ) ; int depth = map . m_declarationDepth ; if ( elemDepth < 1 || map . m_declarationDepth < elemDepth ) break ; MappingRecord nm1 =...
Pop or undeclare all namespace definitions that are currently declared at the given element depth or deepter .
27,961
private Stack createPrefixStack ( String prefix ) { Stack fs = new Stack ( ) ; m_namespaces . put ( prefix , fs ) ; return fs ; }
A more type - safe way of saving stacks under the m_namespaces Hashtable .
27,962
public String [ ] lookupAllPrefixes ( String uri ) { java . util . ArrayList foundPrefixes = new java . util . ArrayList ( ) ; Enumeration prefixes = m_namespaces . keys ( ) ; while ( prefixes . hasMoreElements ( ) ) { String prefix = ( String ) prefixes . nextElement ( ) ; String uri2 = lookupNamespace ( prefix ) ; if...
Given a namespace uri get all prefixes bound to the Namespace URI in the current scope .
27,963
public CharsetMatch detect ( ) { CharsetMatch matches [ ] = detectAll ( ) ; if ( matches == null || matches . length == 0 ) { return null ; } return matches [ 0 ] ; }
Return the charset that best matches the supplied input data .
27,964
public String [ ] getDetectableCharsets ( ) { List < String > csnames = new ArrayList < String > ( ALL_CS_RECOGNIZERS . size ( ) ) ; for ( int i = 0 ; i < ALL_CS_RECOGNIZERS . size ( ) ; i ++ ) { CSRecognizerInfo rcinfo = ALL_CS_RECOGNIZERS . get ( i ) ; boolean active = ( fEnabledRecognizers == null ) ? rcinfo . isDef...
Get the names of charsets that can be recognized by this CharsetDetector instance .
27,965
public void reset ( ) { m_flushedStartDoc = false ; m_foundFirstElement = false ; m_outputStream = null ; clearParameters ( ) ; m_result = null ; m_resultContentHandler = null ; m_resultDeclHandler = null ; m_resultDTDHandler = null ; m_resultLexicalHandler = null ; m_serializer = null ; m_systemID = null ; m_URIResolv...
Reset the status of the transformer .
27,966
public void setParameter ( String name , Object value ) { if ( value == null ) { throw new IllegalArgumentException ( XSLMessages . createMessage ( XSLTErrorResources . ER_INVALID_SET_PARAM_VALUE , new Object [ ] { name } ) ) ; } if ( null == m_params ) { m_params = new Hashtable ( ) ; } m_params . put ( name , value )...
Add a parameter for the transformation .
27,967
public void setOutputProperty ( String name , String value ) throws IllegalArgumentException { if ( ! OutputProperties . isLegalPropertyKey ( name ) ) throw new IllegalArgumentException ( XSLMessages . createMessage ( XSLTErrorResources . ER_OUTPUT_PROPERTY_NOT_RECOGNIZED , new Object [ ] { name } ) ) ; m_outputFormat ...
Set an output property that will be in effect for the transformation .
27,968
public void setDocumentLocator ( Locator locator ) { try { if ( null == m_resultContentHandler ) createResultContentHandler ( m_result ) ; } catch ( TransformerException te ) { throw new org . apache . xml . utils . WrappedRuntimeException ( te ) ; } m_resultContentHandler . setDocumentLocator ( locator ) ; }
Receive a Locator object for document events .
27,969
public Segment pop ( ) { Segment result = next != this ? next : null ; prev . next = next ; next . prev = prev ; next = null ; prev = null ; return result ; }
Removes this segment of a circularly - linked list and returns its successor . Returns null if the list is now empty .
27,970
public void compact ( ) { if ( prev == this ) throw new IllegalStateException ( ) ; if ( ! prev . owner ) return ; int byteCount = limit - pos ; int availableByteCount = SIZE - prev . limit + ( prev . shared ? 0 : prev . pos ) ; if ( byteCount > availableByteCount ) return ; writeTo ( prev , byteCount ) ; pop ( ) ; Seg...
Call this when the tail and its predecessor may both be less than half full . This will copy data so that segments can be recycled .
27,971
public static SimpleDateFormat getInstance ( Calendar . FormatConfiguration formatConfig ) { String ostr = formatConfig . getOverrideString ( ) ; boolean useFast = ( ostr != null && ostr . length ( ) > 0 ) ; return new SimpleDateFormat ( formatConfig . getPatternString ( ) , formatConfig . getDateFormatSymbols ( ) , fo...
Creates an instance of SimpleDateFormat for the given format configuration
27,972
private synchronized void initializeTimeZoneFormat ( boolean bForceUpdate ) { if ( bForceUpdate || tzFormat == null ) { tzFormat = TimeZoneFormat . getInstance ( locale ) ; String digits = null ; if ( numberFormat instanceof DecimalFormat ) { DecimalFormatSymbols decsym = ( ( DecimalFormat ) numberFormat ) . getDecimal...
Private method lazily instantiate the TimeZoneFormat field
27,973
public void setContext ( DisplayContext context ) { super . setContext ( context ) ; if ( capitalizationBrkIter == null && ( context == DisplayContext . CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE || context == DisplayContext . CAPITALIZATION_FOR_UI_LIST_OR_MENU || context == DisplayContext . CAPITALIZATION_FOR_STANDALONE...
Here we override the DateFormat implementation in order to lazily initialize relevant items
27,974
private StringBuffer format ( Calendar cal , DisplayContext capitalizationContext , StringBuffer toAppendTo , FieldPosition pos , List < FieldPosition > attributes ) { pos . setBeginIndex ( 0 ) ; pos . setEndIndex ( 0 ) ; Object [ ] items = getPatternItems ( ) ; for ( int i = 0 ; i < items . length ; i ++ ) { if ( item...
then attribute information will be recorded .
27,975
protected DateFormat . Field patternCharToDateFormatField ( char ch ) { int patternCharIndex = getIndexFromChar ( ch ) ; if ( patternCharIndex != - 1 ) { return PATTERN_INDEX_TO_DATE_FORMAT_ATTRIBUTE [ patternCharIndex ] ; } return null ; }
Returns a DateFormat . Field constant associated with the specified format pattern character .
27,976
protected String subFormat ( char ch , int count , int beginOffset , FieldPosition pos , DateFormatSymbols fmtData , Calendar cal ) throws IllegalArgumentException { return subFormat ( ch , count , beginOffset , 0 , DisplayContext . CAPITALIZATION_NONE , pos , cal ) ; }
Formats a single field given its pattern character . Subclasses may override this method in order to modify or add formatting capabilities .
27,977
protected void zeroPaddingNumber ( NumberFormat nf , StringBuffer buf , int value , int minDigits , int maxDigits ) { if ( useLocalZeroPaddingNumberFormat && value >= 0 ) { fastZeroPaddingNumber ( buf , value , minDigits , maxDigits ) ; } else { nf . setMinimumIntegerDigits ( minDigits ) ; nf . setMaximumIntegerDigits ...
Internal high - speed method . Reuses a StringBuffer for results instead of creating a String on the heap for each call .
27,978
private static final boolean isNumeric ( char formatChar , int count ) { return NUMERIC_FORMAT_CHARS . indexOf ( formatChar ) >= 0 || ( count <= 2 && NUMERIC_FORMAT_CHARS2 . indexOf ( formatChar ) >= 0 ) ; }
Return true if the given format character occuring count times represents a numeric field .
27,979
private int matchDayPeriodString ( String text , int start , String [ ] data , int dataLength , Output < DayPeriodRules . DayPeriod > dayPeriod ) { int bestMatchLength = 0 , bestMatch = - 1 ; int matchLength = 0 ; for ( int i = 0 ; i < dataLength ; ++ i ) { if ( data [ i ] != null ) { int length = data [ i ] . length (...
Similar to matchQuarterString but customized for day periods .
27,980
private boolean allowNumericFallback ( int patternCharIndex ) { if ( patternCharIndex == 26 || patternCharIndex == 19 || patternCharIndex == 25 || patternCharIndex == 30 || patternCharIndex == 27 || patternCharIndex == 28 ) { return true ; } return false ; }
return true if the pattern specified by patternCharIndex is one that allows numeric fallback regardless of actual pattern size .
27,981
private Number parseInt ( String text , ParsePosition pos , boolean allowNegative , NumberFormat fmt ) { return parseInt ( text , - 1 , pos , allowNegative , fmt ) ; }
Parse an integer using numberFormat . This method is semantically const but actually may modify fNumberFormat .
27,982
private Number parseInt ( String text , int maxDigits , ParsePosition pos , boolean allowNegative , NumberFormat fmt ) { Number number ; int oldPos = pos . getIndex ( ) ; if ( allowNegative ) { number = fmt . parse ( text , pos ) ; } else { if ( fmt instanceof DecimalFormat ) { String oldPrefix = ( ( DecimalFormat ) fm...
Parse an integer using numberFormat up to maxDigits .
27,983
private String translatePattern ( String pat , String from , String to ) { StringBuilder result = new StringBuilder ( ) ; boolean inQuote = false ; for ( int i = 0 ; i < pat . length ( ) ; ++ i ) { char c = pat . charAt ( i ) ; if ( inQuote ) { if ( c == '\'' ) inQuote = false ; } else { if ( c == '\'' ) { inQuote = tr...
Translate a pattern mapping each character in the from string to the corresponding character in the to string .
27,984
public void applyPattern ( String pat ) { this . pattern = pat ; parsePattern ( ) ; setLocale ( null , null ) ; patternItems = null ; }
Apply the given unlocalized pattern string to this date format .
27,985
public void applyLocalizedPattern ( String pat ) { this . pattern = translatePattern ( pat , formatData . localPatternChars , DateFormatSymbols . patternChars ) ; setLocale ( null , null ) ; }
Apply the given localized pattern string to this date format .
27,986
public AttributedCharacterIterator formatToCharacterIterator ( Object obj ) { Calendar cal = calendar ; if ( obj instanceof Calendar ) { cal = ( Calendar ) obj ; } else if ( obj instanceof Date ) { calendar . setTime ( ( Date ) obj ) ; } else if ( obj instanceof Number ) { calendar . setTimeInMillis ( ( ( Number ) obj ...
Format the object to an attributed string and return the corresponding iterator Overrides superclass method .
27,987
private boolean diffCalFieldValue ( Calendar fromCalendar , Calendar toCalendar , Object [ ] items , int i ) throws IllegalArgumentException { if ( items [ i ] instanceof String ) { return false ; } PatternItem item = ( PatternItem ) items [ i ] ; char ch = item . type ; int patternCharIndex = getIndexFromChar ( ch ) ;...
check whether the i - th item in 2 calendar is in different value .
27,988
private boolean lowerLevel ( Object [ ] items , int i , int level ) throws IllegalArgumentException { if ( items [ i ] instanceof String ) { return false ; } PatternItem item = ( PatternItem ) items [ i ] ; char ch = item . type ; int patternCharIndex = getLevelFromChar ( ch ) ; if ( patternCharIndex == - 1 ) { throw n...
check whether the i - th item s level is lower than the input level
27,989
public void addUniqueAttribute ( String rawName , String value , int flags ) throws SAXException { if ( m_firstTagNotEmitted ) { flush ( ) ; } m_handler . addUniqueAttribute ( rawName , value , flags ) ; }
Adds a unique attribute to the currenly open tag
27,990
private String getPrefixPartUnknown ( String qname ) { final int index = qname . indexOf ( ':' ) ; return ( index > 0 ) ? qname . substring ( 0 , index ) : EMPTYSTRING ; }
Utility function to return prefix
27,991
public NamespaceMappings getNamespaceMappings ( ) { NamespaceMappings mappings = null ; if ( m_handler != null ) { mappings = m_handler . getNamespaceMappings ( ) ; } return mappings ; }
Get the current namespace mappings . Simply returns the mappings of the wrapped handler .
27,992
private void initExtendedTypes ( ) { m_extendedTypes = new ExtendedType [ m_initialSize ] ; for ( int i = 0 ; i < DTM . NTYPES ; i ++ ) { m_extendedTypes [ i ] = m_defaultExtendedTypes [ i ] ; m_table [ i ] = new HashEntry ( m_defaultExtendedTypes [ i ] , i , i , null ) ; } m_nextType = DTM . NTYPES ; }
Initialize the vector of extended types with the basic DOM node types .
27,993
public int getExpandedTypeID ( String namespace , String localName , int type ) { return getExpandedTypeID ( namespace , localName , type , false ) ; }
Given an expanded name represented by namespace local name and node type return an ID . If the expanded - name does not exist in the internal tables the entry will be created and the ID will be returned . Any additional nodes that are created that have this expanded name will use this ID .
27,994
private void rehash ( ) { int oldCapacity = m_capacity ; HashEntry [ ] oldTable = m_table ; int newCapacity = 2 * oldCapacity + 1 ; m_capacity = newCapacity ; m_threshold = ( int ) ( newCapacity * m_loadFactor ) ; m_table = new HashEntry [ newCapacity ] ; for ( int i = oldCapacity - 1 ; i >= 0 ; i -- ) { for ( HashEntr...
Increases the capacity of and internally reorganizes the hashtable in order to accommodate and access its entries more efficiently . This method is called when the number of keys in the hashtable exceeds this hashtable s capacity and load factor .
27,995
private void expand ( ) { int i ; if ( isCompact ) { byte [ ] tempArray ; hashes = new int [ INDEXCOUNT ] ; tempArray = new byte [ UNICODECOUNT ] ; for ( i = 0 ; i < UNICODECOUNT ; ++ i ) { byte value = elementAt ( ( char ) i ) ; tempArray [ i ] = value ; touchBlock ( i >> BLOCKSHIFT , value ) ; } for ( i = 0 ; i < IND...
Expanding takes the array back to a 65536 element array .
27,996
public void setDecomposition ( int value ) { if ( value < Collator . NO_DECOMPOSITION || value > Collator . FULL_DECOMPOSITION ) { throw new IllegalArgumentException ( ) ; } decomposition = value ; }
Sets decomposition field but is otherwise unused .
27,997
public void setStrength ( int value ) { if ( value < Collator . PRIMARY || value > Collator . IDENTICAL ) { throw new IllegalArgumentException ( ) ; } strength = value ; }
Sets strength field but is otherwise unused .
27,998
public boolean get ( int index ) throws ArrayIndexOutOfBoundsException { if ( index < 0 || index >= length ) { throw new ArrayIndexOutOfBoundsException ( Integer . toString ( index ) ) ; } return ( repn [ subscript ( index ) ] & position ( index ) ) != 0 ; }
Returns the indexed bit in this BitArray .
27,999
public void set ( int index , boolean value ) throws ArrayIndexOutOfBoundsException { if ( index < 0 || index >= length ) { throw new ArrayIndexOutOfBoundsException ( Integer . toString ( index ) ) ; } int idx = subscript ( index ) ; int bit = position ( index ) ; if ( value ) { repn [ idx ] |= bit ; } else { repn [ id...
Sets the indexed bit in this BitArray .