idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
28,000
public boolean [ ] toBooleanArray ( ) { boolean [ ] bits = new boolean [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { bits [ i ] = get ( i ) ; } return bits ; }
Return a boolean array with the same bit values a this BitArray .
28,001
public void getCalendarDateFromFixedDate ( CalendarDate date , long fixedDate ) { Date gdate = ( Date ) date ; int year ; long jan1 ; boolean isLeap ; if ( gdate . hit ( fixedDate ) ) { year = gdate . getCachedYear ( ) ; jan1 = gdate . getCachedJan1 ( ) ; isLeap = isLeapYear ( year ) ; } else { year = getGregorianYearF...
should be protected
28,002
final int getGregorianYearFromFixedDate ( long fixedDate ) { long d0 ; int d1 , d2 , d3 , d4 ; int n400 , n100 , n4 , n1 ; int year ; if ( fixedDate > 0 ) { d0 = fixedDate - 1 ; n400 = ( int ) ( d0 / 146097 ) ; d1 = ( int ) ( d0 % 146097 ) ; n100 = d1 / 36524 ; d2 = d1 % 36524 ; n4 = d2 / 1461 ; d3 = d2 % 1461 ; n1 = d...
Returns the Gregorian year number of the given fixed date .
28,003
public void setMaximumFractionDigits ( int newValue ) { maximumFractionDigits = Math . max ( 0 , newValue ) ; if ( maximumFractionDigits < minimumFractionDigits ) { minimumFractionDigits = maximumFractionDigits ; } }
Sets the maximum number of digits allowed in the fraction portion of a number . maximumFractionDigits must be > = minimumFractionDigits . If the new value for maximumFractionDigits is less than the current value of minimumFractionDigits then minimumFractionDigits will also be set to the new value .
28,004
private static void adjustForCurrencyDefaultFractionDigits ( DecimalFormat format , DecimalFormatSymbols symbols ) { Currency currency = symbols . getCurrency ( ) ; if ( currency == null ) { try { currency = Currency . getInstance ( symbols . getInternationalCurrencySymbol ( ) ) ; } catch ( IllegalArgumentException e )...
Adjusts the minimum and maximum fraction digits to values that are reasonable for the currency s default fraction digits .
28,005
public synchronized void write ( byte [ ] buf , int off , int len ) throws IOException { super . write ( buf , off , len ) ; crc . update ( buf , off , len ) ; }
Writes array of bytes to the compressed output stream . This method will block until all the bytes are written .
28,006
public void finish ( ) throws IOException { if ( ! def . finished ( ) ) { def . finish ( ) ; while ( ! def . finished ( ) ) { int len = def . deflate ( buf , 0 , buf . length ) ; if ( def . finished ( ) && len <= buf . length - TRAILER_SIZE ) { writeTrailer ( buf , len ) ; len = len + TRAILER_SIZE ; out . write ( buf ,...
Finishes writing compressed data to the output stream without closing the underlying stream . Use this method when applying multiple filters in succession to the same output stream .
28,007
public Date firstBetween ( Date start , Date end ) { return doFirstBetween ( start , end ) ; }
Return the first occurrence of this rule on or after the given start date and before the given end date .
28,008
public boolean isOn ( Date date ) { synchronized ( calendar ) { calendar . setTime ( date ) ; int dayOfYear = calendar . get ( Calendar . DAY_OF_YEAR ) ; calendar . setTime ( computeInYear ( calendar . getTime ( ) , calendar ) ) ; return calendar . get ( Calendar . DAY_OF_YEAR ) == dayOfYear ; } }
Return true if the given Date is on the same day as Easter
28,009
public boolean isBetween ( Date start , Date end ) { return firstBetween ( start , end ) != null ; }
Return true if Easter occurs between the two dates given
28,010
private static ZoneRulesProvider getProvider ( String zoneId ) { ZoneRulesProvider provider = ZONES . get ( zoneId ) ; if ( provider == null ) { if ( ZONES . isEmpty ( ) ) { throw new ZoneRulesException ( "No time-zone data files registered" ) ; } throw new ZoneRulesException ( "Unknown time-zone ID: " + zoneId ) ; } r...
Gets the provider for the zone ID .
28,011
public StringBuilder formatMeasurePerUnit ( Measure measure , MeasureUnit perUnit , StringBuilder appendTo , FieldPosition pos ) { MeasureUnit resolvedUnit = MeasureUnit . resolveUnitPerUnit ( measure . getUnit ( ) , perUnit ) ; if ( resolvedUnit != null ) { Measure newMeasure = new Measure ( measure . getNumber ( ) , ...
Formats a single measure per unit .
28,012
public StringBuilder formatMeasures ( StringBuilder appendTo , FieldPosition fieldPosition , Measure ... measures ) { if ( measures . length == 0 ) { return appendTo ; } if ( measures . length == 1 ) { return formatMeasure ( measures [ 0 ] , numberFormat , appendTo , fieldPosition ) ; } if ( formatWidth == FormatWidth ...
Formats a sequence of measures .
28,013
private static MeasureFormatData loadLocaleData ( ULocale locale ) { ICUResourceBundle resource = ( ICUResourceBundle ) UResourceBundle . getBundleInstance ( ICUData . ICU_UNIT_BASE_NAME , locale ) ; MeasureFormatData cacheData = new MeasureFormatData ( ) ; UnitDataSink sink = new UnitDataSink ( cacheData ) ; resource ...
Returns formatting data for all MeasureUnits except for currency ones .
28,014
private static DateFormat loadNumericDurationFormat ( ICUResourceBundle r , String type ) { r = r . getWithFallback ( String . format ( "durationUnits/%s" , type ) ) ; DateFormat result = new SimpleDateFormat ( r . getString ( ) . replace ( "h" , "H" ) ) ; result . setTimeZone ( TimeZone . GMT_ZONE ) ; return result ; ...
type is one of hm ms or hms
28,015
private static Number [ ] toHMS ( Measure [ ] measures ) { Number [ ] result = new Number [ 3 ] ; int lastIdx = - 1 ; for ( Measure m : measures ) { if ( m . getNumber ( ) . doubleValue ( ) < 0.0 ) { return null ; } Integer idxObj = hmsTo012 . get ( m . getUnit ( ) ) ; if ( idxObj == null ) { return null ; } int idx = ...
returned array will be null .
28,016
private StringBuilder formatNumeric ( Number [ ] hms , StringBuilder appendable ) { int startIndex = - 1 ; int endIndex = - 1 ; for ( int i = 0 ; i < hms . length ; i ++ ) { if ( hms [ i ] != null ) { endIndex = i ; if ( startIndex == - 1 ) { startIndex = endIndex ; } } else { hms [ i ] = Integer . valueOf ( 0 ) ; } } ...
values in hms with 0 .
28,017
private StringBuilder formatNumeric ( Date duration , DateFormat formatter , DateFormat . Field smallestField , Number smallestAmount , StringBuilder appendTo ) { String smallestAmountFormatted ; FieldPosition intFieldPosition = new FieldPosition ( NumberFormat . INTEGER_FIELD ) ; smallestAmountFormatted = numberFormat...
appendTo is where the formatted string is appended .
28,018
public String getMessage ( ) { String message = super . getMessage ( ) ; if ( message == null && exception != null ) { return exception . getMessage ( ) ; } else { return message ; } }
Return a detail message for this exception .
28,019
public static PluralRules parseDescription ( String description ) throws ParseException { description = description . trim ( ) ; return description . length ( ) == 0 ? DEFAULT : new PluralRules ( parseRuleChain ( description ) ) ; }
Parses a plural rules description and returns a PluralRules .
28,020
public String select ( double number , int countVisibleFractionDigits , long fractionaldigits ) { return rules . select ( new FixedDecimal ( number , countVisibleFractionDigits , fractionaldigits ) ) ; }
Given a number returns the keyword of the first rule that applies to the number .
28,021
public boolean matches ( FixedDecimal sample , String keyword ) { return rules . select ( sample , keyword ) ; }
Given a number information and keyword return whether the keyword would match the number .
28,022
boolean canBeWalkedInNaturalDocOrderStatic ( ) { if ( null != m_firstWalker ) { AxesWalker walker = m_firstWalker ; int prevAxis = - 1 ; boolean prevIsSimpleDownAxis = true ; for ( int i = 0 ; null != walker ; i ++ ) { int axis = walker . getAxis ( ) ; if ( walker . isDocOrdered ( ) ) { boolean isSimpleDownAxis = ( ( a...
Tell if the nodeset can be walked in doc order via static analysis .
28,023
public void fixupVariables ( java . util . Vector vars , int globalsSize ) { super . fixupVariables ( vars , globalsSize ) ; int analysis = getAnalysisBits ( ) ; if ( WalkerFactory . isNaturalDocOrder ( analysis ) ) { m_inNaturalOrderStatic = true ; } else { m_inNaturalOrderStatic = false ; } }
This function is used to perform some extra analysis of the iterator .
28,024
public final SecretKey translateKey ( SecretKey key ) throws InvalidKeyException { if ( serviceIterator == null ) { return spi . engineTranslateKey ( key ) ; } Exception failure = null ; SecretKeyFactorySpi mySpi = spi ; do { try { return mySpi . engineTranslateKey ( key ) ; } catch ( Exception e ) { if ( failure == nu...
Translates a key object whose provider may be unknown or potentially untrusted into a corresponding key object of this secret - key factory .
28,025
private int dowait ( boolean timed , long nanos ) throws InterruptedException , BrokenBarrierException , TimeoutException { final ReentrantLock lock = this . lock ; lock . lock ( ) ; try { final Generation g = generation ; if ( g . broken ) throw new BrokenBarrierException ( ) ; if ( Thread . interrupted ( ) ) { breakB...
Main barrier code covering the various policies .
28,026
public boolean isBroken ( ) { final ReentrantLock lock = this . lock ; lock . lock ( ) ; try { return generation . broken ; } finally { lock . unlock ( ) ; } }
Queries if this barrier is in a broken state .
28,027
public int getNumberWaiting ( ) { final ReentrantLock lock = this . lock ; lock . lock ( ) ; try { return parties - count ; } finally { lock . unlock ( ) ; } }
Returns the number of parties currently waiting at the barrier . This method is primarily useful for debugging and assertions .
28,028
long getCEFromOffsetCE32 ( int c , int ce32 ) { long dataCE = ces [ Collation . indexFromCE32 ( ce32 ) ] ; return Collation . makeCE ( Collation . getThreeBytePrimaryForOffsetData ( c , dataCE ) ) ; }
Computes a CE from c s ce32 which has the OFFSET_TAG .
28,029
long getSingleCE ( int c ) { CollationData d ; int ce32 = getCE32 ( c ) ; if ( ce32 == Collation . FALLBACK_CE32 ) { d = base ; ce32 = base . getCE32 ( c ) ; } else { d = this ; } while ( Collation . isSpecialCE32 ( ce32 ) ) { switch ( Collation . tagFromCE32 ( ce32 ) ) { case Collation . LATIN_EXPANSION_TAG : case Col...
Returns the single CE that c maps to . Throws UnsupportedOperationException if c does not map to a single CE .
28,030
public long getLastPrimaryForGroup ( int script ) { int index = getScriptIndex ( script ) ; if ( index == 0 ) { return 0 ; } long limit = scriptStarts [ index + 1 ] ; return ( limit << 16 ) - 1 ; }
Returns the last primary for the script s reordering group .
28,031
public int getGroupForPrimary ( long p ) { p >>= 16 ; if ( p < scriptStarts [ 1 ] || scriptStarts [ scriptStarts . length - 1 ] <= p ) { return - 1 ; } int index = 1 ; while ( p >= scriptStarts [ index + 1 ] ) { ++ index ; } for ( int i = 0 ; i < numScripts ; ++ i ) { if ( scriptsIndex [ i ] == index ) { return i ; } }...
Finds the reordering group which contains the primary weight .
28,032
public static byte [ ] toBigEndianUtf16Bytes ( char [ ] chars , int offset , int length ) { byte [ ] result = new byte [ length * 2 ] ; int end = offset + length ; int resultIndex = 0 ; for ( int i = offset ; i < end ; ++ i ) { char ch = chars [ i ] ; result [ resultIndex ++ ] = ( byte ) ( ch >> 8 ) ; result [ resultIn...
Returns a new byte array containing the bytes corresponding to the given characters encoded in UTF - 16BE . All characters are representable in UTF - 16BE .
28,033
public static void main ( String [ ] args ) { String [ ] word = { "Zero" , "One" , "Two" , "Three" , "Four" , "Five" , "Six" , "Seven" , "Eight" , "Nine" , "Ten" , "Eleven" , "Twelve" , "Thirteen" , "Fourteen" , "Fifteen" , "Sixteen" , "Seventeen" , "Eighteen" , "Nineteen" , "Twenty" , "Twenty-One" , "Twenty-Two" , "Tw...
Command - line unit test driver . This test relies on the fact that this version of the pool assigns indices consecutively starting from zero as new unique strings are encountered .
28,034
public void close ( ) throws IOException { PipedInputStream stream = target ; if ( stream != null ) { stream . done ( ) ; target = null ; } }
Closes this stream . If this stream is connected to an input stream the input stream is closed and the pipe is disconnected .
28,035
public void reset ( ) { synchronized ( zsRef ) { ensureOpen ( ) ; reset ( zsRef . address ( ) ) ; buf = defaultBuf ; finished = false ; needDict = false ; off = len = 0 ; bytesRead = bytesWritten = 0 ; } }
Resets inflater so that a new set of input data can be processed .
28,036
public Date getStartInYear ( int year , int prevRawOffset , int prevDSTSavings ) { if ( year < startYear || year > endYear ) { return null ; } long ruleDay ; int type = dateTimeRule . getDateRuleType ( ) ; if ( type == DateTimeRule . DOM ) { ruleDay = Grego . fieldsToDay ( year , dateTimeRule . getRuleMonth ( ) , dateT...
Gets the time when this rule takes effect in the given year .
28,037
public ULocale [ ] getAvailableULocales ( ) { Set < String > keys = getLocaleIdToRulesIdMap ( PluralType . CARDINAL ) . keySet ( ) ; ULocale [ ] locales = new ULocale [ keys . size ( ) ] ; int n = 0 ; for ( Iterator < String > iter = keys . iterator ( ) ; iter . hasNext ( ) ; ) { locales [ n ++ ] = ULocale . createCano...
Returns the locales for which we have plurals data . Utility for testing .
28,038
public ULocale getFunctionalEquivalent ( ULocale locale , boolean [ ] isAvailable ) { if ( isAvailable != null && isAvailable . length > 0 ) { String localeId = ULocale . canonicalize ( locale . getBaseName ( ) ) ; Map < String , String > idMap = getLocaleIdToRulesIdMap ( PluralType . CARDINAL ) ; isAvailable [ 0 ] = i...
Returns the functionally equivalent locale .
28,039
private Map < String , String > getLocaleIdToRulesIdMap ( PluralType type ) { checkBuildRulesIdMaps ( ) ; return ( type == PluralType . CARDINAL ) ? localeIdToCardinalRulesId : localeIdToOrdinalRulesId ; }
Returns the lazily - constructed map .
28,040
private void checkBuildRulesIdMaps ( ) { boolean haveMap ; synchronized ( this ) { haveMap = localeIdToCardinalRulesId != null ; } if ( ! haveMap ) { Map < String , String > tempLocaleIdToCardinalRulesId ; Map < String , String > tempLocaleIdToOrdinalRulesId ; Map < String , ULocale > tempRulesIdToEquivalentULocale ; t...
Lazily constructs the localeIdToRulesId and rulesIdToEquivalentULocale maps if necessary . These exactly reflect the contents of the locales resource in plurals . res .
28,041
public String getRulesIdForLocale ( ULocale locale , PluralType type ) { Map < String , String > idMap = getLocaleIdToRulesIdMap ( type ) ; String localeId = ULocale . canonicalize ( locale . getBaseName ( ) ) ; String rulesId = null ; while ( null == ( rulesId = idMap . get ( localeId ) ) ) { int ix = localeId . lastI...
Gets the rulesId from the locale with locale fallback . If there is no rulesId return null . The rulesId might be the empty string if the rule is the default rule .
28,042
public PluralRules getRulesForRulesId ( String rulesId ) { PluralRules rules = null ; boolean hasRules ; synchronized ( rulesIdToRules ) { hasRules = rulesIdToRules . containsKey ( rulesId ) ; if ( hasRules ) { rules = rulesIdToRules . get ( rulesId ) ; } } if ( ! hasRules ) { try { UResourceBundle pluralb = getPluralB...
Gets the rule from the rulesId . If there is no rule for this rulesId return null .
28,043
public UResourceBundle getPluralBundle ( ) throws MissingResourceException { return ICUResourceBundle . getBundleInstance ( ICUData . ICU_BASE_NAME , "plurals" , ICUResourceBundle . ICU_DATA_CLASS_LOADER , true ) ; }
Return the plurals resource . Note MissingResourceException is unchecked listed here for clarity . Callers should handle this exception .
28,044
public PluralRules forLocale ( ULocale locale , PluralRules . PluralType type ) { String rulesId = getRulesIdForLocale ( locale , type ) ; if ( rulesId == null || rulesId . trim ( ) . length ( ) == 0 ) { return PluralRules . DEFAULT ; } PluralRules rules = getRulesForRulesId ( rulesId ) ; if ( rules == null ) { rules =...
Returns the plural rules for the the locale . If we don t have data android . icu . text . PluralRules . DEFAULT is returned .
28,045
public final CharsetDecoder replaceWith ( String newReplacement ) { if ( newReplacement == null ) throw new IllegalArgumentException ( "Null replacement" ) ; int len = newReplacement . length ( ) ; if ( len == 0 ) throw new IllegalArgumentException ( "Empty replacement" ) ; if ( len > maxCharsPerByte ) throw new Illega...
Changes this decoder s replacement value .
28,046
public final CharsetDecoder onUnmappableCharacter ( CodingErrorAction newAction ) { if ( newAction == null ) throw new IllegalArgumentException ( "Null action" ) ; unmappableCharacterAction = newAction ; implOnUnmappableCharacter ( newAction ) ; return this ; }
Changes this decoder s action for unmappable - character errors .
28,047
public final CoderResult decode ( ByteBuffer in , CharBuffer out , boolean endOfInput ) { int newState = endOfInput ? ST_END : ST_CODING ; if ( ( state != ST_RESET ) && ( state != ST_CODING ) && ! ( endOfInput && ( state == ST_END ) ) ) throwIllegalStateException ( state , newState ) ; state = newState ; for ( ; ; ) { ...
Decodes as many bytes as possible from the given input buffer writing the results to the given output buffer .
28,048
public final CoderResult flush ( CharBuffer out ) { if ( state == ST_END ) { CoderResult cr = implFlush ( out ) ; if ( cr . isUnderflow ( ) ) state = ST_FLUSHED ; return cr ; } if ( state != ST_FLUSHED ) throwIllegalStateException ( state , ST_FLUSHED ) ; return CoderResult . UNDERFLOW ; }
Flushes this decoder .
28,049
public static int readHeader ( ByteBuffer bytes , int dataFormat , Authenticate authenticate ) throws IOException { assert bytes != null && bytes . position ( ) == 0 ; byte magic1 = bytes . get ( 2 ) ; byte magic2 = bytes . get ( 3 ) ; if ( magic1 != MAGIC1 || magic2 != MAGIC2 ) { throw new IOException ( MAGIC_NUMBER_A...
Reads an ICU data header checks the data format and returns the data version .
28,050
public static int writeHeader ( int dataFormat , int formatVersion , int dataVersion , DataOutputStream dos ) throws IOException { dos . writeChar ( 32 ) ; dos . writeByte ( MAGIC1 ) ; dos . writeByte ( MAGIC2 ) ; dos . writeChar ( 20 ) ; dos . writeChar ( 0 ) ; dos . writeByte ( 1 ) ; dos . writeByte ( CHAR_SET_ ) ; d...
Writes an ICU data header . Does not write a copyright string .
28,051
public static ByteBuffer getByteBufferFromInputStreamAndCloseStream ( InputStream is ) throws IOException { try { byte [ ] bytes ; int avail = is . available ( ) ; if ( avail > 32 ) { bytes = new byte [ avail ] ; } else { bytes = new byte [ 128 ] ; } int length = 0 ; for ( ; ; ) { if ( length < bytes . length ) { int n...
Reads the entire contents from the stream into a byte array and wraps it into a ByteBuffer . Closes the InputStream at the end .
28,052
public static int next32 ( CharacterIterator ci ) { int c = ci . current ( ) ; if ( c >= UTF16 . LEAD_SURROGATE_MIN_VALUE && c <= UTF16 . LEAD_SURROGATE_MAX_VALUE ) { c = ci . next ( ) ; if ( c < UTF16 . TRAIL_SURROGATE_MIN_VALUE || c > UTF16 . TRAIL_SURROGATE_MAX_VALUE ) { ci . previous ( ) ; } } c = ci . next ( ) ; i...
Move the iterator forward to the next code point and return that code point leaving the iterator positioned at char returned . For Supplementary chars the iterator is left positioned at the lead surrogate .
28,053
public StringWriter append ( CharSequence csq , int start , int end ) { CharSequence cs = ( csq == null ? "null" : csq ) ; write ( cs . subSequence ( start , end ) . toString ( ) ) ; return this ; }
Appends a subsequence of the specified character sequence to this writer .
28,054
public void init ( Compiler compiler , int opPos , int stepType ) throws javax . xml . transform . TransformerException { initPredicateInfo ( compiler , opPos ) ; }
Initialize an AxesWalker during the parse of the XPath expression .
28,055
AxesWalker cloneDeep ( WalkingIterator cloneOwner , Vector cloneList ) throws CloneNotSupportedException { AxesWalker clone = findClone ( this , cloneList ) ; if ( null != clone ) return clone ; clone = ( AxesWalker ) this . clone ( ) ; clone . setLocPathIterator ( cloneOwner ) ; if ( null != cloneList ) { cloneList . ...
Do a deep clone of this walker including next and previous walkers . If the this AxesWalker is on the clone list don t clone but return the already cloned version .
28,056
static AxesWalker findClone ( AxesWalker key , Vector cloneList ) { if ( null != cloneList ) { int n = cloneList . size ( ) ; for ( int i = 0 ; i < n ; i += 2 ) { if ( key == cloneList . elementAt ( i ) ) return ( AxesWalker ) cloneList . elementAt ( i + 1 ) ; } } return null ; }
Find a clone that corresponds to the key argument .
28,057
public void detach ( ) { m_currentNode = DTM . NULL ; m_dtm = null ; m_traverser = null ; m_isFresh = true ; m_root = DTM . NULL ; }
Detaches the walker from the set which it iterated over releasing any computational resources and placing the iterator in the INVALID state .
28,058
public int getLastPos ( XPathContext xctxt ) { int pos = getProximityPosition ( ) ; AxesWalker walker ; try { walker = ( AxesWalker ) clone ( ) ; } catch ( CloneNotSupportedException cnse ) { return - 1 ; } walker . setPredicateCount ( m_predicateIndex ) ; walker . setNextWalker ( null ) ; walker . setPrevWalker ( null...
Get the index of the last node that can be itterated to .
28,059
public void callVisitors ( ExpressionOwner owner , XPathVisitor visitor ) { if ( visitor . visitStep ( owner , this ) ) { callPredicateVisitors ( visitor ) ; if ( null != m_nextWalker ) { m_nextWalker . callVisitors ( this , visitor ) ; } } }
This will traverse the heararchy calling the visitor for each member . If the called visitor method returns false the subtree should not be called .
28,060
public final Element getDocumentElement ( ) { int dochandle = dtm . getDocument ( ) ; int elementhandle = DTM . NULL ; for ( int kidhandle = dtm . getFirstChild ( dochandle ) ; kidhandle != DTM . NULL ; kidhandle = dtm . getNextSibling ( kidhandle ) ) { switch ( dtm . getNodeType ( kidhandle ) ) { case Node . ELEMENT_N...
This is a bit of a problem in DTM since a DTM may be a Document Fragment and hence not have a clear - cut Document Element . We can make it work in the well - formed cases but would that be confusing for others?
28,061
public final Element getOwnerElement ( ) { if ( getNodeType ( ) != Node . ATTRIBUTE_NODE ) return null ; int newnode = dtm . getParent ( node ) ; return ( newnode == DTM . NULL ) ? null : ( Element ) ( dtm . getNode ( newnode ) ) ; }
Get the owner element of an attribute .
28,062
public static String getFullName ( String baseName , String localeName ) { if ( baseName == null || baseName . length ( ) == 0 ) { if ( localeName . length ( ) == 0 ) { return localeName = ULocale . getDefault ( ) . toString ( ) ; } return localeName + ICU_RESOURCE_SUFFIX ; } else { if ( baseName . indexOf ( '.' ) == -...
Gets the full name of the resource with suffix .
28,063
public void setAttributeList ( AttributeList atts ) { int count = atts . getLength ( ) ; clear ( ) ; for ( int i = 0 ; i < count ; i ++ ) { addAttribute ( atts . getName ( i ) , atts . getType ( i ) , atts . getValue ( i ) ) ; } }
Set the attribute list discarding previous contents .
28,064
public void addAttribute ( String name , String type , String value ) { names . add ( name ) ; types . add ( type ) ; values . add ( value ) ; }
Add an attribute to an attribute list .
28,065
private void readObject ( ObjectInputStream stream ) throws IOException , TransformerException { try { stream . defaultReadObject ( ) ; } catch ( ClassNotFoundException cnfe ) { throw new TransformerException ( cnfe ) ; } }
Read the stylesheet from a serialization stream .
28,066
public StylesheetComposed getStylesheetComposed ( ) { Stylesheet sheet = this ; while ( ! sheet . isAggregatedType ( ) ) { sheet = sheet . getStylesheetParent ( ) ; } return ( StylesheetComposed ) sheet ; }
Get the owning aggregated stylesheet or this stylesheet if it is aggregated .
28,067
public Socket createSocket ( ) throws IOException { UnsupportedOperationException uop = new UnsupportedOperationException ( ) ; SocketException se = new SocketException ( "Unconnected sockets not implemented" ) ; se . initCause ( uop ) ; throw se ; }
Creates an unconnected socket .
28,068
public void recompose ( Vector recomposableElements ) throws TransformerException { int n = getIncludeCountComposed ( ) ; for ( int i = - 1 ; i < n ; i ++ ) { Stylesheet included = getIncludeComposed ( i ) ; int s = included . getOutputCount ( ) ; for ( int j = 0 ; j < s ; j ++ ) { recomposableElements . addElement ( i...
Adds all recomposable values for this precedence level into the recomposableElements Vector that was passed in as the first parameter . All elements added to the recomposableElements vector should extend ElemTemplateElement .
28,069
void recomposeImports ( ) { m_importNumber = getStylesheetRoot ( ) . getImportNumber ( this ) ; StylesheetRoot root = getStylesheetRoot ( ) ; int globalImportCount = root . getGlobalImportCount ( ) ; m_importCountComposed = ( globalImportCount - m_importNumber ) - 1 ; int count = getImportCount ( ) ; if ( count > 0 ) {...
Recalculate the precedence of this stylesheet in the global import list . The lowest precedence stylesheet is 0 . A higher number has a higher precedence .
28,070
void recomposeIncludes ( Stylesheet including ) { int n = including . getIncludeCount ( ) ; if ( n > 0 ) { if ( null == m_includesComposed ) m_includesComposed = new Vector ( ) ; for ( int i = 0 ; i < n ; i ++ ) { Stylesheet included = including . getInclude ( i ) ; m_includesComposed . addElement ( included ) ; recomp...
Recompose the value of the composed include list . Builds a composite list of all stylesheets included by this stylesheet to any depth .
28,071
public static void compact ( Set < String > source , Adder adder , boolean shorterPairs , boolean moreCompact ) { if ( ! moreCompact ) { String start = null ; String end = null ; int lastCp = 0 ; int prefixLen = 0 ; for ( String s : source ) { if ( start != null ) { if ( s . regionMatches ( 0 , start , 0 , prefixLen ) ...
Compact the set of strings .
28,072
public static void compact ( Set < String > source , Adder adder , boolean shorterPairs ) { compact ( source , adder , shorterPairs , false ) ; }
Faster but not as good compaction . Only looks at final codepoint .
28,073
public static int singleWordWangJenkinsHash ( Object k ) { int h = k . hashCode ( ) ; h += ( h << 15 ) ^ 0xffffcd7d ; h ^= ( h >>> 10 ) ; h += ( h << 3 ) ; h ^= ( h >>> 6 ) ; h += ( h << 2 ) + ( h << 14 ) ; return h ^ ( h >>> 16 ) ; }
Based on commit 1424a2a1a9fc53dc8b859a77c02c924 .
28,074
public void initXPath ( Compiler compiler , String expression , PrefixResolver namespaceContext ) throws javax . xml . transform . TransformerException { m_ops = compiler ; m_namespaceContext = namespaceContext ; m_functionTable = compiler . getFunctionTable ( ) ; Lexer lexer = new Lexer ( compiler , namespaceContext ,...
Given an string init an XPath object for selections in order that a parse doesn t have to be done each time the expression is evaluated .
28,075
final boolean tokenIs ( String s ) { return ( m_token != null ) ? ( m_token . equals ( s ) ) : ( s == null ) ; }
Check whether m_token matches the target string .
28,076
private final boolean lookbehind ( char c , int n ) { boolean isToken ; int lookBehindPos = m_queueMark - ( n + 1 ) ; if ( lookBehindPos >= 0 ) { String lookbehind = ( String ) m_ops . m_tokenQueue . elementAt ( lookBehindPos ) ; if ( lookbehind . length ( ) == 1 ) { char c0 = ( lookbehind == null ) ? '|' : lookbehind ...
Look behind the first character of the current token in order to make a branching decision .
28,077
private final boolean lookbehindHasToken ( int n ) { boolean hasToken ; if ( ( m_queueMark - n ) > 0 ) { String lookbehind = ( String ) m_ops . m_tokenQueue . elementAt ( m_queueMark - ( n - 1 ) ) ; char c0 = ( lookbehind == null ) ? '|' : lookbehind . charAt ( 0 ) ; hasToken = ( c0 == '|' ) ? false : true ; } else { h...
look behind the current token in order to see if there is a useable token .
28,078
private final void nextToken ( ) { if ( m_queueMark < m_ops . getTokenQueueSize ( ) ) { m_token = ( String ) m_ops . m_tokenQueue . elementAt ( m_queueMark ++ ) ; m_tokenChar = m_token . charAt ( 0 ) ; } else { m_token = null ; m_tokenChar = 0 ; } }
Retrieve the next token from the command and store it in m_token string .
28,079
private final String getTokenRelative ( int i ) { String tok ; int relative = m_queueMark + i ; if ( ( relative > 0 ) && ( relative < m_ops . getTokenQueueSize ( ) ) ) { tok = ( String ) m_ops . m_tokenQueue . elementAt ( relative ) ; } else { tok = null ; } return tok ; }
Retrieve a token relative to the current token .
28,080
private final void prevToken ( ) { if ( m_queueMark > 0 ) { m_queueMark -- ; m_token = ( String ) m_ops . m_tokenQueue . elementAt ( m_queueMark ) ; m_tokenChar = m_token . charAt ( 0 ) ; } else { m_token = null ; m_tokenChar = 0 ; } }
Retrieve the previous token from the command and store it in m_token string .
28,081
private final void consumeExpected ( String expected ) throws javax . xml . transform . TransformerException { if ( tokenIs ( expected ) ) { nextToken ( ) ; } else { error ( XPATHErrorResources . ER_EXPECTED_BUT_FOUND , new Object [ ] { expected , m_token } ) ; throw new XPathProcessorException ( CONTINUE_AFTER_FATAL_E...
Consume an expected token throwing an exception if it isn t there .
28,082
protected String dumpRemainingTokenQueue ( ) { int q = m_queueMark ; String returnMsg ; if ( q < m_ops . getTokenQueueSize ( ) ) { String msg = "\n Remaining tokens: (" ; while ( q < m_ops . getTokenQueueSize ( ) ) { String t = ( String ) m_ops . m_tokenQueue . elementAt ( q ++ ) ; msg += ( " '" + t + "'" ) ; } returnM...
Dump the remaining token queue . Thanks to Craig for this .
28,083
final int getFunctionToken ( String key ) { int tok ; Object id ; try { id = Keywords . lookupNodeTest ( key ) ; if ( null == id ) id = m_functionTable . getFunctionID ( key ) ; tok = ( ( Integer ) id ) . intValue ( ) ; } catch ( NullPointerException npe ) { tok = - 1 ; } catch ( ClassCastException cce ) { tok = - 1 ; ...
Given a string return the corresponding function token .
28,084
void insertOp ( int pos , int length , int op ) { int totalLen = m_ops . getOp ( OpMap . MAPINDEX_LENGTH ) ; for ( int i = totalLen - 1 ; i >= pos ; i -- ) { m_ops . setOp ( i + length , m_ops . getOp ( i ) ) ; } m_ops . setOp ( pos , op ) ; m_ops . setOp ( OpMap . MAPINDEX_LENGTH , totalLen + length ) ; }
Insert room for operation . This will NOT set the length value of the operation but will update the length value for the total expression .
28,085
void appendOp ( int length , int op ) { int totalLen = m_ops . getOp ( OpMap . MAPINDEX_LENGTH ) ; m_ops . setOp ( totalLen , op ) ; m_ops . setOp ( totalLen + OpMap . MAPINDEX_LENGTH , length ) ; m_ops . setOp ( OpMap . MAPINDEX_LENGTH , totalLen + length ) ; }
Insert room for operation . This WILL set the length value of the operation and will update the length value for the total expression .
28,086
protected void UnionExpr ( ) throws javax . xml . transform . TransformerException { int opPos = m_ops . getOp ( OpMap . MAPINDEX_LENGTH ) ; boolean continueOrLoop = true ; boolean foundUnion = false ; do { PathExpr ( ) ; if ( tokenIs ( '|' ) ) { if ( false == foundUnion ) { foundUnion = true ; insertOp ( opPos , 2 , O...
The context of the right hand side expressions is the context of the left hand side expression . The results of the right hand side expressions are node sets . The result of the left hand side UnionExpr is the union of the results of the right hand side expressions .
28,087
protected void Literal ( ) throws javax . xml . transform . TransformerException { int last = m_token . length ( ) - 1 ; char c0 = m_tokenChar ; char cX = m_token . charAt ( last ) ; if ( ( ( c0 == '\"' ) && ( cX == '\"' ) ) || ( ( c0 == '\'' ) && ( cX == '\'' ) ) ) { int tokenQueuePos = m_queueMark - 1 ; m_ops . m_tok...
The value of the Literal is the sequence of characters inside the or characters > .
28,088
public XMLString newstr ( FastStringBuffer fsb , int start , int length ) { return new XStringForFSB ( fsb , start , length ) ; }
Create a XMLString from a FastStringBuffer .
28,089
private List < Statement > getInitLocation ( MethodDeclaration node ) { List < Statement > stmts = node . getBody ( ) . getStatements ( ) ; if ( ! stmts . isEmpty ( ) && stmts . get ( 0 ) instanceof SuperConstructorInvocation ) { return stmts . subList ( 0 , 1 ) ; } assert TypeUtil . isNone ( ElementUtil . getDeclaring...
Finds the location in a constructor where init statements should be added .
28,090
public static URIName nameConstraint ( DerValue value ) throws IOException { URI uri ; String name = value . getIA5String ( ) ; try { uri = new URI ( name ) ; } catch ( URISyntaxException use ) { throw new IOException ( "invalid URI name constraint:" + name , use ) ; } if ( uri . getScheme ( ) == null ) { String host =...
Create the URIName object with the specified name constraint . URI name constraints syntax is different than SubjectAltNames etc . See 4 . 2 . 1 . 11 of RFC 3280 .
28,091
private String getAttributeKeyValue ( String key ) { String prefix = key + '=' ; String attribute = getAttribute ( prefix ) ; return attribute != null ? attribute . substring ( prefix . length ( ) ) : null ; }
Return the value for a specified key . Attributes are sequentially searched rather than use a map because most attributes are not key - value pairs .
28,092
public static String toAttributeString ( Set < String > attributes ) { List < String > list = new ArrayList < String > ( attributes ) ; Collections . sort ( list , ATTRIBUTES_COMPARATOR ) ; return Joiner . on ( ", " ) . join ( list ) ; }
Return a sorted comma - separated list of the property attributes for this annotation .
28,093
public static Extension newExtension ( ObjectIdentifier extensionId , boolean critical , byte [ ] rawExtensionValue ) throws IOException { Extension ext = new Extension ( ) ; ext . extensionId = extensionId ; ext . critical = critical ; ext . extensionValue = rawExtensionValue ; return ext ; }
Constructs an Extension from individual components of ObjectIdentifier criticality and the raw encoded extension value .
28,094
public static Set < Currency > getAvailableCurrencies ( ) { Set < Currency > result = new LinkedHashSet < Currency > ( ) ; for ( String currencyCode : availableCurrencyCodes ) { result . add ( Currency . getInstance ( currencyCode ) ) ; } return result ; }
Returns a set of all known currencies .
28,095
public int getNumericCode ( ) { try { String name = "com.google.j2objc.util.CurrencyNumericCodesImpl" ; CurrencyNumericCodes cnc = ( CurrencyNumericCodes ) Class . forName ( name ) . newInstance ( ) ; return cnc . getNumericCode ( currencyCode ) ; } catch ( Exception e ) { throw new LibraryNotLinkedError ( "java.util s...
Returns the ISO 4217 numeric code of this currency .
28,096
public int read ( ) throws IOException { int b = in . read ( ) ; if ( b != - 1 ) { cksum . update ( b ) ; } return b ; }
Reads a byte . Will block if no input is available .
28,097
public long skip ( long n ) throws IOException { byte [ ] buf = new byte [ 512 ] ; long total = 0 ; while ( total < n ) { long len = n - total ; len = read ( buf , 0 , len < buf . length ? ( int ) len : buf . length ) ; if ( len == - 1 ) { return total ; } total += len ; } return total ; }
Skips specified number of bytes of input .
28,098
private boolean checkConstraints ( Set < CryptoPrimitive > primitives , String algorithm , Key key , AlgorithmParameters parameters ) { if ( key == null ) { throw new IllegalArgumentException ( "The key cannot be null" ) ; } if ( algorithm != null && algorithm . length ( ) != 0 ) { if ( ! permits ( primitives , algorit...
Check algorithm constraints
28,099
private static void loadDisabledAlgorithmsMap ( final String propertyName ) { String property = AccessController . doPrivileged ( new PrivilegedAction < String > ( ) { public String run ( ) { return Security . getProperty ( propertyName ) ; } } ) ; String [ ] algorithmsInProperty = null ; if ( property != null && ! pro...
Get disabled algorithm constraints from the specified security property .