idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
27,000 | public void setRoot ( int root ) { super . setRoot ( root ) ; m_exprObj = FilterExprIteratorSimple . executeFilterExpr ( root , m_lpi . getXPathContext ( ) , m_lpi . getPrefixResolver ( ) , m_lpi . getIsTopLevel ( ) , m_lpi . m_stackFrame , m_expr ) ; } | Set the root node of the TreeWalker . |
27,001 | public short acceptNode ( int n ) { try { if ( getPredicateCount ( ) > 0 ) { countProximityPosition ( 0 ) ; if ( ! executePredicates ( n , m_lpi . getXPathContext ( ) ) ) return DTMIterator . FILTER_SKIP ; } return DTMIterator . FILTER_ACCEPT ; } catch ( javax . xml . transform . TransformerException se ) { throw new RuntimeException ( se . getMessage ( ) ) ; } } | This method needs to override AxesWalker . acceptNode because FilterExprWalkers don t need to and shouldn t do a node test . |
27,002 | private int sieveSearch ( int limit , int start ) { if ( start >= limit ) return - 1 ; int index = start ; do { if ( ! get ( index ) ) return index ; index ++ ; } while ( index < limit - 1 ) ; return - 1 ; } | This method returns the index of the first clear bit in the search array that occurs at or after start . It will not search past the specified limit . It returns - 1 if there is no such clear bit . |
27,003 | private void sieveSingle ( int limit , int start , int step ) { while ( start < limit ) { set ( start ) ; start += step ; } } | Sieve a single set of multiples out of the sieve . Begin to remove multiples of the specified step starting at the specified start index up to the specified limit . |
27,004 | BigInteger retrieve ( BigInteger initValue , int certainty , java . util . Random random ) { int offset = 1 ; for ( int i = 0 ; i < bits . length ; i ++ ) { long nextLong = ~ bits [ i ] ; for ( int j = 0 ; j < 64 ; j ++ ) { if ( ( nextLong & 1 ) == 1 ) { BigInteger candidate = initValue . add ( BigInteger . valueOf ( offset ) ) ; if ( candidate . primeToCertainty ( certainty , random ) ) return candidate ; } nextLong >>>= 1 ; offset += 2 ; } } return null ; } | Test probable primes in the sieve and return successful candidates . |
27,005 | static Logger getPlatformLogger ( String name ) { LogManager manager = LogManager . getLogManager ( ) ; Logger result = manager . demandSystemLogger ( name , SYSTEM_LOGGER_RB_NAME ) ; return result ; } | i . e . caller of sun . util . logging . PlatformLogger . getLogger |
27,006 | public boolean isLoggable ( Level level ) { if ( level . intValue ( ) < levelValue || levelValue == offValue ) { return false ; } return true ; } | Check if a message of the given level would actually be logged by this logger . This check is based on the Loggers effective level which may be inherited from its parent . |
27,007 | private synchronized ResourceBundle findResourceBundle ( String name , boolean useCallersClassLoader ) { if ( name == null ) { return null ; } Locale currentLocale = Locale . getDefault ( ) ; if ( catalog != null && currentLocale . equals ( catalogLocale ) && name . equals ( catalogName ) ) { return catalog ; } if ( name . equals ( SYSTEM_LOGGER_RB_NAME ) ) { catalog = findSystemResourceBundle ( currentLocale ) ; catalogName = name ; catalogLocale = currentLocale ; return catalog ; } ClassLoader cl = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( cl == null ) { cl = ClassLoader . getSystemClassLoader ( ) ; } try { catalog = ResourceBundle . getBundle ( name , currentLocale , cl ) ; catalogName = name ; catalogLocale = currentLocale ; return catalog ; } catch ( MissingResourceException ex ) { } return null ; } | Private utility method to map a resource bundle name to an actual resource bundle using a simple one - entry cache . Returns null for a null name . May also return null if we can t find the resource bundle and there is no suitable previous cached value . |
27,008 | private synchronized void setupResourceInfo ( String name , Class < ? > callersClass ) { if ( name == null ) { return ; } if ( findResourceBundle ( name , true ) == null ) { this . callersClassLoaderRef = null ; throw new MissingResourceException ( "Can't find " + name + " bundle" , name , "" ) ; } resourceBundleName = name ; } | Synchronized to prevent races in setting the fields . |
27,009 | private void doSetParent ( Logger newParent ) { synchronized ( treeLock ) { LogManager . LoggerWeakRef ref = null ; if ( parent != null ) { for ( Iterator < LogManager . LoggerWeakRef > iter = parent . kids . iterator ( ) ; iter . hasNext ( ) ; ) { ref = iter . next ( ) ; Logger kid = ref . get ( ) ; if ( kid == this ) { iter . remove ( ) ; break ; } else { ref = null ; } } } parent = newParent ; if ( parent . kids == null ) { parent . kids = new ArrayList < > ( 2 ) ; } if ( ref == null ) { ref = manager . new LoggerWeakRef ( this ) ; } ref . setParentRef ( new WeakReference < Logger > ( parent ) ) ; parent . kids . add ( ref ) ; updateEffectiveLevel ( ) ; } } | Logger onto a parent logger . |
27,010 | private void updateEffectiveLevel ( ) { int newLevelValue ; if ( levelObject != null ) { newLevelValue = levelObject . intValue ( ) ; } else { if ( parent != null ) { newLevelValue = parent . levelValue ; } else { newLevelValue = Level . INFO . intValue ( ) ; } } if ( levelValue == newLevelValue ) { return ; } levelValue = newLevelValue ; if ( kids != null ) { for ( int i = 0 ; i < kids . size ( ) ; i ++ ) { LogManager . LoggerWeakRef ref = kids . get ( i ) ; Logger kid = ref . get ( ) ; if ( kid != null ) { kid . updateEffectiveLevel ( ) ; } } } } | recursively for our children . |
27,011 | private String getEffectiveResourceBundleName ( ) { Logger target = this ; while ( target != null ) { String rbn = target . getResourceBundleName ( ) ; if ( rbn != null ) { return rbn ; } target = target . getParent ( ) ; } return null ; } | May return null |
27,012 | protected void pushIgnoreNullabilityPragmas ( ) { if ( getGenerationUnit ( ) . options ( ) . nullability ( ) || getGenerationUnit ( ) . hasNullabilityAnnotations ( ) ) { newline ( ) ; println ( "#if __has_feature(nullability)" ) ; println ( "#pragma clang diagnostic push" ) ; println ( "#pragma GCC diagnostic ignored \"-Wnullability\"" ) ; println ( "#pragma GCC diagnostic ignored \"-Wnullability-completeness\"" ) ; println ( "#endif" ) ; } } | Ignores nullability warnings . This method should be paired with popIgnoreNullabilityPragmas . |
27,013 | protected void popIgnoreNullabilityPragmas ( ) { if ( getGenerationUnit ( ) . options ( ) . nullability ( ) || getGenerationUnit ( ) . hasNullabilityAnnotations ( ) ) { newline ( ) ; println ( "#if __has_feature(nullability)" ) ; println ( "#pragma clang diagnostic pop" ) ; println ( "#endif" ) ; } } | Restores warnings after a call to pushIgnoreNullabilityPragmas . |
27,014 | public int getSerializedDataSize ( ) { int result = ( 4 << 2 ) ; result += ( m_dataOffset_ << 1 ) ; if ( isCharTrie ( ) ) { result += ( m_dataLength_ << 1 ) ; } else if ( isIntTrie ( ) ) { result += ( m_dataLength_ << 2 ) ; } return result ; } | Gets the serialized data file size of the Trie . This is used during trie data reading for size checking purposes . |
27,015 | protected final int getBMPOffset ( char ch ) { return ( ch >= UTF16 . LEAD_SURROGATE_MIN_VALUE && ch <= UTF16 . LEAD_SURROGATE_MAX_VALUE ) ? getRawOffset ( LEAD_INDEX_OFFSET_ , ch ) : getRawOffset ( 0 , ch ) ; } | Gets the offset to data which the BMP character points to Treats a lead surrogate as a normal code point . |
27,016 | private final boolean checkHeader ( int signature ) { if ( signature != HEADER_SIGNATURE_ ) { return false ; } if ( ( m_options_ & HEADER_OPTIONS_SHIFT_MASK_ ) != INDEX_STAGE_1_SHIFT_ || ( ( m_options_ >> HEADER_OPTIONS_INDEX_SHIFT_ ) & HEADER_OPTIONS_SHIFT_MASK_ ) != INDEX_STAGE_2_SHIFT_ ) { return false ; } return true ; } | Authenticates raw data header . Checking the header information signature and options . |
27,017 | static public XObject create ( Object val ) { XObject result ; if ( val instanceof XObject ) { result = ( XObject ) val ; } else if ( val instanceof String ) { result = new XString ( ( String ) val ) ; } else if ( val instanceof Boolean ) { result = new XBoolean ( ( Boolean ) val ) ; } else if ( val instanceof Double ) { result = new XNumber ( ( ( Double ) val ) ) ; } else { result = new XObject ( val ) ; } return result ; } | Create the right XObject based on the type of the object passed . This function can not make an XObject that exposes DOM Nodes NodeLists and NodeIterators to the XSLT stylesheet as node - sets . |
27,018 | static boolean certCanSignCrl ( X509Certificate cert ) { boolean [ ] keyUsage = cert . getKeyUsage ( ) ; if ( keyUsage != null ) { return keyUsage [ 6 ] ; } return false ; } | Checks that a cert can be used to verify a CRL . |
27,019 | public static Locale getLocaleFromName ( String name ) { String language = "" ; String country = "" ; String variant = "" ; int i1 = name . indexOf ( '_' ) ; if ( i1 < 0 ) { language = name ; } else { language = name . substring ( 0 , i1 ) ; ++ i1 ; int i2 = name . indexOf ( '_' , i1 ) ; if ( i2 < 0 ) { country = name . substring ( i1 ) ; } else { country = name . substring ( i1 , i2 ) ; variant = name . substring ( i2 + 1 ) ; } } return new Locale ( language , country , variant ) ; } | A helper function to convert a string of the form aa_BB_CC to a locale object . Why isn t this in Locale? |
27,020 | public Trie2Writable set ( int c , int value ) { if ( c < 0 || c > 0x10ffff ) { throw new IllegalArgumentException ( "Invalid code point." ) ; } set ( c , true , value ) ; fHash = 0 ; return this ; } | Set a value for a code point . |
27,021 | private void fillBlock ( int block , int start , int limit , int value , int initialValue , boolean overwrite ) { int i ; int pLimit = block + limit ; if ( overwrite ) { for ( i = block + start ; i < pLimit ; i ++ ) { data [ i ] = value ; } } else { for ( i = block + start ; i < pLimit ; i ++ ) { if ( data [ i ] == initialValue ) { data [ i ] = value ; } } } } | initialValue is ignored if overwrite = TRUE |
27,022 | public Trie2Writable setRange ( Trie2 . Range range , boolean overwrite ) { fHash = 0 ; if ( range . leadSurrogate ) { for ( int c = range . startCodePoint ; c <= range . endCodePoint ; c ++ ) { if ( overwrite || getFromU16SingleLead ( ( char ) c ) == this . initialValue ) { setForLeadSurrogateCodeUnit ( ( char ) c , range . value ) ; } } } else { setRange ( range . startCodePoint , range . endCodePoint , range . value , overwrite ) ; } return this ; } | Set the values from a Trie2 . Range . |
27,023 | public Trie2_16 toTrie2_16 ( ) { Trie2_16 frozenTrie = new Trie2_16 ( ) ; freeze ( frozenTrie , ValueWidth . BITS_16 ) ; return frozenTrie ; } | Produce an optimized read - only Trie2_16 from this writable Trie . The data values outside of the range that will fit in a 16 bit unsigned value will be truncated . |
27,024 | public Trie2_32 toTrie2_32 ( ) { Trie2_32 frozenTrie = new Trie2_32 ( ) ; freeze ( frozenTrie , ValueWidth . BITS_32 ) ; return frozenTrie ; } | Produce an optimized read - only Trie2_32 from this writable Trie . |
27,025 | public TimeUnitFormat setLocale ( ULocale locale ) { if ( locale != this . locale ) { mf = mf . withLocale ( locale ) ; setLocale ( locale , locale ) ; this . locale = locale ; isReady = false ; } return this ; } | Set the locale used for formatting or parsing . |
27,026 | public StringBuffer format ( Object obj , StringBuffer toAppendTo , FieldPosition pos ) { return mf . format ( obj , toAppendTo , pos ) ; } | Format a TimeUnitAmount . |
27,027 | public TimeUnitAmount parseObject ( String source , ParsePosition pos ) { if ( ! isReady ) { setup ( ) ; } Number resultNumber = null ; TimeUnit resultTimeUnit = null ; int oldPos = pos . getIndex ( ) ; int newPos = - 1 ; int longestParseDistance = 0 ; String countOfLongestMatch = null ; for ( TimeUnit timeUnit : timeUnitToCountToPatterns . keySet ( ) ) { Map < String , Object [ ] > countToPattern = timeUnitToCountToPatterns . get ( timeUnit ) ; for ( Entry < String , Object [ ] > patternEntry : countToPattern . entrySet ( ) ) { String count = patternEntry . getKey ( ) ; for ( int styl = FULL_NAME ; styl < TOTAL_STYLES ; ++ styl ) { MessageFormat pattern = ( MessageFormat ) ( patternEntry . getValue ( ) ) [ styl ] ; pos . setErrorIndex ( - 1 ) ; pos . setIndex ( oldPos ) ; Object parsed = pattern . parseObject ( source , pos ) ; if ( pos . getErrorIndex ( ) != - 1 || pos . getIndex ( ) == oldPos ) { continue ; } Number temp = null ; if ( ( ( Object [ ] ) parsed ) . length != 0 ) { Object tempObj = ( ( Object [ ] ) parsed ) [ 0 ] ; if ( tempObj instanceof Number ) { temp = ( Number ) tempObj ; } else { try { temp = format . parse ( tempObj . toString ( ) ) ; } catch ( ParseException e ) { continue ; } } } int parseDistance = pos . getIndex ( ) - oldPos ; if ( parseDistance > longestParseDistance ) { resultNumber = temp ; resultTimeUnit = timeUnit ; newPos = pos . getIndex ( ) ; longestParseDistance = parseDistance ; countOfLongestMatch = count ; } } } } if ( resultNumber == null && longestParseDistance != 0 ) { if ( countOfLongestMatch . equals ( "zero" ) ) { resultNumber = Integer . valueOf ( 0 ) ; } else if ( countOfLongestMatch . equals ( "one" ) ) { resultNumber = Integer . valueOf ( 1 ) ; } else if ( countOfLongestMatch . equals ( "two" ) ) { resultNumber = Integer . valueOf ( 2 ) ; } else { resultNumber = Integer . valueOf ( 3 ) ; } } if ( longestParseDistance == 0 ) { pos . setIndex ( oldPos ) ; pos . setErrorIndex ( 0 ) ; return null ; } else { pos . setIndex ( newPos ) ; pos . setErrorIndex ( - 1 ) ; return new TimeUnitAmount ( resultNumber , resultTimeUnit ) ; } } | Parse a TimeUnitAmount . |
27,028 | private void searchInTree ( String resourceKey , int styl , TimeUnit timeUnit , String srcPluralCount , String searchPluralCount , Map < String , Object [ ] > countToPatterns ) { ULocale parentLocale = locale ; String srcTimeUnitName = timeUnit . toString ( ) ; while ( parentLocale != null ) { try { ICUResourceBundle unitsRes = ( ICUResourceBundle ) UResourceBundle . getBundleInstance ( ICUData . ICU_UNIT_BASE_NAME , parentLocale ) ; unitsRes = unitsRes . getWithFallback ( resourceKey ) ; ICUResourceBundle oneUnitRes = unitsRes . getWithFallback ( srcTimeUnitName ) ; String pattern = oneUnitRes . getStringWithFallback ( searchPluralCount ) ; final MessageFormat messageFormat = new MessageFormat ( pattern , locale ) ; Object [ ] pair = countToPatterns . get ( srcPluralCount ) ; if ( pair == null ) { pair = new Object [ 2 ] ; countToPatterns . put ( srcPluralCount , pair ) ; } pair [ styl ] = messageFormat ; return ; } catch ( MissingResourceException e ) { } parentLocale = parentLocale . getFallback ( ) ; } if ( parentLocale == null && resourceKey . equals ( "unitsShort" ) ) { searchInTree ( "units" , styl , timeUnit , srcPluralCount , searchPluralCount , countToPatterns ) ; if ( countToPatterns . get ( srcPluralCount ) != null && countToPatterns . get ( srcPluralCount ) [ styl ] != null ) { return ; } } if ( searchPluralCount . equals ( "other" ) ) { MessageFormat messageFormat = null ; if ( timeUnit == TimeUnit . SECOND ) { messageFormat = new MessageFormat ( DEFAULT_PATTERN_FOR_SECOND , locale ) ; } else if ( timeUnit == TimeUnit . MINUTE ) { messageFormat = new MessageFormat ( DEFAULT_PATTERN_FOR_MINUTE , locale ) ; } else if ( timeUnit == TimeUnit . HOUR ) { messageFormat = new MessageFormat ( DEFAULT_PATTERN_FOR_HOUR , locale ) ; } else if ( timeUnit == TimeUnit . WEEK ) { messageFormat = new MessageFormat ( DEFAULT_PATTERN_FOR_WEEK , locale ) ; } else if ( timeUnit == TimeUnit . DAY ) { messageFormat = new MessageFormat ( DEFAULT_PATTERN_FOR_DAY , locale ) ; } else if ( timeUnit == TimeUnit . MONTH ) { messageFormat = new MessageFormat ( DEFAULT_PATTERN_FOR_MONTH , locale ) ; } else if ( timeUnit == TimeUnit . YEAR ) { messageFormat = new MessageFormat ( DEFAULT_PATTERN_FOR_YEAR , locale ) ; } Object [ ] pair = countToPatterns . get ( srcPluralCount ) ; if ( pair == null ) { pair = new Object [ 2 ] ; countToPatterns . put ( srcPluralCount , pair ) ; } pair [ styl ] = messageFormat ; } else { searchInTree ( resourceKey , styl , timeUnit , srcPluralCount , "other" , countToPatterns ) ; } } | then other is the searchPluralCount . |
27,029 | private void initialize ( ULocale locale ) { this . requestedLocale = locale . toLocale ( ) ; this . ulocale = locale ; CacheData data = cachedLocaleData . getInstance ( locale , null ) ; setLocale ( data . validLocale , data . validLocale ) ; setDigitStrings ( data . digits ) ; String [ ] numberElements = data . numberElements ; setDecimalSeparatorString ( numberElements [ 0 ] ) ; setGroupingSeparatorString ( numberElements [ 1 ] ) ; patternSeparator = numberElements [ 2 ] . charAt ( 0 ) ; setPercentString ( numberElements [ 3 ] ) ; setMinusSignString ( numberElements [ 4 ] ) ; setPlusSignString ( numberElements [ 5 ] ) ; setExponentSeparator ( numberElements [ 6 ] ) ; setPerMillString ( numberElements [ 7 ] ) ; setInfinity ( numberElements [ 8 ] ) ; setNaN ( numberElements [ 9 ] ) ; setMonetaryDecimalSeparatorString ( numberElements [ 10 ] ) ; setMonetaryGroupingSeparatorString ( numberElements [ 11 ] ) ; setExponentMultiplicationSign ( numberElements [ 12 ] ) ; digit = DecimalFormat . PATTERN_DIGIT ; padEscape = DecimalFormat . PATTERN_PAD_ESCAPE ; sigDigit = DecimalFormat . PATTERN_SIGNIFICANT_DIGIT ; CurrencyDisplayInfo info = CurrencyData . provider . getInstance ( locale , true ) ; currency = Currency . getInstance ( locale ) ; if ( currency != null ) { intlCurrencySymbol = currency . getCurrencyCode ( ) ; currencySymbol = currency . getName ( locale , Currency . SYMBOL_NAME , null ) ; CurrencyFormatInfo fmtInfo = info . getFormatInfo ( intlCurrencySymbol ) ; if ( fmtInfo != null ) { currencyPattern = fmtInfo . currencyPattern ; setMonetaryDecimalSeparatorString ( fmtInfo . monetarySeparator ) ; setMonetaryGroupingSeparatorString ( fmtInfo . monetaryGroupingSeparator ) ; } } else { intlCurrencySymbol = "XXX" ; currencySymbol = "\u00A4" ; } initSpacingInfo ( info . getSpacingInfo ( ) ) ; } | Initializes the symbols from the locale data . |
27,030 | public void init ( boolean forward ) throws CertPathValidatorException { if ( ! forward ) { prevPubKey = trustedPubKey ; if ( PKIX . isDSAPublicKeyWithoutParams ( prevPubKey ) ) { throw new CertPathValidatorException ( "Key parameters missing" ) ; } prevSubject = caName ; } else { throw new CertPathValidatorException ( "forward checking not supported" ) ; } } | Initializes the internal state of the checker from parameters specified in the constructor . |
27,031 | private void verifySignature ( X509Certificate cert ) throws CertPathValidatorException { String msg = "signature" ; if ( debug != null ) debug . println ( "---checking " + msg + "..." ) ; try { if ( sigProvider != null ) { cert . verify ( prevPubKey , sigProvider ) ; } else { cert . verify ( prevPubKey ) ; } } catch ( SignatureException e ) { throw new CertPathValidatorException ( msg + " check failed" , e , null , - 1 , BasicReason . INVALID_SIGNATURE ) ; } catch ( GeneralSecurityException e ) { throw new CertPathValidatorException ( msg + " check failed" , e ) ; } if ( debug != null ) debug . println ( msg + " verified." ) ; } | Verifies the signature on the certificate using the previous public key . |
27,032 | private void verifyTimestamp ( X509Certificate cert ) throws CertPathValidatorException { String msg = "timestamp" ; if ( debug != null ) debug . println ( "---checking " + msg + ":" + date . toString ( ) + "..." ) ; try { cert . checkValidity ( date ) ; } catch ( CertificateExpiredException e ) { throw new CertPathValidatorException ( msg + " check failed" , e , null , - 1 , BasicReason . EXPIRED ) ; } catch ( CertificateNotYetValidException e ) { throw new CertPathValidatorException ( msg + " check failed" , e , null , - 1 , BasicReason . NOT_YET_VALID ) ; } if ( debug != null ) debug . println ( msg + " verified." ) ; } | Internal method to verify the timestamp on a certificate |
27,033 | private void verifyNameChaining ( X509Certificate cert ) throws CertPathValidatorException { if ( prevSubject != null ) { String msg = "subject/issuer name chaining" ; if ( debug != null ) debug . println ( "---checking " + msg + "..." ) ; X500Principal currIssuer = cert . getIssuerX500Principal ( ) ; if ( X500Name . asX500Name ( currIssuer ) . isEmpty ( ) ) { throw new CertPathValidatorException ( msg + " check failed: " + "empty/null issuer DN in certificate is invalid" , null , null , - 1 , PKIXReason . NAME_CHAINING ) ; } if ( ! ( currIssuer . equals ( prevSubject ) ) ) { throw new CertPathValidatorException ( msg + " check failed" , null , null , - 1 , PKIXReason . NAME_CHAINING ) ; } if ( debug != null ) debug . println ( msg + " verified." ) ; } } | Internal method to check that cert has a valid DN to be next in a chain |
27,034 | private void updateState ( X509Certificate currCert ) throws CertPathValidatorException { PublicKey cKey = currCert . getPublicKey ( ) ; if ( debug != null ) { debug . println ( "BasicChecker.updateState issuer: " + currCert . getIssuerX500Principal ( ) . toString ( ) + "; subject: " + currCert . getSubjectX500Principal ( ) + "; serial#: " + currCert . getSerialNumber ( ) . toString ( ) ) ; } if ( PKIX . isDSAPublicKeyWithoutParams ( cKey ) ) { cKey = makeInheritedParamsKey ( cKey , prevPubKey ) ; if ( debug != null ) debug . println ( "BasicChecker.updateState Made " + "key with inherited params" ) ; } prevPubKey = cKey ; prevSubject = currCert . getSubjectX500Principal ( ) ; } | Internal method to manage state information at each iteration |
27,035 | static PublicKey makeInheritedParamsKey ( PublicKey keyValueKey , PublicKey keyParamsKey ) throws CertPathValidatorException { if ( ! ( keyValueKey instanceof DSAPublicKey ) || ! ( keyParamsKey instanceof DSAPublicKey ) ) throw new CertPathValidatorException ( "Input key is not " + "appropriate type for " + "inheriting parameters" ) ; DSAParams params = ( ( DSAPublicKey ) keyParamsKey ) . getParams ( ) ; if ( params == null ) throw new CertPathValidatorException ( "Key parameters missing" ) ; try { BigInteger y = ( ( DSAPublicKey ) keyValueKey ) . getY ( ) ; KeyFactory kf = KeyFactory . getInstance ( "DSA" ) ; DSAPublicKeySpec ks = new DSAPublicKeySpec ( y , params . getP ( ) , params . getQ ( ) , params . getG ( ) ) ; return kf . generatePublic ( ks ) ; } catch ( GeneralSecurityException e ) { throw new CertPathValidatorException ( "Unable to generate key with" + " inherited parameters: " + e . getMessage ( ) , e ) ; } } | Internal method to create a new key with inherited key parameters . |
27,036 | XPath getCountMatchPattern ( XPathContext support , int contextNode ) throws javax . xml . transform . TransformerException { XPath countMatchPattern = m_countMatchPattern ; DTM dtm = support . getDTM ( contextNode ) ; if ( null == countMatchPattern ) { switch ( dtm . getNodeType ( contextNode ) ) { case DTM . ELEMENT_NODE : MyPrefixResolver resolver ; if ( dtm . getNamespaceURI ( contextNode ) == null ) { resolver = new MyPrefixResolver ( dtm . getNode ( contextNode ) , dtm , contextNode , false ) ; } else { resolver = new MyPrefixResolver ( dtm . getNode ( contextNode ) , dtm , contextNode , true ) ; } countMatchPattern = new XPath ( dtm . getNodeName ( contextNode ) , this , resolver , XPath . MATCH , support . getErrorListener ( ) ) ; break ; case DTM . ATTRIBUTE_NODE : countMatchPattern = new XPath ( "@" + dtm . getNodeName ( contextNode ) , this , this , XPath . MATCH , support . getErrorListener ( ) ) ; break ; case DTM . CDATA_SECTION_NODE : case DTM . TEXT_NODE : countMatchPattern = new XPath ( "text()" , this , this , XPath . MATCH , support . getErrorListener ( ) ) ; break ; case DTM . COMMENT_NODE : countMatchPattern = new XPath ( "comment()" , this , this , XPath . MATCH , support . getErrorListener ( ) ) ; break ; case DTM . DOCUMENT_NODE : countMatchPattern = new XPath ( "/" , this , this , XPath . MATCH , support . getErrorListener ( ) ) ; break ; case DTM . PROCESSING_INSTRUCTION_NODE : countMatchPattern = new XPath ( "pi(" + dtm . getNodeName ( contextNode ) + ")" , this , this , XPath . MATCH , support . getErrorListener ( ) ) ; break ; default : countMatchPattern = null ; } } return countMatchPattern ; } | Get the count match pattern or a default value . |
27,037 | public int getPreviousNode ( XPathContext xctxt , int pos ) throws TransformerException { XPath countMatchPattern = getCountMatchPattern ( xctxt , pos ) ; DTM dtm = xctxt . getDTM ( pos ) ; if ( Constants . NUMBERLEVEL_ANY == m_level ) { XPath fromMatchPattern = m_fromMatchPattern ; while ( DTM . NULL != pos ) { int next = dtm . getPreviousSibling ( pos ) ; if ( DTM . NULL == next ) { next = dtm . getParent ( pos ) ; if ( ( DTM . NULL != next ) && ( ( ( ( null != fromMatchPattern ) && ( fromMatchPattern . getMatchScore ( xctxt , next ) != XPath . MATCH_SCORE_NONE ) ) ) || ( dtm . getNodeType ( next ) == DTM . DOCUMENT_NODE ) ) ) { pos = DTM . NULL ; break ; } } else { int child = next ; while ( DTM . NULL != child ) { child = dtm . getLastChild ( next ) ; if ( DTM . NULL != child ) next = child ; } } pos = next ; if ( ( DTM . NULL != pos ) && ( ( null == countMatchPattern ) || ( countMatchPattern . getMatchScore ( xctxt , pos ) != XPath . MATCH_SCORE_NONE ) ) ) { break ; } } } else { while ( DTM . NULL != pos ) { pos = dtm . getPreviousSibling ( pos ) ; if ( ( DTM . NULL != pos ) && ( ( null == countMatchPattern ) || ( countMatchPattern . getMatchScore ( xctxt , pos ) != XPath . MATCH_SCORE_NONE ) ) ) { break ; } } } return pos ; } | Get the previous node to be counted . |
27,038 | public int getTargetNode ( XPathContext xctxt , int sourceNode ) throws TransformerException { int target = DTM . NULL ; XPath countMatchPattern = getCountMatchPattern ( xctxt , sourceNode ) ; if ( Constants . NUMBERLEVEL_ANY == m_level ) { target = findPrecedingOrAncestorOrSelf ( xctxt , m_fromMatchPattern , countMatchPattern , sourceNode , this ) ; } else { target = findAncestor ( xctxt , m_fromMatchPattern , countMatchPattern , sourceNode , this ) ; } return target ; } | Get the target node that will be counted .. |
27,039 | NodeVector getMatchingAncestors ( XPathContext xctxt , int node , boolean stopAtFirstFound ) throws javax . xml . transform . TransformerException { NodeSetDTM ancestors = new NodeSetDTM ( xctxt . getDTMManager ( ) ) ; XPath countMatchPattern = getCountMatchPattern ( xctxt , node ) ; DTM dtm = xctxt . getDTM ( node ) ; while ( DTM . NULL != node ) { if ( ( null != m_fromMatchPattern ) && ( m_fromMatchPattern . getMatchScore ( xctxt , node ) != XPath . MATCH_SCORE_NONE ) ) { if ( ! stopAtFirstFound ) break ; } if ( null == countMatchPattern ) System . out . println ( "Programmers error! countMatchPattern should never be null!" ) ; if ( countMatchPattern . getMatchScore ( xctxt , node ) != XPath . MATCH_SCORE_NONE ) { ancestors . addElement ( node ) ; if ( stopAtFirstFound ) break ; } node = dtm . getParent ( node ) ; } return ancestors ; } | Get the ancestors up to the root that match the pattern . |
27,040 | Locale getLocale ( TransformerImpl transformer , int contextNode ) throws TransformerException { Locale locale = null ; if ( null != m_lang_avt ) { XPathContext xctxt = transformer . getXPathContext ( ) ; String langValue = m_lang_avt . evaluate ( xctxt , contextNode , this ) ; if ( null != langValue ) { locale = new Locale ( langValue . toUpperCase ( ) , "" ) ; if ( null == locale ) { transformer . getMsgMgr ( ) . warn ( this , null , xctxt . getDTM ( contextNode ) . getNode ( contextNode ) , XSLTErrorResources . WG_LOCALE_NOT_FOUND , new Object [ ] { langValue } ) ; locale = Locale . getDefault ( ) ; } } } else { locale = Locale . getDefault ( ) ; } return locale ; } | Get the locale we should be using . |
27,041 | private DecimalFormat getNumberFormatter ( TransformerImpl transformer , int contextNode ) throws TransformerException { Locale locale = ( Locale ) getLocale ( transformer , contextNode ) . clone ( ) ; DecimalFormat formatter = null ; String digitGroupSepValue = ( null != m_groupingSeparator_avt ) ? m_groupingSeparator_avt . evaluate ( transformer . getXPathContext ( ) , contextNode , this ) : null ; if ( ( digitGroupSepValue != null ) && ( ! m_groupingSeparator_avt . isSimple ( ) ) && ( digitGroupSepValue . length ( ) != 1 ) ) { transformer . getMsgMgr ( ) . warn ( this , XSLTErrorResources . WG_ILLEGAL_ATTRIBUTE_VALUE , new Object [ ] { Constants . ATTRNAME_NAME , m_groupingSeparator_avt . getName ( ) } ) ; } String nDigitsPerGroupValue = ( null != m_groupingSize_avt ) ? m_groupingSize_avt . evaluate ( transformer . getXPathContext ( ) , contextNode , this ) : null ; if ( ( null != digitGroupSepValue ) && ( null != nDigitsPerGroupValue ) && ( digitGroupSepValue . length ( ) > 0 ) ) { try { formatter = ( DecimalFormat ) NumberFormat . getNumberInstance ( locale ) ; formatter . setGroupingSize ( Integer . valueOf ( nDigitsPerGroupValue ) . intValue ( ) ) ; DecimalFormatSymbols symbols = formatter . getDecimalFormatSymbols ( ) ; symbols . setGroupingSeparator ( digitGroupSepValue . charAt ( 0 ) ) ; formatter . setDecimalFormatSymbols ( symbols ) ; formatter . setGroupingUsed ( true ) ; } catch ( NumberFormatException ex ) { formatter . setGroupingUsed ( false ) ; } } return formatter ; } | Get the number formatter to be used the format the numbers |
27,042 | String formatNumberList ( TransformerImpl transformer , long [ ] list , int contextNode ) throws TransformerException { String numStr ; FastStringBuffer formattedNumber = StringBufferPool . get ( ) ; try { int nNumbers = list . length , numberWidth = 1 ; char numberType = '1' ; String formatToken , lastSepString = null , formatTokenString = null ; String lastSep = "." ; boolean isFirstToken = true ; String formatValue = ( null != m_format_avt ) ? m_format_avt . evaluate ( transformer . getXPathContext ( ) , contextNode , this ) : null ; if ( null == formatValue ) formatValue = "1" ; NumberFormatStringTokenizer formatTokenizer = new NumberFormatStringTokenizer ( formatValue ) ; for ( int i = 0 ; i < nNumbers ; i ++ ) { if ( formatTokenizer . hasMoreTokens ( ) ) { formatToken = formatTokenizer . nextToken ( ) ; if ( Character . isLetterOrDigit ( formatToken . charAt ( formatToken . length ( ) - 1 ) ) ) { numberWidth = formatToken . length ( ) ; numberType = formatToken . charAt ( numberWidth - 1 ) ; } else if ( formatTokenizer . isLetterOrDigitAhead ( ) ) { formatTokenString = formatToken ; while ( formatTokenizer . nextIsSep ( ) ) { formatToken = formatTokenizer . nextToken ( ) ; formatTokenString += formatToken ; } if ( ! isFirstToken ) lastSep = formatTokenString ; formatToken = formatTokenizer . nextToken ( ) ; numberWidth = formatToken . length ( ) ; numberType = formatToken . charAt ( numberWidth - 1 ) ; } else { lastSepString = formatToken ; while ( formatTokenizer . hasMoreTokens ( ) ) { formatToken = formatTokenizer . nextToken ( ) ; lastSepString += formatToken ; } } } if ( null != formatTokenString && isFirstToken ) { formattedNumber . append ( formatTokenString ) ; } else if ( null != lastSep && ! isFirstToken ) formattedNumber . append ( lastSep ) ; getFormattedNumber ( transformer , contextNode , numberType , numberWidth , list [ i ] , formattedNumber ) ; isFirstToken = false ; } while ( formatTokenizer . isLetterOrDigitAhead ( ) ) { formatTokenizer . nextToken ( ) ; } if ( lastSepString != null ) formattedNumber . append ( lastSepString ) ; while ( formatTokenizer . hasMoreTokens ( ) ) { formatToken = formatTokenizer . nextToken ( ) ; formattedNumber . append ( formatToken ) ; } numStr = formattedNumber . toString ( ) ; } finally { StringBufferPool . free ( formattedNumber ) ; } return numStr ; } | Format a vector of numbers into a formatted string . |
27,043 | protected String int2singlealphaCount ( long val , CharArrayWrapper table ) { int radix = table . getLength ( ) ; if ( val > radix ) { return getZeroString ( ) ; } else return ( new Character ( table . getChar ( ( int ) val - 1 ) ) ) . toString ( ) ; } | Convert a long integer into alphabetic counting in other words count using the sequence A B C ... Z . |
27,044 | protected String long2roman ( long val , boolean prefixesAreOK ) { if ( val <= 0 ) { return getZeroString ( ) ; } String roman = "" ; int place = 0 ; if ( val <= 3999L ) { do { while ( val >= m_romanConvertTable [ place ] . m_postValue ) { roman += m_romanConvertTable [ place ] . m_postLetter ; val -= m_romanConvertTable [ place ] . m_postValue ; } if ( prefixesAreOK ) { if ( val >= m_romanConvertTable [ place ] . m_preValue ) { roman += m_romanConvertTable [ place ] . m_preLetter ; val -= m_romanConvertTable [ place ] . m_preValue ; } } place ++ ; } while ( val > 0 ) ; } else { roman = XSLTErrorResources . ERROR_STRING ; } return roman ; } | Convert a long integer into roman numerals . |
27,045 | private void encodeThis ( ) throws IOException { if ( id == null && names == null && serialNum == null ) { this . extensionValue = null ; return ; } DerOutputStream seq = new DerOutputStream ( ) ; DerOutputStream tmp = new DerOutputStream ( ) ; if ( id != null ) { DerOutputStream tmp1 = new DerOutputStream ( ) ; id . encode ( tmp1 ) ; tmp . writeImplicit ( DerValue . createTag ( DerValue . TAG_CONTEXT , false , TAG_ID ) , tmp1 ) ; } try { if ( names != null ) { DerOutputStream tmp1 = new DerOutputStream ( ) ; names . encode ( tmp1 ) ; tmp . writeImplicit ( DerValue . createTag ( DerValue . TAG_CONTEXT , true , TAG_NAMES ) , tmp1 ) ; } } catch ( Exception e ) { throw new IOException ( e . toString ( ) ) ; } if ( serialNum != null ) { DerOutputStream tmp1 = new DerOutputStream ( ) ; serialNum . encode ( tmp1 ) ; tmp . writeImplicit ( DerValue . createTag ( DerValue . TAG_CONTEXT , false , TAG_SERIAL_NUM ) , tmp1 ) ; } seq . write ( DerValue . tag_Sequence , tmp ) ; this . extensionValue = seq . toByteArray ( ) ; } | Encode only the extension value |
27,046 | public byte [ ] getEncodedKeyIdentifier ( ) throws IOException { if ( id != null ) { DerOutputStream derOut = new DerOutputStream ( ) ; id . encode ( derOut ) ; return derOut . toByteArray ( ) ; } return null ; } | Return the encoded key identifier or null if not specified . |
27,047 | public int getFCD16 ( int c ) { if ( c < 0 ) { return 0 ; } else if ( c < 0x180 ) { return tccc180 [ c ] ; } else if ( c <= 0xffff ) { if ( ! singleLeadMightHaveNonZeroFCD16 ( c ) ) { return 0 ; } } return getFCD16FromNormData ( c ) ; } | Returns the FCD data for code point c . |
27,048 | public int getFCD16FromNormData ( int c ) { for ( ; ; ) { int norm16 = getNorm16 ( c ) ; if ( norm16 <= minYesNo ) { return 0 ; } else if ( norm16 >= MIN_NORMAL_MAYBE_YES ) { norm16 &= 0xff ; return norm16 | ( norm16 << 8 ) ; } else if ( norm16 >= minMaybeYes ) { return 0 ; } else if ( isDecompNoAlgorithmic ( norm16 ) ) { c = mapAlgorithmic ( c , norm16 ) ; } else { int firstUnit = extraData . charAt ( norm16 ) ; if ( ( firstUnit & MAPPING_LENGTH_MASK ) == 0 ) { return 0x1ff ; } else { int fcd16 = firstUnit >> 8 ; if ( ( firstUnit & MAPPING_HAS_CCC_LCCC_WORD ) != 0 ) { fcd16 |= extraData . charAt ( norm16 - 1 ) & 0xff00 ; } return fcd16 ; } } } } | Gets the FCD value from the regular normalization data . |
27,049 | public String getDecomposition ( int c ) { int decomp = - 1 ; int norm16 ; for ( ; ; ) { if ( c < minDecompNoCP || isDecompYes ( norm16 = getNorm16 ( c ) ) ) { } else if ( isHangul ( norm16 ) ) { StringBuilder buffer = new StringBuilder ( ) ; Hangul . decompose ( c , buffer ) ; return buffer . toString ( ) ; } else if ( isDecompNoAlgorithmic ( norm16 ) ) { decomp = c = mapAlgorithmic ( c , norm16 ) ; continue ; } else { int length = extraData . charAt ( norm16 ++ ) & MAPPING_LENGTH_MASK ; return extraData . substring ( norm16 , norm16 + length ) ; } if ( decomp < 0 ) { return null ; } else { return UTF16 . valueOf ( decomp ) ; } } } | Gets the decomposition for one code point . |
27,050 | public String getRawDecomposition ( int c ) { int norm16 ; if ( c < minDecompNoCP || isDecompYes ( norm16 = getNorm16 ( c ) ) ) { return null ; } else if ( isHangul ( norm16 ) ) { StringBuilder buffer = new StringBuilder ( ) ; Hangul . getRawDecomposition ( c , buffer ) ; return buffer . toString ( ) ; } else if ( isDecompNoAlgorithmic ( norm16 ) ) { return UTF16 . valueOf ( mapAlgorithmic ( c , norm16 ) ) ; } else { int firstUnit = extraData . charAt ( norm16 ) ; int mLength = firstUnit & MAPPING_LENGTH_MASK ; if ( ( firstUnit & MAPPING_HAS_RAW_MAPPING ) != 0 ) { int rawMapping = norm16 - ( ( firstUnit >> 7 ) & 1 ) - 1 ; char rm0 = extraData . charAt ( rawMapping ) ; if ( rm0 <= MAPPING_LENGTH_MASK ) { return extraData . substring ( rawMapping - rm0 , rawMapping ) ; } else { StringBuilder buffer = new StringBuilder ( mLength - 1 ) . append ( rm0 ) ; norm16 += 1 + 2 ; return buffer . append ( extraData , norm16 , norm16 + mLength - 2 ) . toString ( ) ; } } else { norm16 += 1 ; return extraData . substring ( norm16 , norm16 + mLength ) ; } } } | Gets the raw decomposition for one code point . |
27,051 | public Appendable decompose ( CharSequence s , StringBuilder dest ) { decompose ( s , 0 , s . length ( ) , dest , s . length ( ) ) ; return dest ; } | NFD without an NFD Normalizer2 instance . |
27,052 | public void decompose ( CharSequence s , int src , int limit , StringBuilder dest , int destLengthEstimate ) { if ( destLengthEstimate < 0 ) { destLengthEstimate = limit - src ; } dest . setLength ( 0 ) ; ReorderingBuffer buffer = new ReorderingBuffer ( this , dest , destLengthEstimate ) ; decompose ( s , src , limit , buffer ) ; } | Decomposes s [ src limit [ and writes the result to dest . limit can be NULL if src is NUL - terminated . destLengthEstimate is the initial dest buffer capacity and can be - 1 . |
27,053 | public boolean hasDecompBoundary ( int c , boolean before ) { for ( ; ; ) { if ( c < minDecompNoCP ) { return true ; } int norm16 = getNorm16 ( c ) ; if ( isHangul ( norm16 ) || isDecompYesAndZeroCC ( norm16 ) ) { return true ; } else if ( norm16 > MIN_NORMAL_MAYBE_YES ) { return false ; } else if ( isDecompNoAlgorithmic ( norm16 ) ) { c = mapAlgorithmic ( c , norm16 ) ; } else { int firstUnit = extraData . charAt ( norm16 ) ; if ( ( firstUnit & MAPPING_LENGTH_MASK ) == 0 ) { return false ; } if ( ! before ) { if ( firstUnit > 0x1ff ) { return false ; } if ( firstUnit <= 0xff ) { return true ; } } return ( firstUnit & MAPPING_HAS_CCC_LCCC_WORD ) == 0 || ( extraData . charAt ( norm16 - 1 ) & 0xff00 ) == 0 ; } } } | at the cost of building the FCD trie for a decomposition normalizer . |
27,054 | public void decomposeShort ( CharSequence s , int src , int limit , ReorderingBuffer buffer ) { while ( src < limit ) { int c = Character . codePointAt ( s , src ) ; src += Character . charCount ( c ) ; decompose ( c , getNorm16 ( c ) , buffer ) ; } } | Public in Java for collation implementation code . |
27,055 | private static int combine ( String compositions , int list , int trail ) { int key1 , firstUnit ; if ( trail < COMP_1_TRAIL_LIMIT ) { key1 = ( trail << 1 ) ; while ( key1 > ( firstUnit = compositions . charAt ( list ) ) ) { list += 2 + ( firstUnit & COMP_1_TRIPLE ) ; } if ( key1 == ( firstUnit & COMP_1_TRAIL_MASK ) ) { if ( ( firstUnit & COMP_1_TRIPLE ) != 0 ) { return ( compositions . charAt ( list + 1 ) << 16 ) | compositions . charAt ( list + 2 ) ; } else { return compositions . charAt ( list + 1 ) ; } } } else { key1 = COMP_1_TRAIL_LIMIT + ( ( ( trail >> COMP_1_TRAIL_SHIFT ) ) & ~ COMP_1_TRIPLE ) ; int key2 = ( trail << COMP_2_TRAIL_SHIFT ) & 0xffff ; int secondUnit ; for ( ; ; ) { if ( key1 > ( firstUnit = compositions . charAt ( list ) ) ) { list += 2 + ( firstUnit & COMP_1_TRIPLE ) ; } else if ( key1 == ( firstUnit & COMP_1_TRAIL_MASK ) ) { if ( key2 > ( secondUnit = compositions . charAt ( list + 1 ) ) ) { if ( ( firstUnit & COMP_1_LAST_TUPLE ) != 0 ) { break ; } else { list += 3 ; } } else if ( key2 == ( secondUnit & COMP_2_TRAIL_MASK ) ) { return ( ( secondUnit & ~ COMP_2_TRAIL_MASK ) << 16 ) | compositions . charAt ( list + 2 ) ; } else { break ; } } else { break ; } } } return - 1 ; } | Finds the recomposition result for a forward - combining lead character specified with a pointer to its compositions list and a backward - combining trail character . |
27,056 | private boolean isGroupingPosition ( int pos ) { boolean result = false ; if ( isGroupingUsed ( ) && ( pos > 0 ) && ( groupingSize > 0 ) ) { if ( ( groupingSize2 > 0 ) && ( pos > groupingSize ) ) { result = ( ( pos - groupingSize ) % groupingSize2 ) == 0 ; } else { result = pos % groupingSize == 0 ; } } return result ; } | Returns true if a grouping separator belongs at the given position based on whether grouping is in use and the values of the primary and secondary grouping interval . |
27,057 | private UnicodeSet getEquivalentDecimals ( String decimal , boolean strictParse ) { UnicodeSet equivSet = UnicodeSet . EMPTY ; if ( strictParse ) { if ( strictDotEquivalents . contains ( decimal ) ) { equivSet = strictDotEquivalents ; } else if ( strictCommaEquivalents . contains ( decimal ) ) { equivSet = strictCommaEquivalents ; } } else { if ( dotEquivalents . contains ( decimal ) ) { equivSet = dotEquivalents ; } else if ( commaEquivalents . contains ( decimal ) ) { equivSet = commaEquivalents ; } } return equivSet ; } | Returns a set of characters equivalent to the given desimal separator used for parsing number . This method may return an empty set . |
27,058 | private final int skipPadding ( String text , int position ) { while ( position < text . length ( ) && text . charAt ( position ) == pad ) { ++ position ; } return position ; } | Starting at position advance past a run of pad characters if any . Return the index of the first character after position that is not a pad character . Result is > = position . |
27,059 | private int compareAffix ( String text , int pos , boolean isNegative , boolean isPrefix , String affixPat , boolean complexCurrencyParsing , int type , Currency [ ] currency ) { if ( currency != null || currencyChoice != null || ( currencySignCount != CURRENCY_SIGN_COUNT_ZERO && complexCurrencyParsing ) ) { return compareComplexAffix ( affixPat , text , pos , type , currency ) ; } if ( isPrefix ) { return compareSimpleAffix ( isNegative ? negativePrefix : positivePrefix , text , pos ) ; } else { return compareSimpleAffix ( isNegative ? negativeSuffix : positiveSuffix , text , pos ) ; } } | Returns the length matched by the given affix or - 1 if none . Runs of white space in the affix match runs of white space in the input . Pattern white space and input white space are determined differently ; see code . |
27,060 | private static String trimMarksFromAffix ( String affix ) { boolean hasBidiMark = false ; int idx = 0 ; for ( ; idx < affix . length ( ) ; idx ++ ) { if ( isBidiMark ( affix . charAt ( idx ) ) ) { hasBidiMark = true ; break ; } } if ( ! hasBidiMark ) { return affix ; } StringBuilder buf = new StringBuilder ( ) ; buf . append ( affix , 0 , idx ) ; idx ++ ; for ( ; idx < affix . length ( ) ; idx ++ ) { char c = affix . charAt ( idx ) ; if ( ! isBidiMark ( c ) ) { buf . append ( c ) ; } } return buf . toString ( ) ; } | Remove bidi marks from affix |
27,061 | private static int compareSimpleAffix ( String affix , String input , int pos ) { int start = pos ; String trimmedAffix = ( affix . length ( ) > 1 ) ? trimMarksFromAffix ( affix ) : affix ; for ( int i = 0 ; i < trimmedAffix . length ( ) ; ) { int c = UTF16 . charAt ( trimmedAffix , i ) ; int len = UTF16 . getCharCount ( c ) ; if ( PatternProps . isWhiteSpace ( c ) ) { boolean literalMatch = false ; while ( pos < input . length ( ) ) { int ic = UTF16 . charAt ( input , pos ) ; if ( ic == c ) { literalMatch = true ; i += len ; pos += len ; if ( i == trimmedAffix . length ( ) ) { break ; } c = UTF16 . charAt ( trimmedAffix , i ) ; len = UTF16 . getCharCount ( c ) ; if ( ! PatternProps . isWhiteSpace ( c ) ) { break ; } } else if ( isBidiMark ( ic ) ) { pos ++ ; } else { break ; } } i = skipPatternWhiteSpace ( trimmedAffix , i ) ; int s = pos ; pos = skipUWhiteSpace ( input , pos ) ; if ( pos == s && ! literalMatch ) { return - 1 ; } i = skipUWhiteSpace ( trimmedAffix , i ) ; } else { boolean match = false ; while ( pos < input . length ( ) ) { int ic = UTF16 . charAt ( input , pos ) ; if ( ! match && equalWithSignCompatibility ( ic , c ) ) { i += len ; pos += len ; match = true ; } else if ( isBidiMark ( ic ) ) { pos ++ ; } else { break ; } } if ( ! match ) { return - 1 ; } } } return pos - start ; } | Return the length matched by the given affix or - 1 if none . Runs of white space in the affix match runs of white space in the input . Pattern white space and input white space are determined differently ; see code . |
27,062 | private static int skipPatternWhiteSpace ( String text , int pos ) { while ( pos < text . length ( ) ) { int c = UTF16 . charAt ( text , pos ) ; if ( ! PatternProps . isWhiteSpace ( c ) ) { break ; } pos += UTF16 . getCharCount ( c ) ; } return pos ; } | Skips over a run of zero or more Pattern_White_Space characters at pos in text . |
27,063 | private static int skipBidiMarks ( String text , int pos ) { while ( pos < text . length ( ) ) { int c = UTF16 . charAt ( text , pos ) ; if ( ! isBidiMark ( c ) ) { break ; } pos += UTF16 . getCharCount ( c ) ; } return pos ; } | Skips over a run of zero or more bidi marks at pos in text . |
27,064 | public void setDecimalFormatSymbols ( DecimalFormatSymbols newSymbols ) { symbols = ( DecimalFormatSymbols ) newSymbols . clone ( ) ; setCurrencyForSymbols ( ) ; expandAffixes ( null ) ; } | Sets the decimal format symbols used by this format . The format uses a copy of the provided symbols . |
27,065 | private void setCurrencyForSymbols ( ) { DecimalFormatSymbols def = new DecimalFormatSymbols ( symbols . getULocale ( ) ) ; if ( symbols . getCurrencySymbol ( ) . equals ( def . getCurrencySymbol ( ) ) && symbols . getInternationalCurrencySymbol ( ) . equals ( def . getInternationalCurrencySymbol ( ) ) ) { setCurrency ( Currency . getInstance ( symbols . getULocale ( ) ) ) ; } else { setCurrency ( null ) ; } } | Update the currency object to match the symbols . This method is used only when the caller has passed in a symbols object that may not be the default object for its locale . |
27,066 | public void setRoundingMode ( int roundingMode ) { if ( roundingMode < BigDecimal . ROUND_UP || roundingMode > BigDecimal . ROUND_UNNECESSARY ) { throw new IllegalArgumentException ( "Invalid rounding mode: " + roundingMode ) ; } this . roundingMode = roundingMode ; resetActualRounding ( ) ; } | Sets the rounding mode . This has no effect unless the rounding increment is greater than zero . |
27,067 | private void formatAffix2Attribute ( boolean isPrefix , Field fieldType , StringBuffer buf , int offset , int symbolSize ) { int begin ; begin = offset ; if ( ! isPrefix ) { begin += buf . length ( ) ; } addAttribute ( fieldType , begin , begin + symbolSize ) ; } | Fix for prefix and suffix in Ticket 11805 . |
27,068 | private void appendEvaluated ( StringBuffer buffer , String s ) { boolean escape = false ; boolean dollar = false ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( c == '\\' && ! escape ) { escape = true ; } else if ( c == '$' && ! escape ) { dollar = true ; } else if ( c >= '0' && c <= '9' && dollar ) { buffer . append ( group ( c - '0' ) ) ; dollar = false ; } else { buffer . append ( c ) ; dollar = false ; escape = false ; } } if ( escape ) { throw new ArrayIndexOutOfBoundsException ( s . length ( ) ) ; } } | Internal helper method to append a given string to a given string buffer . If the string contains any references to groups these are replaced by the corresponding group s contents . |
27,069 | public String replaceAll ( String replacement ) { reset ( ) ; StringBuffer buffer = new StringBuffer ( input . length ( ) ) ; while ( find ( ) ) { appendReplacement ( buffer , replacement ) ; } return appendTail ( buffer ) . toString ( ) ; } | Replaces every subsequence of the input sequence that matches the pattern with the given replacement string . |
27,070 | public int compareTo ( ByteArrayWrapper other ) { if ( this == other ) return 0 ; int minSize = size < other . size ? size : other . size ; for ( int i = 0 ; i < minSize ; ++ i ) { if ( bytes [ i ] != other . bytes [ i ] ) { return ( bytes [ i ] & 0xFF ) - ( other . bytes [ i ] & 0xFF ) ; } } return size - other . size ; } | Compare this object to another ByteArrayWrapper which must not be null . |
27,071 | private static final void copyBytes ( byte [ ] src , int srcoff , byte [ ] tgt , int tgtoff , int length ) { if ( length < 64 ) { for ( int i = srcoff , n = tgtoff ; -- length >= 0 ; ++ i , ++ n ) { tgt [ n ] = src [ i ] ; } } else { System . arraycopy ( src , srcoff , tgt , tgtoff , length ) ; } } | Copies the contents of src byte array from offset srcoff to the target of tgt byte array at the offset tgtoff . |
27,072 | public static void addAttributes ( SerializationHandler handler , int src ) throws TransformerException { TransformerImpl transformer = ( TransformerImpl ) handler . getTransformer ( ) ; DTM dtm = transformer . getXPathContext ( ) . getDTM ( src ) ; for ( int node = dtm . getFirstAttribute ( src ) ; DTM . NULL != node ; node = dtm . getNextAttribute ( node ) ) { addAttribute ( handler , node ) ; } } | Copy DOM attributes to the result element . |
27,073 | public static void outputResultTreeFragment ( SerializationHandler handler , XObject obj , XPathContext support ) throws org . xml . sax . SAXException { int doc = obj . rtf ( ) ; DTM dtm = support . getDTM ( doc ) ; if ( null != dtm ) { for ( int n = dtm . getFirstChild ( doc ) ; DTM . NULL != n ; n = dtm . getNextSibling ( n ) ) { handler . flushPending ( ) ; if ( dtm . getNodeType ( n ) == DTM . ELEMENT_NODE && dtm . getNamespaceURI ( n ) == null ) handler . startPrefixMapping ( "" , "" ) ; dtm . dispatchToEvents ( n , handler ) ; } } } | Given a result tree fragment walk the tree and output it to the SerializationHandler . |
27,074 | public static boolean isDefinedNSDecl ( SerializationHandler serializer , int attr , DTM dtm ) { if ( DTM . NAMESPACE_NODE == dtm . getNodeType ( attr ) ) { String prefix = dtm . getNodeNameX ( attr ) ; String uri = serializer . getNamespaceURIFromPrefix ( prefix ) ; if ( ( null != uri ) && uri . equals ( dtm . getStringValue ( attr ) ) ) return true ; } return false ; } | Returns whether a namespace is defined |
27,075 | public double num ( ) throws javax . xml . transform . TransformerException { error ( XPATHErrorResources . ER_CANT_CONVERT_TO_NUMBER , new Object [ ] { getTypeString ( ) } ) ; return 0.0 ; } | Cast result object to a number . Always issues an error . |
27,076 | public boolean bool ( ) throws javax . xml . transform . TransformerException { error ( XPATHErrorResources . ER_CANT_CONVERT_TO_NUMBER , new Object [ ] { getTypeString ( ) } ) ; return false ; } | Cast result object to a boolean . Always issues an error . |
27,077 | public Object castToType ( int t , XPathContext support ) throws javax . xml . transform . TransformerException { Object result ; switch ( t ) { case CLASS_STRING : result = str ( ) ; break ; case CLASS_NUMBER : result = new Double ( num ( ) ) ; break ; case CLASS_NODESET : result = iter ( ) ; break ; case CLASS_BOOLEAN : result = new Boolean ( bool ( ) ) ; break ; case CLASS_UNKNOWN : result = m_obj ; break ; default : error ( XPATHErrorResources . ER_CANT_CONVERT_TO_TYPE , new Object [ ] { getTypeString ( ) , Integer . toString ( t ) } ) ; result = null ; } return result ; } | Cast object to type t . |
27,078 | private synchronized void readObject ( java . io . ObjectInputStream s ) throws IOException , ClassNotFoundException { s . defaultReadObject ( ) ; if ( ( handler = getDelegate ( ) . getURLStreamHandler ( protocol ) ) == null ) { throw new IOException ( "unknown protocol: " + protocol ) ; } if ( authority == null && ( ( host != null && host . length ( ) > 0 ) || port != - 1 ) ) { if ( host == null ) host = "" ; authority = ( port == - 1 ) ? host : host + ":" + port ; int at = host . lastIndexOf ( '@' ) ; if ( at != - 1 ) { userInfo = host . substring ( 0 , at ) ; host = host . substring ( at + 1 ) ; } } else if ( authority != null ) { int ind = authority . indexOf ( '@' ) ; if ( ind != - 1 ) userInfo = authority . substring ( 0 , ind ) ; } path = null ; query = null ; if ( file != null ) { int q = file . lastIndexOf ( '?' ) ; if ( q != - 1 ) { query = file . substring ( q + 1 ) ; path = file . substring ( 0 , q ) ; } else path = file ; } hashCode = - 1 ; } | readObject is called to restore the state of the URL from the stream . It reads the components of the URL and finds the local stream handler . |
27,079 | public XmlPullParser newPullParser ( ) throws XmlPullParserException { final XmlPullParser pp = getParserInstance ( ) ; for ( Map . Entry < String , Boolean > entry : features . entrySet ( ) ) { if ( entry . getValue ( ) ) { pp . setFeature ( entry . getKey ( ) , entry . getValue ( ) ) ; } } return pp ; } | Creates a new instance of a XML Pull Parser using the currently configured factory features . |
27,080 | public static String quoteNameIfNecessary ( String name ) { int len = name . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { char c = name . charAt ( i ) ; if ( ! ( ( c >= 'A' && c <= 'Z' ) || ( c >= 'a' && c <= 'z' ) || ( c == ' ' ) || ( c >= '0' && c <= '9' ) ) ) { return '"' + quoteName ( name ) + '"' ; } } return name ; } | Returns the name conservatively quoting it if there are any characters that are likely to cause trouble outside of a quoted string or returning it literally if it seems safe . |
27,081 | public static String quoteName ( String name ) { StringBuilder sb = new StringBuilder ( ) ; int len = name . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { char c = name . charAt ( i ) ; if ( c == '\\' || c == '"' ) { sb . append ( '\\' ) ; } sb . append ( c ) ; } return sb . toString ( ) ; } | Returns the name with internal backslashes and quotation marks preceded by backslashes . The outer quote marks themselves are not added by this method . |
27,082 | public static String quoteComment ( String comment ) { int len = comment . length ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < len ; i ++ ) { char c = comment . charAt ( i ) ; if ( c == '(' || c == ')' || c == '\\' ) { sb . append ( '\\' ) ; } sb . append ( c ) ; } return sb . toString ( ) ; } | Returns the comment with internal backslashes and parentheses preceded by backslashes . The outer parentheses themselves are not added by this method . |
27,083 | DateTimeParseContext copy ( ) { DateTimeParseContext newContext = new DateTimeParseContext ( formatter ) ; newContext . caseSensitive = caseSensitive ; newContext . strict = strict ; return newContext ; } | Creates a copy of this context . This retains the case sensitive and strict flags . |
27,084 | static boolean charEqualsIgnoreCase ( char c1 , char c2 ) { return c1 == c2 || Character . toUpperCase ( c1 ) == Character . toUpperCase ( c2 ) || Character . toLowerCase ( c1 ) == Character . toLowerCase ( c2 ) ; } | Compares two characters ignoring case . |
27,085 | void endOptional ( boolean successful ) { if ( successful ) { parsed . remove ( parsed . size ( ) - 2 ) ; } else { parsed . remove ( parsed . size ( ) - 1 ) ; } } | Ends the parsing of an optional segment of the input . |
27,086 | TemporalAccessor toResolved ( ResolverStyle resolverStyle , Set < TemporalField > resolverFields ) { Parsed parsed = currentParsed ( ) ; parsed . chrono = getEffectiveChronology ( ) ; parsed . zone = ( parsed . zone != null ? parsed . zone : formatter . getZone ( ) ) ; return parsed . resolve ( resolverStyle , resolverFields ) ; } | Gets the resolved result of the parse . |
27,087 | public void removeAtRange ( int index , int size ) { final int end = Math . min ( mSize , index + size ) ; for ( int i = index ; i < end ; i ++ ) { removeAt ( i ) ; } } | Remove a range of mappings as a batch . |
27,088 | public void clear ( ) { int n = mSize ; Object [ ] values = mValues ; for ( int i = 0 ; i < n ; i ++ ) { values [ i ] = null ; } mSize = 0 ; mGarbage = false ; } | Removes all key - value mappings from this SparseArray . |
27,089 | long lastCEWithPrimaryBefore ( long p ) { if ( p == 0 ) { return 0 ; } assert ( p > elements [ ( int ) elements [ IX_FIRST_PRIMARY_INDEX ] ] ) ; int index = findP ( p ) ; long q = elements [ index ] ; long secTer ; if ( p == ( q & 0xffffff00L ) ) { assert ( ( q & PRIMARY_STEP_MASK ) == 0 ) ; secTer = elements [ index - 1 ] ; if ( ( secTer & SEC_TER_DELTA_FLAG ) == 0 ) { p = secTer & 0xffffff00L ; secTer = Collation . COMMON_SEC_AND_TER_CE ; } else { index -= 2 ; for ( ; ; ) { p = elements [ index ] ; if ( ( p & SEC_TER_DELTA_FLAG ) == 0 ) { p &= 0xffffff00L ; break ; } -- index ; } } } else { p = q & 0xffffff00L ; secTer = Collation . COMMON_SEC_AND_TER_CE ; for ( ; ; ) { q = elements [ ++ index ] ; if ( ( q & SEC_TER_DELTA_FLAG ) == 0 ) { assert ( ( q & PRIMARY_STEP_MASK ) == 0 ) ; break ; } secTer = q ; } } return ( p << 32 ) | ( secTer & ~ SEC_TER_DELTA_FLAG ) ; } | Returns the last root CE with a primary weight before p . Intended only for reordering group boundaries . |
27,090 | long firstCEWithPrimaryAtLeast ( long p ) { if ( p == 0 ) { return 0 ; } int index = findP ( p ) ; if ( p != ( elements [ index ] & 0xffffff00L ) ) { for ( ; ; ) { p = elements [ ++ index ] ; if ( ( p & SEC_TER_DELTA_FLAG ) == 0 ) { assert ( ( p & PRIMARY_STEP_MASK ) == 0 ) ; break ; } } } return ( p << 32 ) | Collation . COMMON_SEC_AND_TER_CE ; } | Returns the first root CE with a primary weight of at least p . Intended only for reordering group boundaries . |
27,091 | long getPrimaryBefore ( long p , boolean isCompressible ) { int index = findPrimary ( p ) ; int step ; long q = elements [ index ] ; if ( p == ( q & 0xffffff00L ) ) { step = ( int ) q & PRIMARY_STEP_MASK ; if ( step == 0 ) { do { p = elements [ -- index ] ; } while ( ( p & SEC_TER_DELTA_FLAG ) != 0 ) ; return p & 0xffffff00L ; } } else { long nextElement = elements [ index + 1 ] ; assert ( isEndOfPrimaryRange ( nextElement ) ) ; step = ( int ) nextElement & PRIMARY_STEP_MASK ; } if ( ( p & 0xffff ) == 0 ) { return Collation . decTwoBytePrimaryByOneStep ( p , isCompressible , step ) ; } else { return Collation . decThreeBytePrimaryByOneStep ( p , isCompressible , step ) ; } } | Returns the primary weight before p . p must be greater than the first root primary . |
27,092 | int findPrimary ( long p ) { assert ( ( p & 0xff ) == 0 ) ; int index = findP ( p ) ; assert ( isEndOfPrimaryRange ( elements [ index + 1 ] ) || p == ( elements [ index ] & 0xffffff00L ) ) ; return index ; } | Finds the index of the input primary . p must occur as a root primary and must not be 0 . |
27,093 | public static String createGmtOffsetString ( boolean includeGmt , boolean includeMinuteSeparator , int offsetMillis ) { int offsetMinutes = offsetMillis / 60000 ; char sign = '+' ; if ( offsetMinutes < 0 ) { sign = '-' ; offsetMinutes = - offsetMinutes ; } StringBuilder builder = new StringBuilder ( 9 ) ; if ( includeGmt ) { builder . append ( "GMT" ) ; } builder . append ( sign ) ; appendNumber ( builder , 2 , offsetMinutes / 60 ) ; if ( includeMinuteSeparator ) { builder . append ( ':' ) ; } appendNumber ( builder , 2 , offsetMinutes % 60 ) ; return builder . toString ( ) ; } | Returns a string representation of an offset from UTC . |
27,094 | public static String [ ] getAvailableIDs ( int rawOffset ) { List < String > ids = new ArrayList < > ( ) ; for ( String id : getAvailableIDs ( ) ) { TimeZone tz = NativeTimeZone . get ( id ) ; if ( tz . getRawOffset ( ) == rawOffset ) { ids . add ( id ) ; } } return ids . toArray ( new String [ 0 ] ) ; } | Gets the available IDs according to the given time zone offset in milliseconds . |
27,095 | static synchronized TimeZone getDefaultRef ( ) { if ( defaultTimeZone == null ) { defaultTimeZone = NativeTimeZone . getDefaultNativeTimeZone ( ) ; } if ( defaultTimeZone == null ) { defaultTimeZone = GMTHolder . INSTANCE ; } return defaultTimeZone ; } | Returns the reference to the default TimeZone object . This method doesn t create a clone . |
27,096 | public void execute ( TransformerImpl transformer ) throws TransformerException { XPathContext xctxt = transformer . getXPathContext ( ) ; int sourceNode = xctxt . getCurrentNode ( ) ; if ( m_test . bool ( xctxt , sourceNode , this ) ) { transformer . executeChildTemplates ( this , true ) ; } } | Conditionally execute a sub - template . The expression is evaluated and the resulting object is converted to a boolean as if by a call to the boolean function . If the result is true then the content template is instantiated ; otherwise nothing is created . |
27,097 | private int findOrInsertNodeForCEs ( int strength ) { assert ( Collator . PRIMARY <= strength && strength <= Collator . QUATERNARY ) ; long ce ; for ( ; ; -- cesLength ) { if ( cesLength == 0 ) { ce = ces [ 0 ] = 0 ; cesLength = 1 ; break ; } else { ce = ces [ cesLength - 1 ] ; } if ( ceStrength ( ce ) <= strength ) { break ; } } if ( isTempCE ( ce ) ) { return indexFromTempCE ( ce ) ; } if ( ( int ) ( ce >>> 56 ) == Collation . UNASSIGNED_IMPLICIT_BYTE ) { throw new UnsupportedOperationException ( "tailoring relative to an unassigned code point not supported" ) ; } return findOrInsertNodeForRootCE ( ce , strength ) ; } | Picks one of the current CEs and finds or inserts a node in the graph for the CE + strength . |
27,098 | private int findOrInsertNodeForPrimary ( long p ) { int rootIndex = binarySearchForRootPrimaryNode ( rootPrimaryIndexes . getBuffer ( ) , rootPrimaryIndexes . size ( ) , nodes . getBuffer ( ) , p ) ; if ( rootIndex >= 0 ) { return rootPrimaryIndexes . elementAti ( rootIndex ) ; } else { int index = nodes . size ( ) ; nodes . addElement ( nodeFromWeight32 ( p ) ) ; rootPrimaryIndexes . insertElementAt ( index , ~ rootIndex ) ; return index ; } } | Finds or inserts the node for a root CE s primary weight . |
27,099 | private int findOrInsertWeakNode ( int index , int weight16 , int level ) { assert ( 0 <= index && index < nodes . size ( ) ) ; assert ( Collator . SECONDARY <= level && level <= Collator . TERTIARY ) ; if ( weight16 == Collation . COMMON_WEIGHT16 ) { return findCommonNode ( index , level ) ; } long node = nodes . elementAti ( index ) ; assert ( strengthFromNode ( node ) < level ) ; if ( weight16 != 0 && weight16 < Collation . COMMON_WEIGHT16 ) { int hasThisLevelBefore = level == Collator . SECONDARY ? HAS_BEFORE2 : HAS_BEFORE3 ; if ( ( node & hasThisLevelBefore ) == 0 ) { long commonNode = nodeFromWeight16 ( Collation . COMMON_WEIGHT16 ) | nodeFromStrength ( level ) ; if ( level == Collator . SECONDARY ) { commonNode |= node & HAS_BEFORE3 ; node &= ~ ( long ) HAS_BEFORE3 ; } nodes . setElementAt ( node | hasThisLevelBefore , index ) ; int nextIndex = nextIndexFromNode ( node ) ; node = nodeFromWeight16 ( weight16 ) | nodeFromStrength ( level ) ; index = insertNodeBetween ( index , nextIndex , node ) ; insertNodeBetween ( index , nextIndex , commonNode ) ; return index ; } } int nextIndex ; while ( ( nextIndex = nextIndexFromNode ( node ) ) != 0 ) { node = nodes . elementAti ( nextIndex ) ; int nextStrength = strengthFromNode ( node ) ; if ( nextStrength <= level ) { if ( nextStrength < level ) { break ; } if ( ! isTailoredNode ( node ) ) { int nextWeight16 = weight16FromNode ( node ) ; if ( nextWeight16 == weight16 ) { return nextIndex ; } if ( nextWeight16 > weight16 ) { break ; } } } index = nextIndex ; } node = nodeFromWeight16 ( weight16 ) | nodeFromStrength ( level ) ; return insertNodeBetween ( index , nextIndex , node ) ; } | Finds or inserts the node for a secondary or tertiary weight . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.