idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
26,000
protected int getLimit ( int field , int limitType ) { switch ( field ) { case DAY_OF_WEEK : case AM_PM : case HOUR : case HOUR_OF_DAY : case MINUTE : case SECOND : case MILLISECOND : case ZONE_OFFSET : case DST_OFFSET : case DOW_LOCAL : case JULIAN_DAY : case MILLISECONDS_IN_DAY : case IS_LEAP_MONTH : return LIMITS [ ...
Returns a limit for a field .
26,001
private void updateTime ( ) { computeTime ( ) ; if ( isLenient ( ) || ! areAllFieldsSet ) areFieldsSet = false ; isTimeSet = true ; areFieldsVirtuallySet = false ; }
Recompute the time and update the status fields isTimeSet and areFieldsSet . Callers should check isTimeSet and only call this method if isTimeSet is false .
26,002
private final void computeGregorianAndDOWFields ( int julianDay ) { computeGregorianFields ( julianDay ) ; int dow = fields [ DAY_OF_WEEK ] = julianDayToDayOfWeek ( julianDay ) ; int dowLocal = dow - getFirstDayOfWeek ( ) + 1 ; if ( dowLocal < 1 ) { dowLocal += 7 ; } fields [ DOW_LOCAL ] = dowLocal ; }
Compute the Gregorian calendar year month and day of month from the given Julian day . These values are not stored in fields but in member variables gregorianXxx . Also compute the DAY_OF_WEEK and DOW_LOCAL fields .
26,003
private final void computeWeekFields ( ) { int eyear = fields [ EXTENDED_YEAR ] ; int dayOfWeek = fields [ DAY_OF_WEEK ] ; int dayOfYear = fields [ DAY_OF_YEAR ] ; int yearOfWeekOfYear = eyear ; int relDow = ( dayOfWeek + 7 - getFirstDayOfWeek ( ) ) % 7 ; int relDowJan1 = ( dayOfWeek - dayOfYear + 7001 - getFirstDayOfW...
Compute the fields WEEK_OF_YEAR YEAR_WOY WEEK_OF_MONTH DAY_OF_WEEK_IN_MONTH and DOW_LOCAL from EXTENDED_YEAR YEAR DAY_OF_WEEK and DAY_OF_YEAR . The latter fields are computed by the subclass based on the calendar system .
26,004
protected int resolveFields ( int [ ] [ ] [ ] precedenceTable ) { int bestField = - 1 ; int tempBestField ; for ( int g = 0 ; g < precedenceTable . length && bestField < 0 ; ++ g ) { int [ ] [ ] group = precedenceTable [ g ] ; int bestStamp = UNSET ; linesInGroup : for ( int l = 0 ; l < group . length ; ++ l ) { int [ ...
Given a precedence table return the newest field combination in the table or - 1 if none is found .
26,005
protected int newestStamp ( int first , int last , int bestStampSoFar ) { int bestStamp = bestStampSoFar ; for ( int i = first ; i <= last ; ++ i ) { if ( stamp [ i ] > bestStamp ) { bestStamp = stamp [ i ] ; } } return bestStamp ; }
Returns the newest stamp of a given range of fields .
26,006
private Long getImmediatePreviousZoneTransition ( long base ) { Long transitionTime = null ; if ( zone instanceof BasicTimeZone ) { TimeZoneTransition transition = ( ( BasicTimeZone ) zone ) . getPreviousTransition ( base , true ) ; if ( transition != null ) { transitionTime = transition . getTime ( ) ; } } else { tran...
Find the previous zone transtion near the given time .
26,007
protected int computeZoneOffset ( long millis , int millisInDay ) { int [ ] offsets = new int [ 2 ] ; long wall = millis + millisInDay ; if ( zone instanceof BasicTimeZone ) { int duplicatedTimeOpt = ( repeatedWallTime == WALLTIME_FIRST ) ? BasicTimeZone . LOCAL_FORMER : BasicTimeZone . LOCAL_LATTER ; int nonExistingTi...
This method can assume EXTENDED_YEAR has been set .
26,008
protected int computeJulianDay ( ) { if ( stamp [ JULIAN_DAY ] >= MINIMUM_USER_STAMP ) { int bestStamp = newestStamp ( ERA , DAY_OF_WEEK_IN_MONTH , UNSET ) ; bestStamp = newestStamp ( YEAR_WOY , EXTENDED_YEAR , bestStamp ) ; if ( bestStamp <= stamp [ JULIAN_DAY ] ) { return internalGet ( JULIAN_DAY ) ; } } int bestFiel...
Compute the Julian day number as specified by this calendar s fields .
26,009
protected int handleGetMonthLength ( int extendedYear , int month ) { return handleComputeMonthStart ( extendedYear , month + 1 , true ) - handleComputeMonthStart ( extendedYear , month , true ) ; }
Returns the number of days in the given month of the given extended year of this calendar system . Subclasses should override this method if they can provide a more correct or more efficient implementation than the default implementation in Calendar .
26,010
public int getIdForNamespace ( String uri ) { int index = m_values . indexOf ( uri ) ; if ( index < 0 ) { m_values . addElement ( uri ) ; return m_valueIndex ++ ; } else return index ; }
Get a prefix either from the uri mapping or just make one up!
26,011
public String getStringValue ( ) { int child = _firstch2 ( ROOTNODE ) ; if ( child == DTM . NULL ) return EMPTY_STR ; if ( ( _exptype2 ( child ) == DTM . TEXT_NODE ) && ( _nextsib2 ( child ) == DTM . NULL ) ) { int dataIndex = m_dataOrQName . elementAt ( child ) ; if ( dataIndex >= 0 ) return m_chars . getString ( data...
Returns the string value of the entire tree
26,012
protected final void copyTextNode ( final int nodeID , SerializationHandler handler ) throws SAXException { if ( nodeID != DTM . NULL ) { int dataIndex = m_dataOrQName . elementAt ( nodeID ) ; if ( dataIndex >= 0 ) { m_chars . sendSAXcharacters ( handler , dataIndex >>> TEXT_LENGTH_BITS , dataIndex & TEXT_LENGTH_MAX ) ...
Copy the String value of a Text node to a SerializationHandler
26,013
protected final String copyElement ( int nodeID , int exptype , SerializationHandler handler ) throws SAXException { final ExtendedType extType = m_extendedTypes [ exptype ] ; String uri = extType . getNamespace ( ) ; String name = extType . getLocalName ( ) ; if ( uri . length ( ) == 0 ) { handler . startElement ( nam...
Copy an Element node to a SerializationHandler .
26,014
protected final void copyNS ( final int nodeID , SerializationHandler handler , boolean inScope ) throws SAXException { if ( m_namespaceDeclSetElements != null && m_namespaceDeclSetElements . size ( ) == 1 && m_namespaceDeclSets != null && ( ( SuballocatedIntVector ) m_namespaceDeclSets . elementAt ( 0 ) ) . size ( ) =...
Copy namespace nodes .
26,015
protected final int getNextNamespaceNode2 ( int baseID ) { int type ; while ( ( type = _type2 ( ++ baseID ) ) == DTM . ATTRIBUTE_NODE ) ; if ( type == DTM . NAMESPACE_NODE ) return baseID ; else return NULL ; }
Return the next namespace node following the given base node .
26,016
protected final void copyAttributes ( final int nodeID , SerializationHandler handler ) throws SAXException { for ( int current = getFirstAttributeIdentity ( nodeID ) ; current != DTM . NULL ; current = getNextAttributeIdentity ( current ) ) { int eType = _exptype2 ( current ) ; copyAttribute ( current , eType , handle...
Copy attribute nodes from an element .
26,017
protected final void copyAttribute ( int nodeID , int exptype , SerializationHandler handler ) throws SAXException { final ExtendedType extType = m_extendedTypes [ exptype ] ; final String uri = extType . getNamespace ( ) ; final String localName = extType . getLocalName ( ) ; String prefix = null ; String qname = null...
Copy an Attribute node to a SerializationHandler
26,018
public static XNodeSet executeFilterExpr ( int context , XPathContext xctxt , PrefixResolver prefixResolver , boolean isTopLevel , int stackFrame , Expression expr ) throws org . apache . xml . utils . WrappedRuntimeException { PrefixResolver savedResolver = xctxt . getNamespaceContext ( ) ; XNodeSet result = null ; tr...
Execute the expression . Meant for reuse by other FilterExpr iterators that are not derived from this object .
26,019
public void characters ( char [ ] ch , int start , int length ) throws org . xml . sax . SAXException { m_char . append ( ch , start , length ) ; }
Replaces the deprecated DocumentHandler interface .
26,020
private void processAccumulatedText ( ) { int len = m_char . length ( ) ; if ( len != m_char_current_start ) { appendTextChild ( m_char_current_start , len - m_char_current_start ) ; m_char_current_start = len ; } }
Flush string accumulation into a text node
26,021
public int getFirstAttribute ( int nodeHandle ) { nodeHandle &= NODEHANDLE_MASK ; if ( ELEMENT_NODE != ( nodes . readEntry ( nodeHandle , 0 ) & 0xFFFF ) ) return NULL ; nodeHandle ++ ; return ( ATTRIBUTE_NODE == ( nodes . readEntry ( nodeHandle , 0 ) & 0xFFFF ) ) ? nodeHandle | m_docHandle : NULL ; }
Given a node handle get the index of the node s first attribute .
26,022
public int getNextSibling ( int nodeHandle ) { nodeHandle &= NODEHANDLE_MASK ; if ( nodeHandle == 0 ) return NULL ; short type = ( short ) ( nodes . readEntry ( nodeHandle , 0 ) & 0xFFFF ) ; if ( ( type == ELEMENT_NODE ) || ( type == ATTRIBUTE_NODE ) || ( type == ENTITY_REFERENCE_NODE ) ) { int nextSib = nodes . readEn...
Given a node handle advance to its next sibling .
26,023
public int getNextAttribute ( int nodeHandle ) { nodeHandle &= NODEHANDLE_MASK ; nodes . readSlot ( nodeHandle , gotslot ) ; short type = ( short ) ( gotslot [ 0 ] & 0xFFFF ) ; if ( type == ELEMENT_NODE ) { return getFirstAttribute ( nodeHandle ) ; } else if ( type == ATTRIBUTE_NODE ) { if ( gotslot [ 2 ] != NULL ) ret...
Given a node handle advance to the next attribute . If an element we advance to its first attribute ; if an attr we advance to the next attr on the same node .
26,024
public int getNextDescendant ( int subtreeRootHandle , int nodeHandle ) { subtreeRootHandle &= NODEHANDLE_MASK ; nodeHandle &= NODEHANDLE_MASK ; if ( nodeHandle == 0 ) return NULL ; while ( ! m_isError ) { if ( done && ( nodeHandle > nodes . slotsUsed ( ) ) ) break ; if ( nodeHandle > subtreeRootHandle ) { nodes . read...
Given a node handle advance to its next descendant . If not yet resolved waits for more nodes to be added to the document and tries again .
26,025
public int getNextPreceding ( int axisContextHandle , int nodeHandle ) { nodeHandle &= NODEHANDLE_MASK ; while ( nodeHandle > 1 ) { nodeHandle -- ; if ( ATTRIBUTE_NODE == ( nodes . readEntry ( nodeHandle , 0 ) & 0xFFFF ) ) continue ; return ( m_docHandle | nodes . specialFind ( axisContextHandle , nodeHandle ) ) ; } re...
Given a node handle advance to the next node on the preceding axis .
26,026
public String getLocalNameFromExpandedNameID ( int ExpandedNameID ) { String expandedName = m_localNames . indexToString ( ExpandedNameID ) ; int colonpos = expandedName . indexOf ( ":" ) ; String localName = expandedName . substring ( colonpos + 1 ) ; return localName ; }
Given an expanded - name ID return the local name part .
26,027
public void appendChild ( int newChild , boolean clone , boolean cloneDepth ) { boolean sameDoc = ( ( newChild & DOCHANDLE_MASK ) == m_docHandle ) ; if ( clone || ! sameDoc ) { } else { } }
Append a child to the end of the child list of the current node . Please note that the node is always cloned if it is owned by another document .
26,028
void appendEndElement ( ) { if ( previousSiblingWasParent ) nodes . writeEntry ( previousSibling , 2 , NULL ) ; previousSibling = currentParent ; nodes . readSlot ( currentParent , gotslot ) ; currentParent = gotslot [ 1 ] & 0xFFFF ; previousSiblingWasParent = true ; }
Terminate the element currently acting as an insertion point . Subsequent insertions will occur as the last child of this element s parent .
26,029
private void readDoctype ( boolean saveDtdText ) throws IOException , XmlPullParserException { read ( START_DOCTYPE ) ; int startPosition = - 1 ; if ( saveDtdText ) { bufferCapture = new StringBuilder ( ) ; startPosition = position ; } try { skip ( ) ; rootElementName = readName ( ) ; readExternalId ( true , true ) ; s...
Read the document s DTD . Although this parser is non - validating the DTD must be parsed to capture entity values and default attribute values .
26,030
public int nextTag ( ) throws XmlPullParserException , IOException { next ( ) ; if ( type == TEXT && isWhitespace ) { next ( ) ; } if ( type != END_TAG && type != START_TAG ) { throw new XmlPullParserException ( "unexpected type" , this , null ) ; } return type ; }
utility methods to make XML parsing easier ...
26,031
private void popContentSource ( ) { buffer = nextContentSource . buffer ; position = nextContentSource . position ; limit = nextContentSource . limit ; nextContentSource = nextContentSource . next ; }
Replaces the current exhausted buffer with the next buffer in the chain .
26,032
private String getStringForDay ( int day ) { if ( fDates == null ) { loadDates ( ) ; } for ( URelativeString dayItem : fDates ) { if ( dayItem . offset == day ) { return dayItem . string ; } } return null ; }
Get the string at a specific offset .
26,033
private synchronized void loadDates ( ) { ICUResourceBundle rb = ( ICUResourceBundle ) UResourceBundle . getBundleInstance ( ICUData . ICU_BASE_NAME , fLocale ) ; fDates = new ArrayList < URelativeString > ( ) ; RelDateFmtDataSink sink = new RelDateFmtDataSink ( ) ; rb . getAllItemsWithFallback ( "fields/day/relative" ...
Load the Date string array
26,034
private void initCapitalizationContextInfo ( ULocale locale ) { ICUResourceBundle rb = ( ICUResourceBundle ) UResourceBundle . getBundleInstance ( ICUData . ICU_BASE_NAME , locale ) ; try { ICUResourceBundle rdb = rb . getWithFallback ( "contextTransforms/relative" ) ; int [ ] intVector = rdb . getIntVector ( ) ; if ( ...
Set capitalizationOfRelativeUnitsForListOrMenu capitalizationOfRelativeUnitsForStandAlone
26,035
private Calendar initializeCalendar ( TimeZone zone , ULocale locale ) { if ( calendar == null ) { if ( zone == null ) { calendar = Calendar . getInstance ( locale ) ; } else { calendar = Calendar . getInstance ( zone , locale ) ; } } return calendar ; }
initializes fCalendar from parameters . Returns fCalendar as a convenience .
26,036
public TimeZoneFormat setTimeZoneNames ( TimeZoneNames tznames ) { if ( isFrozen ( ) ) { throw new UnsupportedOperationException ( "Attempt to modify frozen object" ) ; } _tznames = tznames ; _gnames = new TimeZoneGenericNames ( _locale , _tznames ) ; return this ; }
Sets the time zone display name data to this instance .
26,037
public TimeZoneFormat setGMTOffsetPattern ( GMTOffsetPatternType type , String pattern ) { if ( isFrozen ( ) ) { throw new UnsupportedOperationException ( "Attempt to modify frozen object" ) ; } if ( pattern == null ) { throw new NullPointerException ( "Null GMT offset pattern" ) ; } Object [ ] parsedItems = parseOffse...
Sets the offset pattern for the given offset type .
26,038
public String getGMTOffsetDigits ( ) { StringBuilder buf = new StringBuilder ( _gmtOffsetDigits . length ) ; for ( String digit : _gmtOffsetDigits ) { buf . append ( digit ) ; } return buf . toString ( ) ; }
Returns the decimal digit characters used for localized GMT format in a single string containing from 0 to 9 in the ascending order .
26,039
public TimeZoneFormat setGMTOffsetDigits ( String digits ) { if ( isFrozen ( ) ) { throw new UnsupportedOperationException ( "Attempt to modify frozen object" ) ; } if ( digits == null ) { throw new NullPointerException ( "Null GMT offset digits" ) ; } String [ ] digitArray = toCodePoints ( digits ) ; if ( digitArray ....
Sets the decimal digit characters used for localized GMT format .
26,040
public final String formatOffsetISO8601Basic ( int offset , boolean useUtcIndicator , boolean isShort , boolean ignoreSeconds ) { return formatOffsetISO8601 ( offset , true , useUtcIndicator , isShort , ignoreSeconds ) ; }
Returns the ISO 8601 basic time zone string for the given offset . For example - 08 - 0830 and Z
26,041
public final String format ( Style style , TimeZone tz , long date ) { return format ( style , tz , date , null ) ; }
Returns the display name of the time zone at the given date for the style .
26,042
private String formatOffsetLocalizedGMT ( int offset , boolean isShort ) { if ( offset == 0 ) { return _gmtZeroFormat ; } StringBuilder buf = new StringBuilder ( ) ; boolean positive = true ; if ( offset < 0 ) { offset = - offset ; positive = false ; } int offsetH = offset / MILLIS_PER_HOUR ; offset = offset % MILLIS_P...
Private method used for localized GMT formatting .
26,043
private String formatSpecific ( TimeZone tz , NameType stdType , NameType dstType , long date , Output < TimeType > timeType ) { assert ( stdType == NameType . LONG_STANDARD || stdType == NameType . SHORT_STANDARD ) ; assert ( dstType == NameType . LONG_DAYLIGHT || dstType == NameType . SHORT_DAYLIGHT ) ; boolean isDay...
Private method returning the time zone s specific format string .
26,044
private String formatExemplarLocation ( TimeZone tz ) { String location = getTimeZoneNames ( ) . getExemplarLocationName ( ZoneMeta . getCanonicalCLDRID ( tz ) ) ; if ( location == null ) { location = getTimeZoneNames ( ) . getExemplarLocationName ( UNKNOWN_ZONE_ID ) ; if ( location == null ) { location = UNKNOWN_LOCAT...
Private method returning the time zone s exemplar location string . This method will never return null .
26,045
private String getTimeZoneID ( String tzID , String mzID ) { String id = tzID ; if ( id == null ) { assert ( mzID != null ) ; id = _tznames . getReferenceZoneID ( mzID , getTargetRegion ( ) ) ; if ( id == null ) { throw new IllegalArgumentException ( "Invalid mzID: " + mzID ) ; } } return id ; }
Private method returns a time zone ID . If tzID is not null the value of tzID is returned . If tzID is null then this method look up a time zone ID for the current region . This is a small helper method used by the parse implementation method
26,046
private synchronized String getTargetRegion ( ) { if ( _region == null ) { _region = _locale . getCountry ( ) ; if ( _region . length ( ) == 0 ) { ULocale tmp = ULocale . addLikelySubtags ( _locale ) ; _region = tmp . getCountry ( ) ; if ( _region . length ( ) == 0 ) { _region = "001" ; } } } return _region ; }
Private method returning the target region . The target regions is determined by the locale of this instance . When a generic name is coming from a meta zone this region is used for checking if the time zone is a reference zone of the meta zone .
26,047
private TimeType getTimeType ( NameType nameType ) { switch ( nameType ) { case LONG_STANDARD : case SHORT_STANDARD : return TimeType . STANDARD ; case LONG_DAYLIGHT : case SHORT_DAYLIGHT : return TimeType . DAYLIGHT ; default : return TimeType . UNKNOWN ; } }
Returns the time type for the given name type
26,048
private static String unquote ( String s ) { if ( s . indexOf ( '\'' ) < 0 ) { return s ; } boolean isPrevQuote = false ; boolean inQuote = false ; StringBuilder buf = new StringBuilder ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( c == '\'' ) { if ( isPrevQuote ) { buf . append...
Unquotes the message format style pattern .
26,049
private TimeZone getTimeZoneForOffset ( int offset ) { if ( offset == 0 ) { return TimeZone . getTimeZone ( TZID_GMT ) ; } return ZoneMeta . getCustomTimeZone ( offset ) ; }
Creates an instance of TimeZone for the given offset
26,050
private int parseOffsetLocalizedGMTPattern ( String text , int start , boolean isShort , int [ ] parsedLen ) { int idx = start ; int offset = 0 ; boolean parsed = false ; do { int len = _gmtPatternPrefix . length ( ) ; if ( len > 0 && ! text . regionMatches ( true , idx , _gmtPatternPrefix , 0 , len ) ) { break ; } idx...
Parse localized GMT format generated by the pattern used by this formatter except GMT Zero format .
26,051
private int parseOffsetFields ( String text , int start , boolean isShort , int [ ] parsedLen ) { int outLen = 0 ; int offset = 0 ; int sign = 1 ; if ( parsedLen != null && parsedLen . length >= 1 ) { parsedLen [ 0 ] = 0 ; } int offsetH , offsetM , offsetS ; offsetH = offsetM = offsetS = 0 ; int [ ] fields = { 0 , 0 , ...
Parses localized GMT offset fields into offset .
26,052
private int parseOffsetFieldsWithPattern ( String text , int start , Object [ ] patternItems , boolean forceSingleHourDigit , int fields [ ] ) { assert ( fields != null && fields . length >= 3 ) ; fields [ 0 ] = fields [ 1 ] = fields [ 2 ] = 0 ; boolean failed = false ; int offsetH , offsetM , offsetS ; offsetH = offse...
Parses localized GMT offset fields with the given pattern
26,053
private int parseDefaultOffsetFields ( String text , int start , char separator , int [ ] parsedLen ) { int max = text . length ( ) ; int idx = start ; int [ ] len = { 0 } ; int hour = 0 , min = 0 , sec = 0 ; do { hour = parseOffsetFieldWithLocalizedDigits ( text , idx , 1 , 2 , 0 , MAX_OFFSET_HOUR , len ) ; if ( len [...
Parses the input GMT offset fields with the default offset pattern .
26,054
private int parseSingleLocalizedDigit ( String text , int start , int [ ] len ) { int digit = - 1 ; len [ 0 ] = 0 ; if ( start < text . length ( ) ) { int cp = Character . codePointAt ( text , start ) ; for ( int i = 0 ; i < _gmtOffsetDigits . length ; i ++ ) { if ( cp == _gmtOffsetDigits [ i ] . codePointAt ( 0 ) ) { ...
Reads a single decimal digit either localized digits used by this object or any Unicode numeric character .
26,055
private static String parseZoneID ( String text , ParsePosition pos ) { String resolvedID = null ; if ( ZONE_ID_TRIE == null ) { synchronized ( TimeZoneFormat . class ) { if ( ZONE_ID_TRIE == null ) { TextTrieMap < String > trie = new TextTrieMap < String > ( true ) ; String [ ] ids = TimeZone . getAvailableIDs ( ) ; f...
Parse a zone ID .
26,056
private static String parseShortZoneID ( String text , ParsePosition pos ) { String resolvedID = null ; if ( SHORT_ZONE_ID_TRIE == null ) { synchronized ( TimeZoneFormat . class ) { if ( SHORT_ZONE_ID_TRIE == null ) { TextTrieMap < String > trie = new TextTrieMap < String > ( true ) ; Set < String > canonicalIDs = Time...
Parse a short zone ID .
26,057
private String parseExemplarLocation ( String text , ParsePosition pos ) { int startIdx = pos . getIndex ( ) ; int parsedPos = - 1 ; String tzID = null ; EnumSet < NameType > nameTypes = EnumSet . of ( NameType . EXEMPLAR_LOCATION ) ; Collection < MatchInfo > exemplarMatches = _tznames . find ( text , startIdx , nameTy...
Parse an exemplar location string .
26,058
private List < String > initLabels ( ) { Normalizer2 nfkdNormalizer = Normalizer2 . getNFKDInstance ( ) ; List < String > indexCharacters = new ArrayList < String > ( ) ; String firstScriptBoundary = firstCharsInScripts . get ( 0 ) ; String overflowBoundary = firstCharsInScripts . get ( firstCharsInScripts . size ( ) -...
Determine the best labels to use . This is based on the exemplars but we also process to make sure that they are unique and sort differently and that the overall list is small enough .
26,059
private void addIndexExemplars ( ULocale locale ) { UnicodeSet exemplars = LocaleData . getExemplarSet ( locale , 0 , LocaleData . ES_INDEX ) ; if ( exemplars != null ) { initialLabels . addAll ( exemplars ) ; return ; } exemplars = LocaleData . getExemplarSet ( locale , 0 , LocaleData . ES_STANDARD ) ; exemplars = exe...
This method is called to get the index exemplars . Normally these come from the locale directly but if they aren t available we have to synthesize them .
26,060
private boolean addChineseIndexCharacters ( ) { UnicodeSet contractions = new UnicodeSet ( ) ; try { collatorPrimaryOnly . internalAddContractions ( BASE . charAt ( 0 ) , contractions ) ; } catch ( Exception e ) { return false ; } if ( contractions . isEmpty ( ) ) { return false ; } initialLabels . addAll ( contraction...
Add Chinese index characters from the tailoring .
26,061
public ImmutableIndex < V > buildImmutableIndex ( ) { BucketList < V > immutableBucketList ; if ( inputList != null && ! inputList . isEmpty ( ) ) { immutableBucketList = createBucketList ( ) ; } else { if ( buckets == null ) { buckets = createBucketList ( ) ; } immutableBucketList = buckets ; } return new ImmutableInd...
Builds an immutable thread - safe version of this instance without data records .
26,062
public List < String > getBucketLabels ( ) { initBuckets ( ) ; ArrayList < String > result = new ArrayList < String > ( ) ; for ( Bucket < V > bucket : buckets ) { result . add ( bucket . getLabel ( ) ) ; } return result ; }
Get the labels .
26,063
public AlphabeticIndex < V > clearRecords ( ) { if ( inputList != null && ! inputList . isEmpty ( ) ) { inputList . clear ( ) ; buckets = null ; } return this ; }
Clear the index .
26,064
private void initBuckets ( ) { if ( buckets != null ) { return ; } buckets = createBucketList ( ) ; if ( inputList == null || inputList . isEmpty ( ) ) { return ; } Collections . sort ( inputList , recordComparator ) ; Iterator < Bucket < V > > bucketIterator = buckets . fullIterator ( ) ; Bucket < V > currentBucket = ...
Creates an index and buckets and sorts the list of records into the index .
26,065
private static boolean isOneLabelBetterThanOther ( Normalizer2 nfkdNormalizer , String one , String other ) { String n1 = nfkdNormalizer . normalize ( one ) ; String n2 = nfkdNormalizer . normalize ( other ) ; int result = n1 . codePointCount ( 0 , n1 . length ( ) ) - n2 . codePointCount ( 0 , n2 . length ( ) ) ; if ( ...
Returns true if one index character string is better than the other . Shorter NFKD is better and otherwise NFKD - binary - less - than is better and otherwise binary - less - than is better .
26,066
public List < String > getFirstCharactersInScripts ( ) { List < String > dest = new ArrayList < String > ( 200 ) ; UnicodeSet set = new UnicodeSet ( ) ; collatorPrimaryOnly . internalAddContractions ( 0xFDD1 , set ) ; if ( set . isEmpty ( ) ) { throw new UnsupportedOperationException ( "AlphabeticIndex requires script-...
Return a list of the first character in each script . Only exposed for testing .
26,067
synchronized void establishConnection ( ) throws IOException { if ( isConnected ) { throw new IOException ( "Pipe already connected" ) ; } if ( buffer == null ) { buffer = new byte [ PipedInputStream . PIPE_SIZE ] ; } isConnected = true ; }
Establishes the connection to the PipedOutputStream .
26,068
static Object encodeRelay ( Object r ) { Throwable x ; return ( ( ( r instanceof AltResult ) && ( x = ( ( AltResult ) r ) . ex ) != null && ! ( x instanceof CompletionException ) ) ? new AltResult ( new CompletionException ( x ) ) : r ) ; }
Returns the encoding of a copied outcome ; if exceptional rewraps as a CompletionException else returns argument .
26,069
final void postComplete ( ) { CompletableFuture < ? > f = this ; Completion h ; while ( ( h = f . stack ) != null || ( f != this && ( h = ( f = this ) . stack ) != null ) ) { CompletableFuture < ? > d ; Completion t ; if ( f . casStack ( h , t = h . next ) ) { if ( t != null ) { if ( f != this ) { pushStack ( h ) ; con...
Pops and tries to trigger all reachable dependents . Call only when known to be done .
26,070
final void cleanStack ( ) { for ( Completion p = null , q = stack ; q != null ; ) { Completion s = q . next ; if ( q . isLive ( ) ) { p = q ; q = s ; } else if ( p == null ) { casStack ( q , s ) ; q = stack ; } else { p . next = s ; if ( p . isLive ( ) ) q = s ; else { p = null ; q = stack ; } } } }
Traverses stack and unlinks dead Completions .
26,071
final CompletableFuture < T > postFire ( CompletableFuture < ? > a , int mode ) { if ( a != null && a . stack != null ) { if ( mode < 0 || a . result == null ) a . cleanStack ( ) ; else a . postComplete ( ) ; } if ( result != null && stack != null ) { if ( mode < 0 ) return this ; else postComplete ( ) ; } return null ...
Post - processing by dependent after successful UniCompletion tryFire . Tries to clean stack of source a and then either runs postComplete or returns this to caller depending on mode .
26,072
final void bipush ( CompletableFuture < ? > b , BiCompletion < ? , ? , ? > c ) { if ( c != null ) { Object r ; while ( ( r = result ) == null && ! tryPushStack ( c ) ) lazySetNext ( c , null ) ; if ( b != null && b != this && b . result == null ) { Completion q = ( r != null ) ? c : new CoCompletion ( c ) ; while ( b ....
Pushes completion to this and b unless both done .
26,073
final void orpush ( CompletableFuture < ? > b , BiCompletion < ? , ? , ? > c ) { if ( c != null ) { while ( ( b == null || b . result == null ) && result == null ) { if ( tryPushStack ( c ) ) { if ( b != null && b != this && b . result == null ) { Completion q = new CoCompletion ( c ) ; while ( result == null && b . re...
Pushes completion to this and b unless either done .
26,074
private Object timedGet ( long nanos ) throws TimeoutException { if ( Thread . interrupted ( ) ) return null ; if ( nanos > 0L ) { long d = System . nanoTime ( ) + nanos ; long deadline = ( d == 0L ) ? 1L : d ; Signaller q = null ; boolean queued = false ; Object r ; while ( ( r = result ) == null ) { if ( q == null ) ...
Returns raw result after waiting or null if interrupted or throws TimeoutException on timeout .
26,075
public T get ( ) throws InterruptedException , ExecutionException { Object r ; return reportGet ( ( r = result ) == null ? waitingGet ( true ) : r ) ; }
Waits if necessary for this future to complete and then returns its result .
26,076
protected void reportError ( String msg , Exception ex , int code ) { try { errorManager . error ( msg , ex , code ) ; } catch ( Exception ex2 ) { System . err . println ( "Handler.reportError caught:" ) ; ex2 . printStackTrace ( ) ; } }
Protected convenience method to report an error to this Handler s ErrorManager . Note that this method retrieves and uses the ErrorManager without doing a security check . It can therefore be used in environments where the caller may be non - privileged .
26,077
public void compute ( ) { Spliterator < P_IN > rs = spliterator , ls ; long sizeEstimate = rs . estimateSize ( ) ; long sizeThreshold = getTargetSize ( sizeEstimate ) ; boolean forkRight = false ; @ SuppressWarnings ( "unchecked" ) K task = ( K ) this ; AtomicReference < R > sr = sharedResult ; R result ; while ( ( res...
Overrides AbstractTask version to include checks for early exits while splitting or computing .
26,078
public R getLocalResult ( ) { if ( isRoot ( ) ) { R answer = sharedResult . get ( ) ; return ( answer == null ) ? getEmptyResult ( ) : answer ; } else return super . getLocalResult ( ) ; }
Retrieves the local result for this task . If this task is the root retrieves the shared result instead .
26,079
protected boolean taskCanceled ( ) { boolean cancel = canceled ; if ( ! cancel ) { for ( K parent = getParent ( ) ; ! cancel && parent != null ; parent = parent . getParent ( ) ) cancel = parent . canceled ; } return cancel ; }
Queries whether this task is canceled . A task is considered canceled if it or any of its parents have been canceled .
26,080
protected void cancelLaterNodes ( ) { for ( @ SuppressWarnings ( "unchecked" ) K parent = getParent ( ) , node = ( K ) this ; parent != null ; node = parent , parent = parent . getParent ( ) ) { if ( parent . leftChild == node ) { K rightSibling = parent . rightChild ; if ( ! rightSibling . canceled ) rightSibling . ca...
Cancels all tasks which succeed this one in the encounter order . This includes canceling all the current task s right sibling as well as the later right siblings of all its parents .
26,081
private Map < ExecutableElement , VariableElement > createMemberFields ( AnnotationTypeDeclaration node , List < AnnotationTypeMemberDeclaration > members ) { TypeElement type = node . getTypeElement ( ) ; Map < ExecutableElement , VariableElement > fieldElements = new HashMap < > ( ) ; for ( AnnotationTypeMemberDeclar...
Create an instance field for each member .
26,082
private void addMemberProperties ( AnnotationTypeDeclaration node , List < AnnotationTypeMemberDeclaration > members , Map < ExecutableElement , VariableElement > fieldElements ) { if ( members . isEmpty ( ) ) { return ; } StringBuilder propertyDecls = new StringBuilder ( ) ; StringBuilder propertyImpls = new StringBui...
Generate the property declarations and synthesize statements .
26,083
private void addDefaultAccessors ( AnnotationTypeDeclaration node , List < AnnotationTypeMemberDeclaration > members ) { TypeElement type = node . getTypeElement ( ) ; for ( AnnotationTypeMemberDeclaration member : members ) { ExecutableElement memberElement = member . getExecutableElement ( ) ; AnnotationValue default...
Create accessors for properties that have default values .
26,084
public void setComment ( String comment ) { if ( comment == null ) { this . comment = null ; return ; } if ( comment . getBytes ( StandardCharsets . UTF_8 ) . length > 0xffff ) { throw new IllegalArgumentException ( comment + " too long: " + comment . getBytes ( StandardCharsets . UTF_8 ) . length ) ; } this . comment ...
Sets the optional comment string for the entry .
26,085
public String getFunction ( int i ) throws ArrayIndexOutOfBoundsException { if ( null == m_functions ) throw new ArrayIndexOutOfBoundsException ( ) ; return ( String ) m_functions . elementAt ( i ) ; }
Get a function at a given index in this extension element
26,086
public String getElement ( int i ) throws ArrayIndexOutOfBoundsException { if ( null == m_elements ) throw new ArrayIndexOutOfBoundsException ( ) ; return ( String ) m_elements . elementAt ( i ) ; }
Get the element at the given index
26,087
public static CompactDecimalFormat getInstance ( Locale locale , CompactStyle style ) { return new CompactDecimalFormat ( ULocale . forLocale ( locale ) , style ) ; }
Create a CompactDecimalFormat appropriate for a locale . The result may be affected by the number system in the locale such as ar - u - nu - latn .
26,088
private Data getData ( ULocale locale , CompactStyle style ) { CompactDecimalDataCache . DataBundle bundle = cache . get ( locale ) ; switch ( style ) { case SHORT : return bundle . shortData ; case LONG : return bundle . longData ; default : return bundle . shortData ; } }
Gets the data for a particular locale and style . If style is unrecognized we just return data for CompactStyle . SHORT .
26,089
private Data getCurrencyData ( ULocale locale ) { CompactDecimalDataCache . DataBundle bundle = cache . get ( locale ) ; return bundle . shortCurrencyData ; }
Gets the currency data for a particular locale . Currently only short currency format is supported since that is the only form in CLDR .
26,090
public double getNumberFromNode ( int n ) { XMLString xstr = m_dtmMgr . getDTM ( n ) . getStringValue ( n ) ; return xstr . toDouble ( ) ; }
Get numeric value of the string conversion from a single node .
26,091
public double numWithSideEffects ( ) { int node = nextNode ( ) ; return ( node != DTM . NULL ) ? getNumberFromNode ( node ) : Double . NaN ; }
Cast result object to a number but allow side effects such as the incrementing of an iterator .
26,092
public XMLString getStringFromNode ( int n ) { if ( DTM . NULL != n ) { return m_dtmMgr . getDTM ( n ) . getStringValue ( n ) ; } else { return org . apache . xpath . objects . XString . EMPTYSTRING ; } }
Get the string conversion from a single node .
26,093
public XObject getFresh ( ) { try { if ( hasCache ( ) ) return ( XObject ) cloneWithReset ( ) ; else return this ; } catch ( CloneNotSupportedException cnse ) { throw new RuntimeException ( cnse . getMessage ( ) ) ; } }
Get a fresh copy of the object . For use with variables .
26,094
public NodeSetDTM mutableNodeset ( ) { NodeSetDTM mnl ; if ( m_obj instanceof NodeSetDTM ) { mnl = ( NodeSetDTM ) m_obj ; } else { mnl = new NodeSetDTM ( iter ( ) ) ; setObject ( mnl ) ; setCurrentPos ( 0 ) ; } return mnl ; }
Cast result object to a mutableNodeset .
26,095
public static java . util . TimeZone wrap ( android . icu . util . TimeZone tz ) { return new TimeZoneAdapter ( tz ) ; }
Given a java . util . TimeZone wrap it in the appropriate adapter subclass of android . icu . util . TimeZone and return the adapter .
26,096
public DTMAxisTraverser getAxisTraverser ( final int axis ) { DTMAxisTraverser traverser ; if ( null == m_traversers ) { m_traversers = new DTMAxisTraverser [ Axis . getNamesLength ( ) ] ; traverser = null ; } else { traverser = m_traversers [ axis ] ; if ( traverser != null ) return traverser ; } switch ( axis ) { cas...
This returns a stateless traverser that can navigate over an XPath axis though perhaps not in document order .
26,097
public boolean translateReadyOps ( int ops , int initialOps , SelectionKeyImpl sk ) { int intOps = sk . nioInterestOps ( ) ; int oldOps = sk . nioReadyOps ( ) ; int newOps = initialOps ; if ( ( ops & PollArrayWrapper . POLLNVAL ) != 0 ) { return false ; } if ( ( ops & ( PollArrayWrapper . POLLERR | PollArrayWrapper . P...
Translates native poll revent ops into a ready operation ops
26,098
public void comment ( String data ) throws org . xml . sax . SAXException { final int length = data . length ( ) ; if ( length > m_charsBuff . length ) { m_charsBuff = new char [ length * 2 + 1 ] ; } data . getChars ( 0 , length , m_charsBuff , 0 ) ; comment ( m_charsBuff , 0 , length ) ; }
Called when a Comment is to be constructed . Note that Xalan will normally invoke the other version of this method . %REVIEW% In fact is this one ever needed or was it a mistake?
26,099
private void openFiles ( ) throws IOException { LogManager manager = LogManager . getLogManager ( ) ; manager . checkPermission ( ) ; if ( count < 1 ) { throw new IllegalArgumentException ( "file count = " + count ) ; } if ( limit < 0 ) { limit = 0 ; } InitializationErrorManager em = new InitializationErrorManager ( ) ...
configured instance variables .