idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
27,200
public String normalize ( CharSequence src ) { if ( src instanceof String ) { int spanLength = spanQuickCheckYes ( src ) ; if ( spanLength == src . length ( ) ) { return ( String ) src ; } StringBuilder sb = new StringBuilder ( src . length ( ) ) . append ( src , 0 , spanLength ) ; return normalizeSecondAndAppend ( sb ...
Returns the normalized form of the source string .
27,201
public void encode ( DerOutputStream out ) throws IOException { DerOutputStream tmp = new DerOutputStream ( ) ; issuerDomain . encode ( tmp ) ; subjectDomain . encode ( tmp ) ; out . write ( DerValue . tag_Sequence , tmp ) ; }
Write the CertificatePolicyMap to the DerOutputStream .
27,202
private static void addMapping ( Map < String , String > map , String key , String value , String kind ) { String oldValue = map . put ( key , value ) ; if ( oldValue != null && ! oldValue . equals ( value ) ) { ErrorUtil . error ( kind + " redefined; was \"" + oldValue + ", now " + value ) ; } }
Adds a class method or package - prefix property to its map reporting an error if that mapping was previously specified .
27,203
private static int initializeTimeout ( ) { Integer tmp = Integer . getInteger ( "com.sun.security.ocsp.timeout" ) ; if ( tmp == null || tmp < 0 ) { return DEFAULT_CONNECT_TIMEOUT ; } return tmp * 1000 ; }
Initialize the timeout length by getting the OCSP timeout system property . If the property has not been set or if its value is negative set the timeout length to the default .
27,204
public static RevocationStatus check ( X509Certificate cert , X509Certificate issuerCert , URI responderURI , X509Certificate responderCert , Date date ) throws IOException , CertPathValidatorException { return check ( cert , issuerCert , responderURI , responderCert , date , Collections . < Extension > emptyList ( ) )...
Obtains the revocation status of a certificate using OCSP .
27,205
void linkBefore ( E e , Node < E > succ ) { final Node < E > pred = succ . prev ; final Node < E > newNode = new Node < > ( pred , e , succ ) ; succ . prev = newNode ; if ( pred == null ) first = newNode ; else pred . next = newNode ; size ++ ; modCount ++ ; }
Inserts element e before non - null Node succ .
27,206
private E unlinkFirst ( Node < E > f ) { final E element = f . item ; final Node < E > next = f . next ; f . item = null ; f . next = null ; first = next ; if ( next == null ) last = null ; else next . prev = null ; size -- ; modCount ++ ; return element ; }
Unlinks non - null first node f .
27,207
private E unlinkLast ( Node < E > l ) { final E element = l . item ; final Node < E > prev = l . prev ; l . item = null ; l . prev = null ; last = prev ; if ( prev == null ) first = null ; else prev . next = null ; size -- ; modCount ++ ; return element ; }
Unlinks non - null last node l .
27,208
public E getFirst ( ) { final Node < E > f = first ; if ( f == null ) throw new NoSuchElementException ( ) ; return f . item ; }
Returns the first element in this list .
27,209
public E getLast ( ) { final Node < E > l = last ; if ( l == null ) throw new NoSuchElementException ( ) ; return l . item ; }
Returns the last element in this list .
27,210
public E removeFirst ( ) { final Node < E > f = first ; if ( f == null ) throw new NoSuchElementException ( ) ; return unlinkFirst ( f ) ; }
Removes and returns the first element from this list .
27,211
public E removeLast ( ) { final Node < E > l = last ; if ( l == null ) throw new NoSuchElementException ( ) ; return unlinkLast ( l ) ; }
Removes and returns the last element from this list .
27,212
public Attributes getAttributes ( ) throws IOException { JarEntry e = getJarEntry ( ) ; return e != null ? e . getAttributes ( ) : null ; }
Return the Attributes object for this connection if the URL for it points to a JAR file entry null otherwise .
27,213
public Attributes getMainAttributes ( ) throws IOException { Manifest man = getManifest ( ) ; return man != null ? man . getMainAttributes ( ) : null ; }
Returns the main Attributes for the JAR file for this connection .
27,214
public void addRule ( TransliterationRule rule ) { ruleVector . add ( rule ) ; int len ; if ( ( len = rule . getAnteContextLength ( ) ) > maxContextLength ) { maxContextLength = len ; } rules = null ; }
Add a rule to this set . Rules are added in order and order is significant .
27,215
public void freeze ( ) { int n = ruleVector . size ( ) ; index = new int [ 257 ] ; List < TransliterationRule > v = new ArrayList < TransliterationRule > ( 2 * n ) ; int [ ] indexValue = new int [ n ] ; for ( int j = 0 ; j < n ; ++ j ) { TransliterationRule r = ruleVector . get ( j ) ; indexValue [ j ] = r . getIndexVa...
Close this rule set to further additions check it for masked rules and index it to optimize performance .
27,216
String toRules ( boolean escapeUnprintable ) { int i ; int count = ruleVector . size ( ) ; StringBuilder ruleSource = new StringBuilder ( ) ; for ( i = 0 ; i < count ; ++ i ) { if ( i != 0 ) { ruleSource . append ( '\n' ) ; } TransliterationRule r = ruleVector . get ( i ) ; ruleSource . append ( r . toRule ( escapeUnpr...
Create rule strings that represents this rule set .
27,217
private void fixVariableDeclarations ( SwitchStatement node ) { List < Statement > statements = node . getStatements ( ) ; Block block = new Block ( ) ; List < Statement > blockStmts = block . getStatements ( ) ; for ( int i = 0 ; i < statements . size ( ) ; i ++ ) { Statement stmt = statements . get ( i ) ; if ( stmt ...
Moves all variable declarations above the first case statement .
27,218
private static < T extends Annotation > void insertAnnotationValues ( Annotation annotation , Class < T > annotationClass , ArrayList < T > unfoldedAnnotations ) { Class < T [ ] > annotationArrayClass = ( Class < T [ ] > ) ( ( T [ ] ) Array . newInstance ( annotationClass , 0 ) ) . getClass ( ) ; Method valuesMethod ; ...
Extracts annotations from a container annotation and inserts them into a list .
27,219
public static boolean matchClassNamePrefix ( String actual , String expected ) { return actual . equals ( expected ) || actual . equals ( getCamelCase ( expected ) ) ; }
When reflection is stripped the transpiled code uses NSStringFromClass to return the name of a class . For example instead of getting something like java . lang . Throwable we get JavaLangThrowable .
27,220
public static long getSerialVersionUID ( Class < ? extends Serializable > clazz ) { try { return clazz . getField ( "serialVersionUID" ) . getLong ( null ) ; } catch ( NoSuchFieldException | IllegalAccessException ex ) { return 0 ; } }
Transpiled code that directly acccess the serialVersionUID field when reflection is stripped won t compile because this field is also stripped .
27,221
private void checkLabelBiDi ( CharSequence label , int labelStart , int labelLength , Info info ) { int c ; int i = labelStart ; c = Character . codePointAt ( label , i ) ; i += Character . charCount ( c ) ; int firstMask = U_MASK ( UBiDiProps . INSTANCE . getClass ( c ) ) ; if ( ( firstMask & ~ L_R_AL_MASK ) != 0 ) { ...
processing several earlier labels .
27,222
public static final int getKeySize ( Key key ) { int size = - 1 ; if ( key instanceof Length ) { try { Length ruler = ( Length ) key ; size = ruler . length ( ) ; } catch ( UnsupportedOperationException usoe ) { } if ( size >= 0 ) { return size ; } } if ( key instanceof SecretKey ) { SecretKey sk = ( SecretKey ) key ; ...
Returns the key size of the given key object in bits .
27,223
private static void validateDHPublicKey ( DHPublicKey publicKey ) throws InvalidKeyException { DHParameterSpec paramSpec = publicKey . getParams ( ) ; BigInteger p = paramSpec . getP ( ) ; BigInteger g = paramSpec . getG ( ) ; BigInteger y = publicKey . getY ( ) ; validateDHPublicKey ( p , g , y ) ; }
Returns whether the Diffie - Hellman public key is valid or not .
27,224
public static long doubleToLongBits ( double value ) { long result = doubleToRawLongBits ( value ) ; if ( ( ( result & DoubleConsts . EXP_BIT_MASK ) == DoubleConsts . EXP_BIT_MASK ) && ( result & DoubleConsts . SIGNIF_BIT_MASK ) != 0L ) result = 0x7ff8000000000000L ; return result ; }
Returns a representation of the specified floating - point value according to the IEEE 754 floating - point double format bit layout .
27,225
boolean removeMapping ( Object o ) { if ( ! ( o instanceof Map . Entry ) ) return false ; Entry < K , V > [ ] tab = getTable ( ) ; Map . Entry < ? , ? > entry = ( Map . Entry < ? , ? > ) o ; Object k = maskNull ( entry . getKey ( ) ) ; int h = sun . misc . Hashing . singleWordWangJenkinsHash ( k ) ; int i = indexFor ( ...
Special version of remove needed by Entry set
27,226
private boolean containsNullValue ( ) { Entry < K , V > [ ] tab = getTable ( ) ; for ( int i = tab . length ; i -- > 0 ; ) for ( Entry < K , V > e = tab [ i ] ; e != null ; e = e . next ) if ( e . value == null ) return true ; return false ; }
Special - case code for containsValue with null argument
27,227
private void redirectToJavaLoggerProxy ( ) { DefaultLoggerProxy lp = DefaultLoggerProxy . class . cast ( this . loggerProxy ) ; JavaLoggerProxy jlp = new JavaLoggerProxy ( lp . name , lp . level ) ; this . javaLoggerProxy = jlp ; this . loggerProxy = jlp ; }
Creates a new JavaLoggerProxy and redirects the platform logger to it
27,228
public void setLevel ( int newLevel ) { loggerProxy . setLevel ( newLevel == 0 ? null : Level . valueOf ( newLevel ) ) ; }
Sets the log level .
27,229
public boolean isLoggable ( Level level ) { if ( level == null ) { throw new NullPointerException ( ) ; } JavaLoggerProxy jlp = javaLoggerProxy ; return jlp != null ? jlp . isLoggable ( level ) : loggerProxy . isLoggable ( level ) ; }
Returns true if a message of the given level would actually be logged by this logger .
27,230
static int tieBreakOrder ( Object a , Object b ) { int d ; if ( a == null || b == null || ( d = a . getClass ( ) . getName ( ) . compareTo ( b . getClass ( ) . getName ( ) ) ) == 0 ) d = ( System . identityHashCode ( a ) <= System . identityHashCode ( b ) ? - 1 : 1 ) ; return d ; }
Tie - breaking utility for ordering insertions when equal hashCodes and non - comparable . We don t require a total order just a consistent insertion rule to maintain equivalence across rebalancings . Tie - breaking further than necessary simplifies testing a bit .
27,231
private final void contendedLock ( ) { boolean waiting = false ; for ( int s ; ; ) { if ( ( ( s = lockState ) & ~ WAITER ) == 0 ) { if ( U . compareAndSwapInt ( this , LOCKSTATE , s , WRITER ) ) { if ( waiting ) waiter = null ; return ; } } else if ( ( s & WAITER ) == 0 ) { if ( U . compareAndSwapInt ( this , LOCKSTATE...
Possibly blocks awaiting root lock .
27,232
final Node < K , V > find ( int h , Object k ) { if ( k != null ) { for ( Node < K , V > e = first ; e != null ; ) { int s ; K ek ; if ( ( ( s = lockState ) & ( WAITER | WRITER ) ) != 0 ) { if ( e . hash == h && ( ( ek = e . key ) == k || ( ek != null && k . equals ( ek ) ) ) ) return e ; e = e . next ; } else if ( U ....
Returns matching node or null if none . Tries to search using tree comparisons from root but continues linear search when lock not available .
27,233
final TreeNode < K , V > putTreeVal ( int h , K k , V v ) { Class < ? > kc = null ; boolean searched = false ; for ( TreeNode < K , V > p = root ; ; ) { int dir , ph ; K pk ; if ( p == null ) { first = root = new TreeNode < K , V > ( h , k , v , null , null ) ; break ; } else if ( ( ph = p . hash ) > h ) dir = - 1 ; el...
Finds or adds a node .
27,234
static < K , V > TreeNode < K , V > rotateLeft ( TreeNode < K , V > root , TreeNode < K , V > p ) { TreeNode < K , V > r , pp , rl ; if ( p != null && ( r = p . right ) != null ) { if ( ( rl = p . right = r . left ) != null ) rl . parent = p ; if ( ( pp = r . parent = p . parent ) == null ) ( root = r ) . red = false ;...
Red - black tree methods all adapted from CLR
27,235
static < K , V > boolean checkInvariants ( TreeNode < K , V > t ) { TreeNode < K , V > tp = t . parent , tl = t . left , tr = t . right , tb = t . prev , tn = ( TreeNode < K , V > ) t . next ; if ( tb != null && tb . next != t ) return false ; if ( tn != null && tn . prev != t ) return false ; if ( tp != null && t != t...
Checks invariants recursively for the tree of Nodes rooted at t .
27,236
final Node < K , V > advance ( ) { Node < K , V > e ; if ( ( e = next ) != null ) e = e . next ; for ( ; ; ) { Node < K , V > [ ] t ; int i , n ; if ( e != null ) return next = e ; if ( baseIndex >= baseLimit || ( t = tab ) == null || ( n = t . length ) <= ( i = index ) || i < 0 ) return next = null ; if ( ( e = tabAt ...
Advances if possible returning next valid node or null if none .
27,237
private void pushState ( Node < K , V > [ ] t , int i , int n ) { TableStack < K , V > s = spare ; if ( s != null ) spare = s . next ; else s = new TableStack < K , V > ( ) ; s . tab = t ; s . length = n ; s . index = i ; s . next = stack ; stack = s ; }
Saves traversal state upon encountering a forwarding node .
27,238
private void recoverState ( int n ) { TableStack < K , V > s ; int len ; while ( ( s = stack ) != null && ( index += ( len = s . length ) ) >= n ) { n = len ; index = s . index ; tab = s . tab ; s . tab = null ; TableStack < K , V > next = s . next ; s . next = spare ; stack = next ; spare = s ; } if ( s == null && ( i...
Possibly pops traversal state .
27,239
public final UnicodeSet applyPattern ( String pattern ) { checkFrozen ( ) ; return applyPattern ( pattern , null , null , IGNORE_SPACE ) ; }
Modifies this set to represent the set specified by the given pattern . See the class description for the syntax of the pattern language . Whitespace is ignored .
27,240
public UnicodeSet applyPattern ( String pattern , int options ) { checkFrozen ( ) ; return applyPattern ( pattern , null , null , options ) ; }
Modifies this set to represent the set specified by the given pattern optionally ignoring whitespace . See the class description for the syntax of the pattern language .
27,241
public static boolean resemblesPattern ( String pattern , int pos ) { return ( ( pos + 1 ) < pattern . length ( ) && pattern . charAt ( pos ) == '[' ) || resemblesPropertyPattern ( pattern , pos ) ; }
Return true if the given position in the given pattern appears to be the start of a UnicodeSet pattern .
27,242
public String toPattern ( boolean escapeUnprintable ) { if ( pat != null && ! escapeUnprintable ) { return pat ; } StringBuilder result = new StringBuilder ( ) ; return _toPattern ( result , escapeUnprintable ) . toString ( ) ; }
Returns a string representation of this set . If the result of calling this function is passed to a UnicodeSet constructor it will produce another set that is equal to this one .
27,243
public int matchesAt ( CharSequence text , int offset ) { int lastLen = - 1 ; strings : if ( strings . size ( ) != 0 ) { char firstChar = text . charAt ( offset ) ; String trial = null ; Iterator < String > it = strings . iterator ( ) ; while ( it . hasNext ( ) ) { trial = it . next ( ) ; char firstStringChar = trial ....
Tests whether the text matches at the offset . If so returns the end of the longest substring that it matches . If not returns - 1 .
27,244
private UnicodeSet add_unchecked ( int start , int end ) { if ( start < MIN_VALUE || start > MAX_VALUE ) { throw new IllegalArgumentException ( "Invalid code point U+" + Utility . hex ( start , 6 ) ) ; } if ( end < MIN_VALUE || end > MAX_VALUE ) { throw new IllegalArgumentException ( "Invalid code point U+" + Utility ....
for internal use after checkFrozen has been called
27,245
private final UnicodeSet add_unchecked ( int c ) { if ( c < MIN_VALUE || c > MAX_VALUE ) { throw new IllegalArgumentException ( "Invalid code point U+" + Utility . hex ( c , 6 ) ) ; } int i = findCodePoint ( c ) ; if ( ( i & 1 ) != 0 ) return this ; if ( c == list [ i ] - 1 ) { list [ i ] = c ; if ( c == MAX_VALUE ) { ...
for internal use only after checkFrozen has been called
27,246
public final UnicodeSet retain ( CharSequence cs ) { int cp = getSingleCP ( cs ) ; if ( cp < 0 ) { String s = cs . toString ( ) ; boolean isIn = strings . contains ( s ) ; if ( isIn && size ( ) == 1 ) { return this ; } clear ( ) ; strings . add ( s ) ; pat = null ; } else { retain ( cp , cp ) ; } return this ; }
Retain the specified string in this set if it is present . Upon return this set will be empty if it did not contain s or will only contain s if it did contain s .
27,247
public final UnicodeSet remove ( CharSequence s ) { int cp = getSingleCP ( s ) ; if ( cp < 0 ) { strings . remove ( s . toString ( ) ) ; pat = null ; } else { remove ( cp , cp ) ; } return this ; }
Removes the specified string from this set if it is present . The set will not contain the specified string once the call returns .
27,248
public boolean contains ( int c ) { if ( c < MIN_VALUE || c > MAX_VALUE ) { throw new IllegalArgumentException ( "Invalid code point U+" + Utility . hex ( c , 6 ) ) ; } if ( bmpSet != null ) { return bmpSet . contains ( c ) ; } if ( stringSpan != null ) { return stringSpan . contains ( c ) ; } int i = findCodePoint ( c...
Returns true if this set contains the given character .
27,249
public boolean contains ( int start , int end ) { if ( start < MIN_VALUE || start > MAX_VALUE ) { throw new IllegalArgumentException ( "Invalid code point U+" + Utility . hex ( start , 6 ) ) ; } if ( end < MIN_VALUE || end > MAX_VALUE ) { throw new IllegalArgumentException ( "Invalid code point U+" + Utility . hex ( en...
Returns true if this set contains every character of the given range .
27,250
public boolean containsAll ( UnicodeSet b ) { int [ ] listB = b . list ; boolean needA = true ; boolean needB = true ; int aPtr = 0 ; int bPtr = 0 ; int aLen = len - 1 ; int bLen = b . len - 1 ; int startA = 0 , startB = 0 , limitA = 0 , limitB = 0 ; while ( true ) { if ( needA ) { if ( aPtr >= aLen ) { if ( needB && b...
Returns true if this set contains all the characters and strings of the given set .
27,251
private boolean containsAll ( String s , int i ) { if ( i >= s . length ( ) ) { return true ; } int cp = UTF16 . charAt ( s , i ) ; if ( contains ( cp ) && containsAll ( s , i + UTF16 . getCharCount ( cp ) ) ) { return true ; } for ( String setStr : strings ) { if ( s . startsWith ( setStr , i ) && containsAll ( s , i ...
Recursive routine called if we fail to find a match in containsAll and there are strings
27,252
public String getRegexEquivalent ( ) { if ( strings . size ( ) == 0 ) { return toString ( ) ; } StringBuilder result = new StringBuilder ( "(?:" ) ; appendNewPattern ( result , true , false ) ; for ( String s : strings ) { result . append ( '|' ) ; _appendToPat ( result , s , true ) ; } return result . append ( ")" ) ....
Get the Regex equivalent for this UnicodeSet
27,253
public boolean containsNone ( int start , int end ) { if ( start < MIN_VALUE || start > MAX_VALUE ) { throw new IllegalArgumentException ( "Invalid code point U+" + Utility . hex ( start , 6 ) ) ; } if ( end < MIN_VALUE || end > MAX_VALUE ) { throw new IllegalArgumentException ( "Invalid code point U+" + Utility . hex ...
Returns true if this set contains none of the characters of the given range .
27,254
public UnicodeSet complementAll ( UnicodeSet c ) { checkFrozen ( ) ; xor ( c . list , c . len , 0 ) ; SortedSetRelation . doOperation ( strings , SortedSetRelation . COMPLEMENTALL , c . strings ) ; return this ; }
Complements in this set all elements contained in the specified set . Any character in the other set will be removed if it is in this set or will be added if it is not in this set .
27,255
public UnicodeSet clear ( ) { checkFrozen ( ) ; list [ 0 ] = HIGH ; len = 1 ; pat = null ; strings . clear ( ) ; return this ; }
Removes all of the elements from this set . This set will be empty after this call returns .
27,256
public UnicodeSet compact ( ) { checkFrozen ( ) ; if ( len != list . length ) { int [ ] temp = new int [ len ] ; System . arraycopy ( list , 0 , temp , 0 , len ) ; list = temp ; } rangeList = null ; buffer = null ; return this ; }
Reallocate this objects internal structures to take up the least possible space without changing this object s value .
27,257
private int [ ] range ( int start , int end ) { if ( rangeList == null ) { rangeList = new int [ ] { start , end + 1 , HIGH } ; } else { rangeList [ 0 ] = start ; rangeList [ 1 ] = end + 1 ; } return rangeList ; }
Assumes start < = end .
27,258
private UnicodeSet applyFilter ( Filter filter , int src ) { clear ( ) ; int startHasProperty = - 1 ; UnicodeSet inclusions = getInclusions ( src ) ; int limitRange = inclusions . getRangeCount ( ) ; for ( int j = 0 ; j < limitRange ; ++ j ) { int start = inclusions . getRangeStart ( j ) ; int end = inclusions . getRan...
Generic filter - based scanning code for UCD property UnicodeSets .
27,259
private static String mungeCharName ( String source ) { source = PatternProps . trimWhiteSpace ( source ) ; StringBuilder buf = null ; for ( int i = 0 ; i < source . length ( ) ; ++ i ) { char ch = source . charAt ( i ) ; if ( PatternProps . isWhiteSpace ( ch ) ) { if ( buf == null ) { buf = new StringBuilder ( ) . app...
Remove leading and trailing Pattern_White_Space and compress internal Pattern_White_Space to a single space character .
27,260
public UnicodeSet applyIntPropertyValue ( int prop , int value ) { checkFrozen ( ) ; if ( prop == UProperty . GENERAL_CATEGORY_MASK ) { applyFilter ( new GeneralCategoryMaskFilter ( value ) , UCharacterProperty . SRC_CHAR ) ; } else if ( prop == UProperty . SCRIPT_EXTENSIONS ) { applyFilter ( new ScriptExtensionsFilter...
Modifies this set to contain those code points which have the given value for the given binary or enumerated property as returned by UCharacter . getIntPropertyValue . Prior contents of this set are lost .
27,261
private static boolean resemblesPropertyPattern ( String pattern , int pos ) { if ( ( pos + 5 ) > pattern . length ( ) ) { return false ; } return pattern . regionMatches ( pos , "[:" , 0 , 2 ) || pattern . regionMatches ( true , pos , "\\p" , 0 , 2 ) || pattern . regionMatches ( pos , "\\N" , 0 , 2 ) ; }
Return true if the given position in the given pattern appears to be the start of a property set pattern .
27,262
private static boolean resemblesPropertyPattern ( RuleCharacterIterator chars , int iterOpts ) { boolean result = false ; iterOpts &= ~ RuleCharacterIterator . PARSE_ESCAPES ; Object pos = chars . getPos ( null ) ; int c = chars . next ( iterOpts ) ; if ( c == '[' || c == '\\' ) { int d = chars . next ( iterOpts & ~ Ru...
Return true if the given iterator appears to point at a property pattern . Regardless of the result return with the iterator unchanged .
27,263
private UnicodeSet applyPropertyPattern ( String pattern , ParsePosition ppos , SymbolTable symbols ) { int pos = ppos . getIndex ( ) ; if ( ( pos + 5 ) > pattern . length ( ) ) { return null ; } boolean posix = false ; boolean isName = false ; boolean invert = false ; if ( pattern . regionMatches ( pos , "[:" , 0 , 2 ...
Parse the given property pattern at the given parse position .
27,264
private void applyPropertyPattern ( RuleCharacterIterator chars , Appendable rebuiltPat , SymbolTable symbols ) { String patStr = chars . lookahead ( ) ; ParsePosition pos = new ParsePosition ( 0 ) ; applyPropertyPattern ( patStr , pos , symbols ) ; if ( pos . getIndex ( ) == 0 ) { syntaxError ( chars , "Invalid proper...
Parse a property pattern .
27,265
private static final void addCaseMapping ( UnicodeSet set , int result , StringBuilder full ) { if ( result >= 0 ) { if ( result > UCaseProps . MAX_STRING_LENGTH ) { set . add ( result ) ; } else { set . add ( full . toString ( ) ) ; full . setLength ( 0 ) ; } } }
use str as a temporary string to avoid constructing one
27,266
public UnicodeSet freeze ( ) { if ( ! isFrozen ( ) ) { buffer = null ; if ( list . length > ( len + GROW_EXTRA ) ) { int capacity = ( len == 0 ) ? 1 : len ; int [ ] oldList = list ; list = new int [ capacity ] ; for ( int i = capacity ; i -- > 0 ; ) { list [ i ] = oldList [ i ] ; } } if ( ! strings . isEmpty ( ) ) { st...
Freeze this class according to the Freezable interface .
27,267
public int compareTo ( UnicodeSet o , ComparisonStyle style ) { if ( style != ComparisonStyle . LEXICOGRAPHIC ) { int diff = size ( ) - o . size ( ) ; if ( diff != 0 ) { return ( diff < 0 ) == ( style == ComparisonStyle . SHORTER_FIRST ) ? - 1 : 1 ; } } int result ; for ( int i = 0 ; ; ++ i ) { if ( 0 != ( result = lis...
Compares UnicodeSets in three different ways .
27,268
public static < T extends Comparable < T > > int compare ( Collection < T > collection1 , Collection < T > collection2 , ComparisonStyle style ) { if ( style != ComparisonStyle . LEXICOGRAPHIC ) { int diff = collection1 . size ( ) - collection2 . size ( ) ; if ( diff != 0 ) { return ( diff < 0 ) == ( style == Compariso...
Utility to compare two collections optionally by size and then lexicographically .
27,269
public final void init ( byte [ ] params ) throws IOException { if ( this . initialized ) throw new IOException ( "already initialized" ) ; paramSpi . engineInit ( params ) ; this . initialized = true ; }
Imports the specified parameters and decodes them according to the primary decoding format for parameters . The primary decoding format for parameters is ASN . 1 if an ASN . 1 specification for this type of parameters exists .
27,270
private boolean areElementsSame ( int index1 , int [ ] target , int index2 , int length ) { for ( int i = 0 ; i < length ; ++ i ) { if ( v [ index1 + i ] != target [ index2 + i ] ) { return false ; } } return true ; }
starting from index2 to index2 + length - 1
27,271
private int findRow ( int rangeStart ) { int index = 0 ; index = prevRow * columns ; if ( rangeStart >= v [ index ] ) { if ( rangeStart < v [ index + 1 ] ) { return index ; } else { index += columns ; if ( rangeStart < v [ index + 1 ] ) { ++ prevRow ; return index ; } else { index += columns ; if ( rangeStart < v [ ind...
points to the start of a row .
27,272
public static boolean isWeak ( byte [ ] key , int offset ) throws InvalidKeyException { if ( key == null ) { throw new InvalidKeyException ( "null key" ) ; } if ( key . length - offset < DES_KEY_LEN ) { throw new InvalidKeyException ( "Wrong key size" ) ; } for ( int i = 0 ; i < WEAK_KEYS . length ; i ++ ) { boolean fo...
Checks if the given DES key material is weak or semi - weak .
27,273
public static boolean hasValidCppCharacters ( String s ) { for ( char c : s . toCharArray ( ) ) { if ( ! isValidCppCharacter ( c ) ) { return false ; } } return true ; }
Returns true if all characters in a string can be expressed as either C ++ universal characters or valid hexadecimal escape sequences .
27,274
private byte [ ] embiggen ( byte [ ] b , int len ) { if ( b == null || b . length < len ) { return new byte [ len ] ; } else { return b ; } }
If b . length is at least len return b . Otherwise return a new byte array of length len .
27,275
void shrink ( ) { int n = m_opMap . elementAt ( MAPINDEX_LENGTH ) ; m_opMap . setToSize ( n + 4 ) ; m_opMap . setElementAt ( 0 , n ) ; m_opMap . setElementAt ( 0 , n + 1 ) ; m_opMap . setElementAt ( 0 , n + 2 ) ; n = m_tokenQueue . size ( ) ; m_tokenQueue . setToSize ( n + 4 ) ; m_tokenQueue . setElementAt ( null , n )...
Replace the large arrays with a small array .
27,276
public int getNextStepPos ( int opPos ) { int stepType = getOp ( opPos ) ; if ( ( stepType >= OpCodes . AXES_START_TYPES ) && ( stepType <= OpCodes . AXES_END_TYPES ) ) { return getNextOpPos ( opPos ) ; } else if ( ( stepType >= OpCodes . FIRST_NODESET_OP ) && ( stepType <= OpCodes . LAST_NODESET_OP ) ) { int newOpPos ...
Given a location step position return the end position i . e . the beginning of the next step .
27,277
public String getStepNS ( int opPosOfStep ) { int argLenOfStep = getArgLengthOfStep ( opPosOfStep ) ; if ( argLenOfStep == 3 ) { int index = m_opMap . elementAt ( opPosOfStep + 4 ) ; if ( index >= 0 ) return ( String ) m_tokenQueue . elementAt ( index ) ; else if ( OpCodes . ELEMWILDCARD == index ) return NodeTest . WI...
Get the namespace of the step .
27,278
private void parseIPv4 ( String name ) throws IOException { int slashNdx = name . indexOf ( '/' ) ; if ( slashNdx == - 1 ) { address = InetAddress . getByName ( name ) . getAddress ( ) ; } else { address = new byte [ 8 ] ; byte [ ] mask = InetAddress . getByName ( name . substring ( slashNdx + 1 ) ) . getAddress ( ) ; ...
Parse an IPv4 address .
27,279
public int compareTo ( Object o ) { ObjectStreamField f = ( ObjectStreamField ) o ; boolean thisPrimitive = this . isPrimitive ( ) ; boolean fPrimitive = f . isPrimitive ( ) ; if ( thisPrimitive != fPrimitive ) { return thisPrimitive ? - 1 : 1 ; } return this . getName ( ) . compareTo ( f . getName ( ) ) ; }
Compares this field descriptor to the specified one . Checks first if one of the compared fields has a primitive type and the other one not . If so the field with the primitive type is considered to be smaller . If both fields are equal their names are compared .
27,280
public Class < ? > getType ( ) { Class < ? > cl = getTypeInternal ( ) ; if ( isDeserialized && ! cl . isPrimitive ( ) ) { return Object . class ; } return cl ; }
Gets the type of this field .
27,281
public String getTypeString ( ) { if ( isPrimitive ( ) ) { return null ; } if ( typeString == null ) { Class < ? > t = getTypeInternal ( ) ; String typeName = t . getName ( ) . replace ( '.' , '/' ) ; String str = ( t . isArray ( ) ) ? typeName : ( "L" + typeName + ';' ) ; typeString = str . intern ( ) ; } return typeS...
Gets the type signature used by the VM to represent the type of this field .
27,282
private boolean defaultResolve ( ) { switch ( typeString . charAt ( 0 ) ) { case 'I' : type = int . class ; return true ; case 'B' : type = byte . class ; return true ; case 'C' : type = char . class ; return true ; case 'S' : type = short . class ; return true ; case 'Z' : type = boolean . class ; return true ; case '...
Resolves typeString into type . Returns true if the type is primitive and false otherwise .
27,283
private void addReturnTypeNarrowingDeclarations ( AbstractTypeDeclaration node ) { TypeElement type = node . getTypeElement ( ) ; if ( deadCodeMap != null && deadCodeMap . containsClass ( type , elementUtil ) ) { return ; } Map < String , ExecutablePair > newDeclarations = new HashMap < > ( ) ; Map < String , TypeMirro...
specific than what is already declared in inherited types .
27,284
public Stream < P_OUT > unordered ( ) { if ( ! isOrdered ( ) ) return this ; return new StatelessOp < P_OUT , P_OUT > ( this , StreamShape . REFERENCE , StreamOpFlag . NOT_ORDERED ) { public Sink < P_OUT > opWrapSink ( int flags , Sink < P_OUT > sink ) { return sink ; } } ; }
Stateless intermediate operations from Stream
27,285
public void forEach ( Consumer < ? super P_OUT > action ) { evaluate ( ForEachOps . makeRef ( action , false ) ) ; }
Terminal operations from Stream
27,286
public void clearLocalSlots ( int start , int len ) { start += _currentFrameBottom ; System . arraycopy ( m_nulls , 0 , _stackFrames , start , len ) ; }
Use this to clear the variables in a section of the stack . This is used to clear the parameter section of the stack so that default param values can tell if they ve already been set . It is important to note that this function has a 1K limitation .
27,287
public XObject getGlobalVariable ( XPathContext xctxt , final int index ) throws TransformerException { XObject val = _stackFrames [ index ] ; if ( val . getType ( ) == XObject . CLASS_UNRESOLVEDVARIABLE ) return ( _stackFrames [ index ] = val . execute ( xctxt ) ) ; return val ; }
Get a global variable or parameter from the global stack frame .
27,288
public XObject getVariableOrParam ( XPathContext xctxt , org . apache . xml . utils . QName qname ) throws javax . xml . transform . TransformerException { org . apache . xml . utils . PrefixResolver prefixResolver = xctxt . getNamespaceContext ( ) ; if ( prefixResolver instanceof org . apache . xalan . templates . Ele...
Get a variable based on it s qualified name . This is for external use only .
27,289
public Gender getListGender ( List < Gender > genders ) { if ( genders . size ( ) == 0 ) { return Gender . OTHER ; } if ( genders . size ( ) == 1 ) { return genders . get ( 0 ) ; } switch ( style ) { case NEUTRAL : return Gender . OTHER ; case MIXED_NEUTRAL : boolean hasFemale = false ; boolean hasMale = false ; for ( ...
Get the gender of a list based on locale usage .
27,290
public void encode ( DerOutputStream out ) throws IOException { DerOutputStream tmp = new DerOutputStream ( ) ; name . encode ( tmp ) ; int nameType = name . getType ( ) ; if ( nameType == GeneralNameInterface . NAME_ANY || nameType == GeneralNameInterface . NAME_X400 || nameType == GeneralNameInterface . NAME_EDI ) { ...
Encode the name to the specified DerOutputStream .
27,291
protected int handleGetExtendedYear ( ) { int year ; if ( newestStamp ( ERA , YEAR , UNSET ) <= getStamp ( EXTENDED_YEAR ) ) { year = internalGet ( EXTENDED_YEAR , 1 ) ; } else { int cycle = internalGet ( ERA , 1 ) - 1 ; year = cycle * 60 + internalGet ( YEAR , 1 ) - ( epochYear - CHINESE_EPOCH_YEAR ) ; } return year ;...
Implement abstract Calendar method to return the extended year defined by the current fields . This will use either the ERA and YEAR field as the cycle and year - of - cycle or the EXTENDED_YEAR field as the continuous year count depending on which is newer .
27,292
protected int handleGetMonthLength ( int extendedYear , int month ) { int thisStart = handleComputeMonthStart ( extendedYear , month , true ) - EPOCH_JULIAN_DAY + 1 ; int nextStart = newMoonNear ( thisStart + SYNODIC_GAP , true ) ; return nextStart - thisStart ; }
Override Calendar method to return the number of days in the given extended year and month .
27,293
private int newMoonNear ( int days , boolean after ) { astro . setTime ( daysToMillis ( days ) ) ; long newMoon = astro . getMoonTime ( CalendarAstronomer . NEW_MOON , after ) ; return millisToDays ( newMoon ) ; }
Return the closest new moon to the given date searching either forward or backward in time .
27,294
private int majorSolarTerm ( int days ) { astro . setTime ( daysToMillis ( days ) ) ; int term = ( ( int ) Math . floor ( 6 * astro . getSunLongitude ( ) / Math . PI ) + 2 ) % 12 ; if ( term < 1 ) { term += 12 ; } return term ; }
Return the major solar term on or before a given date . This will be an integer from 1 .. 12 with 1 corresponding to 330 degrees 2 to 0 degrees 3 to 30 degrees ... and 12 to 300 degrees .
27,295
private boolean hasNoMajorSolarTerm ( int newMoon ) { int mst = majorSolarTerm ( newMoon ) ; int nmn = newMoonNear ( newMoon + SYNODIC_GAP , true ) ; int mstt = majorSolarTerm ( nmn ) ; return mst == mstt ; }
Return true if the given month lacks a major solar term .
27,296
private boolean isLeapMonthBetween ( int newMoon1 , int newMoon2 ) { if ( synodicMonthsBetween ( newMoon1 , newMoon2 ) >= 50 ) { throw new IllegalArgumentException ( "isLeapMonthBetween(" + newMoon1 + ", " + newMoon2 + "): Invalid parameters" ) ; } return ( newMoon2 >= newMoon1 ) && ( isLeapMonthBetween ( newMoon1 , ne...
Return true if there is a leap month on or after month newMoon1 and at or before month newMoon2 .
27,297
private int newYear ( int gyear ) { long cacheValue = newYearCache . get ( gyear ) ; if ( cacheValue == CalendarCache . EMPTY ) { int solsticeBefore = winterSolstice ( gyear - 1 ) ; int solsticeAfter = winterSolstice ( gyear ) ; int newMoon1 = newMoonNear ( solsticeBefore + 1 , true ) ; int newMoon2 = newMoonNear ( new...
Return the Chinese new year of the given Gregorian year .
27,298
protected int handleComputeMonthStart ( int eyear , int month , boolean useMonth ) { if ( month < 0 || month > 11 ) { int [ ] rem = new int [ 1 ] ; eyear += floorDivide ( month , 12 , rem ) ; month = rem [ 0 ] ; } int gyear = eyear + epochYear - 1 ; int newYear = newYear ( gyear ) ; int newMoon = newMoonNear ( newYear ...
Return the Julian day number of day before the first day of the given month in the given extended year .
27,299
private void readObject ( ObjectInputStream stream ) throws IOException , ClassNotFoundException { epochYear = CHINESE_EPOCH_YEAR ; zoneAstro = CHINA_ZONE ; stream . defaultReadObject ( ) ; astro = new CalendarAstronomer ( ) ; winterSolsticeCache = new CalendarCache ( ) ; newYearCache = new CalendarCache ( ) ; }
Override readObject .