idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
26,200
protected BitArray getKey ( ) { this . bitStringKey = new BitArray ( this . key . length * 8 - this . unusedBits , this . key ) ; return ( BitArray ) bitStringKey . clone ( ) ; }
Gets the key . The key may or may not be byte aligned .
26,201
public static PublicKey parse ( DerValue in ) throws IOException { AlgorithmId algorithm ; PublicKey subjectKey ; if ( in . tag != DerValue . tag_Sequence ) throw new IOException ( "corrupt subject key" ) ; algorithm = AlgorithmId . parse ( in . data . getDerValue ( ) ) ; try { subjectKey = buildX509Key ( algorithm , i...
Construct X . 509 subject public key from a DER value . If the runtime environment is configured with a specific class for this kind of key a subclass is returned . Otherwise a generic X509Key object is returned .
26,202
private void readObject ( ObjectInputStream stream ) throws IOException { try { decode ( stream ) ; } catch ( InvalidKeyException e ) { e . printStackTrace ( ) ; throw new IOException ( "deserialized key is invalid: " + e . getMessage ( ) ) ; } }
Serialization read ... X . 509 keys serialize as themselves and they re parsed when they get read back .
26,203
public void valid ( Date now ) throws CertificateNotYetValidException , CertificateExpiredException { if ( notBefore . after ( now ) ) { throw new CertificateNotYetValidException ( "NotBefore: " + notBefore . toString ( ) ) ; } if ( notAfter . before ( now ) ) { throw new CertificateExpiredException ( "NotAfter: " + no...
Verify that that the passed time is within the validity period .
26,204
public boolean getFeature ( String name ) throws SAXNotRecognizedException , SAXNotSupportedException { if ( name == null ) { throw new NullPointerException ( "name == null" ) ; } throw new SAXNotRecognizedException ( name ) ; }
Look up the value of a feature flag .
26,205
public void setFeature ( String name , boolean value ) throws SAXNotRecognizedException , SAXNotSupportedException { if ( name == null ) { throw new NullPointerException ( "name == null" ) ; } throw new SAXNotRecognizedException ( name ) ; }
Set the value of a feature flag .
26,206
private final void internalBuildTailoring ( String rules ) throws Exception { CollationTailoring base = CollationRoot . getRoot ( ) ; ClassLoader classLoader = ClassLoaderUtil . getClassLoader ( getClass ( ) ) ; CollationTailoring t ; try { Class < ? > builderClass = classLoader . loadClass ( "android.icu.impl.coll.Col...
Implements from - rule constructors .
26,207
public CollationElementIterator getCollationElementIterator ( CharacterIterator source ) { initMaxExpansions ( ) ; CharacterIterator newsource = ( CharacterIterator ) source . clone ( ) ; return new CollationElementIterator ( newsource , this ) ; }
Return a CollationElementIterator for the given CharacterIterator . The source iterator s integrity will be preserved since a new copy will be created for use .
26,208
public Collator freeze ( ) { if ( ! isFrozen ( ) ) { frozenLock = new ReentrantLock ( ) ; if ( collationBuffer == null ) { collationBuffer = new CollationBuffer ( data ) ; } } return this ; }
Freezes the collator .
26,209
public RuleBasedCollator cloneAsThawed ( ) { try { RuleBasedCollator result = ( RuleBasedCollator ) super . clone ( ) ; result . settings = settings . clone ( ) ; result . collationBuffer = null ; result . frozenLock = null ; return result ; } catch ( CloneNotSupportedException e ) { return null ; } }
Provides for the clone operation . Any clone is initially unfrozen .
26,210
public void setUpperCaseFirst ( boolean upperfirst ) { checkNotFrozen ( ) ; if ( upperfirst == isUpperCaseFirst ( ) ) { return ; } CollationSettings ownedSettings = getOwnedSettings ( ) ; ownedSettings . setCaseFirst ( upperfirst ? CollationSettings . CASE_FIRST_AND_UPPER_MASK : 0 ) ; setFastLatinOptions ( ownedSetting...
Sets whether uppercase characters sort before lowercase characters or vice versa in strength TERTIARY . The default mode is false and so lowercase characters sort before uppercase characters . If true sort upper case characters first .
26,211
public void setLowerCaseFirst ( boolean lowerfirst ) { checkNotFrozen ( ) ; if ( lowerfirst == isLowerCaseFirst ( ) ) { return ; } CollationSettings ownedSettings = getOwnedSettings ( ) ; ownedSettings . setCaseFirst ( lowerfirst ? CollationSettings . CASE_FIRST : 0 ) ; setFastLatinOptions ( ownedSettings ) ; }
Sets the orders of lower cased characters to sort before upper cased characters in strength TERTIARY . The default mode is false . If true is set the RuleBasedCollator will sort lower cased characters before the upper cased ones . Otherwise if false is set the RuleBasedCollator will ignore case preferences .
26,212
public void setNumericCollationDefault ( ) { checkNotFrozen ( ) ; CollationSettings defaultSettings = getDefaultSettings ( ) ; if ( settings . readOnly ( ) == defaultSettings ) { return ; } CollationSettings ownedSettings = getOwnedSettings ( ) ; ownedSettings . setFlagDefault ( CollationSettings . NUMERIC , defaultSet...
Method to set numeric collation to its default value .
26,213
public void setDecomposition ( int decomposition ) { checkNotFrozen ( ) ; boolean flag ; switch ( decomposition ) { case NO_DECOMPOSITION : flag = false ; break ; case CANONICAL_DECOMPOSITION : flag = true ; break ; default : throw new IllegalArgumentException ( "Wrong decomposition mode." ) ; } if ( flag == settings ....
Sets the decomposition mode of this Collator . Setting this decomposition attribute with CANONICAL_DECOMPOSITION allows the Collator to handle un - normalized text properly producing the same results as if the text were normalized . If NO_DECOMPOSITION is set it is the user s responsibility to insure that all text is a...
26,214
public void setStrength ( int newStrength ) { checkNotFrozen ( ) ; if ( newStrength == getStrength ( ) ) { return ; } CollationSettings ownedSettings = getOwnedSettings ( ) ; ownedSettings . setStrength ( newStrength ) ; setFastLatinOptions ( ownedSettings ) ; }
Sets this Collator s strength attribute . The strength attribute determines the minimum level of difference considered significant during comparison .
26,215
public UnicodeSet getTailoredSet ( ) { UnicodeSet tailored = new UnicodeSet ( ) ; if ( data . base != null ) { new TailoredSet ( tailored ) . forData ( data ) ; } return tailored ; }
Get a UnicodeSet that contains all the characters and sequences tailored in this collator .
26,216
void internalAddContractions ( int c , UnicodeSet set ) { new ContractionsAndExpansions ( set , null , null , false ) . forCodePoint ( data , c ) ; }
Adds the contractions that start with character c to the set . Ignores prefixes . Used by AlphabeticIndex .
26,217
public RawCollationKey getRawCollationKey ( String source , RawCollationKey key ) { if ( source == null ) { return null ; } CollationBuffer buffer = null ; try { buffer = getCollationBuffer ( ) ; return getRawCollationKey ( source , key , buffer ) ; } finally { releaseCollationBuffer ( buffer ) ; } }
Gets the simpler form of a CollationKey for the String source following the rules of this Collator and stores the result into the user provided argument key . If key has a internal byte array of length that s too small for the result the internal byte array will be grown to the exact required size .
26,218
public long [ ] internalGetCEs ( CharSequence str ) { CollationBuffer buffer = null ; try { buffer = getCollationBuffer ( ) ; boolean numeric = settings . readOnly ( ) . isNumeric ( ) ; CollationIterator iter ; if ( settings . readOnly ( ) . dontCheckFCD ( ) ) { buffer . leftUTF16CollIter . setText ( numeric , str , 0 ...
Returns the CEs for the string .
26,219
public VersionInfo getVersion ( ) { int version = tailoring . version ; int rtVersion = VersionInfo . UCOL_RUNTIME_VERSION . getMajor ( ) ; return VersionInfo . getInstance ( ( version >>> 24 ) + ( rtVersion << 4 ) + ( rtVersion >> 4 ) , ( ( version >> 16 ) & 0xff ) , ( ( version >> 8 ) & 0xff ) , ( version & 0xff ) ) ...
Get the version of this collator object .
26,220
public VersionInfo getUCAVersion ( ) { VersionInfo v = getVersion ( ) ; return VersionInfo . getInstance ( v . getMinor ( ) >> 3 , v . getMinor ( ) & 7 , v . getMilli ( ) >> 6 , 0 ) ; }
Get the UCA version of this collator object .
26,221
public void decodeBuffer ( InputStream aStream , OutputStream bStream ) throws IOException { int i ; int totalBytes = 0 ; PushbackInputStream ps = new PushbackInputStream ( aStream ) ; decodeBufferPrefix ( ps , bStream ) ; while ( true ) { int length ; try { length = decodeLinePrefix ( ps , bStream ) ; for ( i = 0 ; ( ...
Decode the text from the InputStream and write the decoded octets to the OutputStream . This method runs until the stream is exhausted .
26,222
public byte decodeBuffer ( String inputString ) [ ] throws IOException { byte inputBuffer [ ] = new byte [ inputString . length ( ) ] ; ByteArrayInputStream inStream ; ByteArrayOutputStream outStream ; inputString . getBytes ( 0 , inputString . length ( ) , inputBuffer , 0 ) ; inStream = new ByteArrayInputStream ( inpu...
Alternate decode interface that takes a String containing the encoded buffer and returns a byte array containing the data .
26,223
public byte decodeBuffer ( InputStream in ) [ ] throws IOException { ByteArrayOutputStream outStream = new ByteArrayOutputStream ( ) ; decodeBuffer ( in , outStream ) ; return ( outStream . toByteArray ( ) ) ; }
Decode the contents of the inputstream into a buffer .
26,224
protected void closeCDATA ( ) throws org . xml . sax . SAXException { try { m_writer . write ( CDATA_DELIMITER_CLOSE ) ; m_cdataTagOpen = false ; } catch ( IOException e ) { throw new SAXException ( e ) ; } }
This helper method to writes out ]] > when closing a CDATA section .
26,225
protected final void flushWriter ( ) throws org . xml . sax . SAXException { final java . io . Writer writer = m_writer ; if ( null != writer ) { try { if ( writer instanceof WriterToUTF8Buffered ) { if ( m_shouldFlush ) ( ( WriterToUTF8Buffered ) writer ) . flush ( ) ; else ( ( WriterToUTF8Buffered ) writer ) . flushB...
Flush the formatter s result stream .
26,226
public Properties getOutputFormat ( ) { Properties def = new Properties ( ) ; { Set s = getOutputPropDefaultKeys ( ) ; Iterator i = s . iterator ( ) ; while ( i . hasNext ( ) ) { String key = ( String ) i . next ( ) ; String val = getOutputPropertyDefault ( key ) ; def . put ( key , val ) ; } } Properties props = new P...
Returns the output format for this serializer .
26,227
protected boolean escapingNotNeeded ( char ch ) { final boolean ret ; if ( ch < 127 ) { if ( ch >= CharInfo . S_SPACE || ( CharInfo . S_LINEFEED == ch || CharInfo . S_CARRIAGERETURN == ch || CharInfo . S_HORIZONAL_TAB == ch ) ) ret = true ; else ret = false ; } else { ret = m_encodingInfo . isInEncoding ( ch ) ; } retu...
Tell if this character can be written without escaping .
26,228
int accumDefaultEntity ( java . io . Writer writer , char ch , int i , char [ ] chars , int len , boolean fromTextNode , boolean escLF ) throws IOException { if ( ! escLF && CharInfo . S_LINEFEED == ch ) { writer . write ( m_lineSep , 0 , m_lineSepLen ) ; } else { if ( ( fromTextNode && m_charInfo . shouldMapTextChar (...
Handle one of the default entities return false if it is not a default entity .
26,229
void writeNormalizedChars ( char ch [ ] , int start , int length , boolean isCData , boolean useSystemLineSeparator ) throws IOException , org . xml . sax . SAXException { final java . io . Writer writer = m_writer ; int end = start + length ; for ( int i = start ; i < end ; i ++ ) { char c = ch [ i ] ; if ( CharInfo ....
Normalize the characters but don t escape .
26,230
private int processDirty ( char [ ] chars , int end , int i , char ch , int lastDirty , boolean fromTextNode ) throws IOException { int startClean = lastDirty + 1 ; if ( i > startClean ) { int lengthClean = i - startClean ; m_writer . write ( chars , startClean , lengthClean ) ; } if ( CharInfo . S_LINEFEED == ch && fr...
Process a dirty character and any preeceding clean characters that were not yet processed .
26,231
private int accumDefaultEscape ( Writer writer , char ch , int i , char [ ] chars , int len , boolean fromTextNode , boolean escLF ) throws IOException { int pos = accumDefaultEntity ( writer , ch , i , chars , len , fromTextNode , escLF ) ; if ( i == pos ) { if ( Encodings . isHighUTF16Surrogate ( ch ) ) { char next ;...
Escape and writer . write a character .
26,232
public void startElement ( String elementNamespaceURI , String elementLocalName , String elementName ) throws SAXException { startElement ( elementNamespaceURI , elementLocalName , elementName , null ) ; }
Receive notification of the beginning of an element additional namespace or attribute information can occur before or after this call that is associated with this element .
26,233
public void startPrefixMapping ( String prefix , String uri ) throws org . xml . sax . SAXException { startPrefixMapping ( prefix , uri , true ) ; }
Begin the scope of a prefix - URI Namespace mapping just before another element is about to start . This call will close any open tags so that the prefix mapping will not apply to the current element but the up comming child .
26,234
public void startEntity ( String name ) throws org . xml . sax . SAXException { if ( name . equals ( "[dtd]" ) ) m_inExternalDTD = true ; if ( ! m_expandDTDEntities && ! m_inExternalDTD ) { startNonEscaping ( ) ; characters ( "&" + name + ';' ) ; endNonEscaping ( ) ; } m_inEntityRef = true ; }
Report the beginning of an entity .
26,235
public void setCdataSectionElements ( Vector URI_and_localNames ) { if ( URI_and_localNames != null ) { final int len = URI_and_localNames . size ( ) - 1 ; if ( len > 0 ) { final StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < len ; i += 2 ) { if ( i != 0 ) sb . append ( ' ' ) ; final String uri = ( Stri...
Remembers the cdata sections specified in the cdata - section - elements . The official way to set URI and localName pairs . This method should be used by both Xalan and XSLTC .
26,236
protected String ensureAttributesNamespaceIsDeclared ( String ns , String localName , String rawName ) throws org . xml . sax . SAXException { if ( ns != null && ns . length ( ) > 0 ) { int index = 0 ; String prefixFromRawName = ( index = rawName . indexOf ( ":" ) ) < 0 ? "" : rawName . substring ( 0 , index ) ; if ( i...
Makes sure that the namespace URI for the given qualified attribute name is declared .
26,237
protected void firePseudoAttributes ( ) { if ( m_tracer != null ) { try { m_writer . flush ( ) ; StringBuffer sb = new StringBuffer ( ) ; int nAttrs = m_attributes . getLength ( ) ; if ( nAttrs > 0 ) { java . io . Writer writer = new ToStream . WritertoStringBuffer ( sb ) ; processAttributes ( writer , nAttrs ) ; } sb ...
To fire off the pseudo characters of attributes as they currently exist . This method should be called everytime an attribute is added or when an attribute value is changed or an element is created .
26,238
private void resetToStream ( ) { this . m_cdataStartCalled = false ; this . m_disableOutputEscapingStates . clear ( ) ; this . m_escaping = true ; this . m_expandDTDEntities = true ; this . m_inDoctype = false ; this . m_ispreserve = false ; this . m_isprevtext = false ; this . m_isUTF8 = false ; this . m_lineSep = s_s...
Reset all of the fields owned by ToStream class
26,239
public void notationDecl ( String name , String pubID , String sysID ) throws SAXException { try { DTDprolog ( ) ; m_writer . write ( "<!NOTATION " ) ; m_writer . write ( name ) ; if ( pubID != null ) { m_writer . write ( " PUBLIC \"" ) ; m_writer . write ( pubID ) ; } else { m_writer . write ( " SYSTEM \"" ) ; m_write...
If this method is called the serializer is used as a DTDHandler which changes behavior how the serializer handles document entities .
26,240
private void DTDprolog ( ) throws SAXException , IOException { final java . io . Writer writer = m_writer ; if ( m_needToOutputDocTypeDecl ) { outputDocTypeDecl ( m_elemContext . m_elementName , false ) ; m_needToOutputDocTypeDecl = false ; } if ( m_inDoctype ) { writer . write ( " [" ) ; writer . write ( m_lineSep , 0...
A private helper method to output the
26,241
public void addCdataSectionElements ( String URI_and_localNames ) { if ( URI_and_localNames != null ) initCdataElems ( URI_and_localNames ) ; if ( m_StringOfCDATASections == null ) m_StringOfCDATASections = URI_and_localNames ; else m_StringOfCDATASections += ( " " + URI_and_localNames ) ; }
Remembers the cdata sections specified in the cdata - section - elements by appending the given cdata section elements to the list . This method can be called multiple times but once an element is put in the list of cdata section elements it can not be removed . This method should be used by both Xalan and XSLTC .
26,242
public final void reset ( ) { m_currentCodepoint_ = 0 ; m_nextCodepoint_ = 0 ; m_nextIndex_ = 0 ; m_nextBlock_ = m_trie_ . m_index_ [ 0 ] << Trie . INDEX_STAGE_2_SHIFT_ ; if ( m_nextBlock_ == m_trie_ . m_dataOffset_ ) { m_nextValue_ = m_initialValue_ ; } else { m_nextValue_ = extract ( m_trie_ . getValue ( m_nextBlock_...
Resets the iterator to the beginning of the iteration
26,243
private final void setResult ( Element element , int start , int limit , int value ) { element . start = start ; element . limit = limit ; element . value = value ; }
Set the result values
26,244
private final boolean checkNullNextTrailIndex ( ) { if ( m_nextIndex_ <= 0 ) { m_nextCodepoint_ += TRAIL_SURROGATE_COUNT_ - 1 ; int nextLead = UTF16 . getLeadSurrogate ( m_nextCodepoint_ ) ; int leadBlock = m_trie_ . m_index_ [ nextLead >> Trie . INDEX_STAGE_1_SHIFT_ ] << Trie . INDEX_STAGE_2_SHIFT_ ; if ( m_trie_ . m_...
Checks if we are beginning at the start of a initial block . If we are then the rest of the codepoints in this initial block has the same values . We increment m_nextCodepoint_ and relevant data members if so . This is used only in for the supplementary codepoints because the offset to the trail indexes could be 0 .
26,245
public int [ ] toIntArray ( ) { int length = encoding . length ; int [ ] result = new int [ 20 ] ; int which = 0 ; int fromPos = 0 ; for ( int i = 0 ; i < length ; i ++ ) { if ( ( encoding [ i ] & 0x80 ) == 0 ) { if ( i - fromPos + 1 > 4 ) { BigInteger big = new BigInteger ( pack ( encoding , fromPos , i - fromPos + 1 ...
Private helper method for serialization . To be compatible with old versions of JDK .
26,246
private static int pack7Oid ( int input , byte [ ] out , int ooffset ) { byte [ ] b = new byte [ 4 ] ; b [ 0 ] = ( byte ) ( input >> 24 ) ; b [ 1 ] = ( byte ) ( input >> 16 ) ; b [ 2 ] = ( byte ) ( input >> 8 ) ; b [ 3 ] = ( byte ) ( input ) ; return pack7Oid ( b , 0 , 4 , out , ooffset ) ; }
Pack the int into a OID sub - identifier DER encoding
26,247
private static int pack7Oid ( BigInteger input , byte [ ] out , int ooffset ) { byte [ ] b = input . toByteArray ( ) ; return pack7Oid ( b , 0 , b . length , out , ooffset ) ; }
Pack the BigInteger into a OID subidentifier DER encoding
26,248
private static void check ( byte [ ] encoding ) throws IOException { int length = encoding . length ; if ( length < 1 || ( encoding [ length - 1 ] & 0x80 ) != 0 ) { throw new IOException ( "ObjectIdentifier() -- " + "Invalid DER encoding, not ended" ) ; } for ( int i = 0 ; i < length ; i ++ ) { if ( encoding [ i ] == (...
Check the DER encoding . Since DER encoding defines that the integer bits are unsigned so there s no need to check the MSB .
26,249
public void parseForClass ( GenericDeclaration genericDecl , String signature ) { setInput ( genericDecl , signature ) ; if ( ! eof ) { parseClassSignature ( ) ; } else { if ( genericDecl instanceof Class ) { Class c = ( Class ) genericDecl ; this . formalTypeParameters = EmptyArray . TYPE_VARIABLE ; this . superclassT...
Parses the generic signature of a class and creates the data structure representing the signature .
26,250
public void parseForMethod ( GenericDeclaration genericDecl , String signature , Class < ? > [ ] rawExceptionTypes ) { setInput ( genericDecl , signature ) ; if ( ! eof ) { parseMethodTypeSignature ( rawExceptionTypes ) ; } else { Method m = ( Method ) genericDecl ; this . formalTypeParameters = EmptyArray . TYPE_VARIA...
Parses the generic signature of a method and creates the data structure representing the signature .
26,251
public void parseForConstructor ( GenericDeclaration genericDecl , String signature , Class < ? > [ ] rawExceptionTypes ) { setInput ( genericDecl , signature ) ; if ( ! eof ) { parseMethodTypeSignature ( rawExceptionTypes ) ; } else { Constructor c = ( Constructor ) genericDecl ; this . formalTypeParameters = EmptyArr...
Parses the generic signature of a constructor and creates the data structure representing the signature .
26,252
public void parseForField ( GenericDeclaration genericDecl , String signature ) { setInput ( genericDecl , signature ) ; if ( ! eof ) { this . fieldType = parseFieldTypeSignature ( ) ; } }
Parses the generic signature of a field and creates the data structure representing the signature .
26,253
private < T > T doInvokeAny ( Collection < ? extends Callable < T > > tasks , boolean timed , long nanos ) throws InterruptedException , ExecutionException , TimeoutException { if ( tasks == null ) throw new NullPointerException ( ) ; int ntasks = tasks . size ( ) ; if ( ntasks == 0 ) throw new IllegalArgumentException...
the main mechanics of invokeAny .
26,254
private static < T > void cancelAll ( ArrayList < Future < T > > futures , int j ) { for ( int size = futures . size ( ) ; j < size ; j ++ ) futures . get ( j ) . cancel ( true ) ; }
Cancels all futures with index at least j .
26,255
public File extractZipEntry ( File dir , ZipFile zipFile , ZipEntry entry ) throws IOException { File outputFile = new File ( dir , entry . getName ( ) ) ; File parentFile = outputFile . getParentFile ( ) ; if ( ! outputFile . getCanonicalPath ( ) . startsWith ( dir . getCanonicalPath ( ) + File . separator ) || ( ! pa...
Extract a ZipEntry to the specified directory .
26,256
private boolean isSimpleEnum ( EnumDeclaration node ) { TypeElement type = node . getTypeElement ( ) ; for ( EnumConstantDeclaration constant : node . getEnumConstants ( ) ) { ExecutableElement method = constant . getExecutableElement ( ) ; if ( method . getParameters ( ) . size ( ) > 0 || method . isVarArgs ( ) ) { re...
Returns true if an enum doesn t have custom or renamed constructors vararg constructors or constants with anonymous class extensions .
26,257
private void addArcInitialization ( EnumDeclaration node ) { String enumClassName = nameTable . getFullName ( node . getTypeElement ( ) ) ; List < Statement > stmts = node . getClassInitStatements ( ) . subList ( 0 , 0 ) ; int i = 0 ; for ( EnumConstantDeclaration constant : node . getEnumConstants ( ) ) { VariableElem...
the shared allocation optimization .
26,258
private long monthRange ( ) { ValueRange startRange = chrono . range ( MONTH_OF_YEAR ) ; if ( startRange . isFixed ( ) && startRange . isIntValue ( ) ) { return startRange . getMaximum ( ) - startRange . getMinimum ( ) + 1 ; } return - 1 ; }
Calculates the range of months .
26,259
private Expression getRetainedWithTarget ( Assignment node , VariableElement var ) { Expression lhs = node . getLeftHandSide ( ) ; if ( ! ( lhs instanceof FieldAccess ) ) { return new ThisExpression ( ElementUtil . getDeclaringClass ( var ) . asType ( ) ) ; } FieldAccess fieldAccess = ( FieldAccess ) lhs ; Expression t...
Gets the target object for a call to the RetainedWith wrapper .
26,260
private static String getPromotionSuffix ( Assignment node ) { if ( ! needsPromotionSuffix ( node . getOperator ( ) ) ) { return "" ; } TypeKind lhsKind = node . getLeftHandSide ( ) . getTypeMirror ( ) . getKind ( ) ; TypeKind rhsKind = node . getRightHandSide ( ) . getTypeMirror ( ) . getKind ( ) ; if ( lhsKind == Typ...
Some operator functions are given a suffix indicating the promotion type of the operands according to JLS 5 . 6 . 2 .
26,261
public static String join ( CharSequence delimiter , Iterable tokens ) { StringBuilder sb = new StringBuilder ( ) ; boolean firstTime = true ; for ( Object token : tokens ) { if ( firstTime ) { firstTime = false ; } else { sb . append ( delimiter ) ; } sb . append ( token ) ; } return sb . toString ( ) ; }
Returns a string containing the tokens joined by delimiters .
26,262
public static void dumpSpans ( CharSequence cs , Printer printer , String prefix ) { if ( cs instanceof Spanned ) { Spanned sp = ( Spanned ) cs ; Object [ ] os = sp . getSpans ( 0 , cs . length ( ) , Object . class ) ; for ( int i = 0 ; i < os . length ; i ++ ) { Object o = os [ i ] ; printer . println ( prefix + cs . ...
Debugging tool to print the spans in a CharSequence . The output will be printed one span per line . If the CharSequence is not a Spanned then the entire string will be printed on a single line .
26,263
public static CharSequence expandTemplate ( CharSequence template , CharSequence ... values ) { if ( values . length > 9 ) { throw new IllegalArgumentException ( "max of 9 values are supported" ) ; } SpannableStringBuilder ssb = new SpannableStringBuilder ( template ) ; try { int i = 0 ; while ( i < ssb . length ( ) ) ...
Return a new CharSequence in which each of the source strings is replaced by the corresponding element of the destinations .
26,264
public static String htmlEncode ( String s ) { StringBuilder sb = new StringBuilder ( ) ; char c ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { c = s . charAt ( i ) ; switch ( c ) { case '<' : sb . append ( "&lt;" ) ; break ; case '>' : sb . append ( "&gt;" ) ; break ; case '&' : sb . append ( "&amp;" ) ; break ; ca...
Html - encode the string .
26,265
public static CharSequence concat ( CharSequence ... text ) { if ( text . length == 0 ) { return "" ; } if ( text . length == 1 ) { return text [ 0 ] ; } boolean spanned = false ; for ( int i = 0 ; i < text . length ; i ++ ) { if ( text [ i ] instanceof Spanned ) { spanned = true ; break ; } } StringBuilder sb = new St...
Returns a CharSequence concatenating the specified CharSequences retaining their spans if any .
26,266
public static boolean isGraphic ( CharSequence str ) { final int len = str . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { int gc = Character . getType ( str . charAt ( i ) ) ; if ( gc != Character . CONTROL && gc != Character . FORMAT && gc != Character . SURROGATE && gc != Character . UNASSIGNED && gc != Characte...
Returns whether the given CharSequence contains any printable characters .
26,267
public static boolean isGraphic ( char c ) { int gc = Character . getType ( c ) ; return gc != Character . CONTROL && gc != Character . FORMAT && gc != Character . SURROGATE && gc != Character . UNASSIGNED && gc != Character . LINE_SEPARATOR && gc != Character . PARAGRAPH_SEPARATOR && gc != Character . SPACE_SEPARATOR ...
Returns whether this character is a printable character .
26,268
public static boolean isDigitsOnly ( CharSequence str ) { final int len = str . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { if ( ! Character . isDigit ( str . charAt ( i ) ) ) { return false ; } } return true ; }
Returns whether the given CharSequence contains only digits .
26,269
public static void appendToRule ( StringBuffer rule , UnicodeMatcher matcher , boolean escapeUnprintable , StringBuffer quoteBuf ) { if ( matcher != null ) { appendToRule ( rule , matcher . toPattern ( escapeUnprintable ) , true , escapeUnprintable , quoteBuf ) ; } }
Given a matcher reference which may be null append its pattern as a literal to the given rule .
26,270
private void encodeThis ( ) throws IOException { if ( names == null || names . isEmpty ( ) ) { this . extensionValue = null ; return ; } DerOutputStream os = new DerOutputStream ( ) ; names . encode ( os ) ; this . extensionValue = os . toByteArray ( ) ; }
Encode this extension
26,271
public void startElement ( StylesheetHandler handler , String uri , String localName , String rawName , Attributes attributes ) throws SAXException { String msg = "" ; if ( ! ( handler . getElemTemplateElement ( ) instanceof Stylesheet ) ) { msg = "func:function element must be top level." ; handler . error ( msg , new...
Start an ElemExsltFunction . Verify that it is top level and that it has a name attribute with a namespace .
26,272
protected void appendAndPush ( StylesheetHandler handler , ElemTemplateElement elem ) throws SAXException { super . appendAndPush ( handler , elem ) ; elem . setDOMBackPointer ( handler . getOriginatingNode ( ) ) ; handler . getStylesheet ( ) . setTemplate ( ( ElemTemplate ) elem ) ; }
Must include ; super doesn t suffice!
26,273
public void endElement ( StylesheetHandler handler , String uri , String localName , String rawName ) throws SAXException { ElemTemplateElement function = handler . getElemTemplateElement ( ) ; validate ( function , handler ) ; super . endElement ( handler , uri , localName , rawName ) ; }
End an ElemExsltFunction and verify its validity .
26,274
boolean ancestorIsOk ( ElemTemplateElement child ) { while ( child . getParentElem ( ) != null && ! ( child . getParentElem ( ) instanceof ElemExsltFunction ) ) { ElemTemplateElement parent = child . getParentElem ( ) ; if ( parent instanceof ElemExsltFuncResult || parent instanceof ElemVariable || parent instanceof El...
Verify that a literal result belongs to a result element a variable or a parameter .
26,275
private void readObject ( ObjectInputStream s ) throws IOException , ClassNotFoundException , InvalidObjectException { s . defaultReadObject ( ) ; if ( firstDayOfWeek == null ) { throw new InvalidObjectException ( "firstDayOfWeek is null" ) ; } if ( minimalDays < 1 || minimalDays > 7 ) { throw new InvalidObjectExceptio...
Restore the state of a WeekFields from the stream . Check that the values are valid .
26,276
private final Object slotExchange ( Object item , boolean timed , long ns ) { Node p = participant . get ( ) ; Thread t = Thread . currentThread ( ) ; if ( t . isInterrupted ( ) ) return null ; for ( Node q ; ; ) { if ( ( q = slot ) != null ) { if ( U . compareAndSwapObject ( this , SLOT , q , null ) ) { Object v = q ....
Exchange function used until arenas enabled . See above for explanation .
26,277
public static StreamDecoder forInputStreamReader ( InputStream in , Object lock , String charsetName ) throws UnsupportedEncodingException { String csn = charsetName ; if ( csn == null ) csn = Charset . defaultCharset ( ) . name ( ) ; try { if ( Charset . isSupported ( csn ) ) return new StreamDecoder ( in , lock , Cha...
Factories for java . io . InputStreamReader
26,278
public static StreamDecoder forDecoder ( ReadableByteChannel ch , CharsetDecoder dec , int minBufferCap ) { return new StreamDecoder ( ch , dec , minBufferCap ) ; }
Factory for java . nio . channels . Channels . newReader
26,279
public static void run ( List < String > fileArgs , Options options ) { File preProcessorTempDir = null ; File strippedSourcesDir = null ; Parser parser = null ; try { List < ProcessingContext > inputs = Lists . newArrayList ( ) ; GenerationBatch batch = new GenerationBatch ( options ) ; batch . processFileArgs ( fileA...
Runs the entire J2ObjC pipeline .
26,280
public void CopyFrom ( ToXMLStream xmlListener ) { setWriter ( xmlListener . m_writer ) ; String encoding = xmlListener . getEncoding ( ) ; setEncoding ( encoding ) ; setOmitXMLDeclaration ( xmlListener . getOmitXMLDeclaration ( ) ) ; m_ispreserve = xmlListener . m_ispreserve ; m_preserves = xmlListener . m_preserves ;...
Copy properties from another SerializerToXML .
26,281
public void endPreserving ( ) throws org . xml . sax . SAXException { m_ispreserve = m_preserves . isEmpty ( ) ? false : m_preserves . pop ( ) ; }
Ends a whitespace preserving section .
26,282
public void addAttribute ( String uri , String localName , String rawName , String type , String value , boolean xslAttribute ) throws SAXException { if ( m_elemContext . m_startTagOpen ) { boolean was_added = addAttributeAlways ( uri , localName , rawName , type , value , xslAttribute ) ; if ( was_added && ! xslAttrib...
Add an attribute to the current element .
26,283
protected boolean pushNamespace ( String prefix , String uri ) { try { if ( m_prefixMap . pushNamespace ( prefix , uri , m_elemContext . m_currentElemDepth ) ) { startPrefixMapping ( prefix , uri ) ; return true ; } } catch ( SAXException e ) { } return false ; }
From XSLTC Declare a prefix to point to a namespace URI . Inform SAX handler if this is a new prefix mapping .
26,284
private String getXMLVersion ( ) { String xmlVersion = getVersion ( ) ; if ( xmlVersion == null || xmlVersion . equals ( XMLVERSION10 ) ) { xmlVersion = XMLVERSION10 ; } else if ( xmlVersion . equals ( XMLVERSION11 ) ) { xmlVersion = XMLVERSION11 ; } else { String msg = Utils . messages . createMessage ( MsgKey . ER_XM...
This method checks for the XML version of output document . If XML version of output document is not specified then output document is of version XML 1 . 0 . If XML version of output doucment is specified but it is not either XML 1 . 0 or XML 1 . 1 a warning message is generated the XML Version of output document is se...
26,285
public void append ( char digit ) { if ( count == digits . length ) { char [ ] data = new char [ count + 100 ] ; System . arraycopy ( digits , 0 , data , 0 , count ) ; digits = data ; } digits [ count ++ ] = digit ; }
Appends a digit to the list extending the list when necessary .
26,286
boolean fitsIntoLong ( boolean isPositive , boolean ignoreNegativeZero ) { while ( count > 0 && digits [ count - 1 ] == '0' ) { -- count ; } if ( count == 0 ) { return isPositive || ignoreNegativeZero ; } if ( decimalAt < count || decimalAt > MAX_COUNT ) { return false ; } if ( decimalAt < MAX_COUNT ) return true ; for...
Return true if the number represented by this object can fit into a long .
26,287
final void set ( boolean isNegative , double source , int maximumDigits , boolean fixedPoint ) { set ( isNegative , Double . toString ( source ) , maximumDigits , fixedPoint ) ; }
Set the digit list to a representation of the given double value . This method supports both fixed - point and exponential notation .
26,288
private final void round ( int maximumDigits ) { if ( maximumDigits >= 0 && maximumDigits < count ) { if ( shouldRoundUp ( maximumDigits ) ) { for ( ; ; ) { -- maximumDigits ; if ( maximumDigits < 0 ) { digits [ 0 ] = '1' ; ++ decimalAt ; maximumDigits = 0 ; break ; } ++ digits [ maximumDigits ] ; if ( digits [ maximum...
Round the representation to the given number of digits .
26,289
public final void set ( boolean isNegative , long source , int maximumDigits ) { this . isNegative = isNegative ; if ( source <= 0 ) { if ( source == Long . MIN_VALUE ) { decimalAt = count = MAX_COUNT ; System . arraycopy ( LONG_MIN_REP , 0 , digits , 0 , count ) ; } else { decimalAt = count = 0 ; } } else { int left =...
Set the digit list to a representation of the given long value .
26,290
final void set ( boolean isNegative , BigDecimal source , int maximumDigits , boolean fixedPoint ) { String s = source . toString ( ) ; extendDigits ( s . length ( ) ) ; set ( isNegative , s , maximumDigits , fixedPoint ) ; }
Set the digit list to a representation of the given BigDecimal value . This method supports both fixed - point and exponential notation .
26,291
final void set ( boolean isNegative , BigInteger source , int maximumDigits ) { this . isNegative = isNegative ; String s = source . toString ( ) ; int len = s . length ( ) ; extendDigits ( len ) ; s . getChars ( 0 , len , digits , 0 ) ; decimalAt = len ; int right ; for ( right = len - 1 ; right >= 0 && digits [ right...
Set the digit list to a representation of the given BigInteger value .
26,292
public void execute ( TransformerImpl transformer ) throws TransformerException { if ( transformer . isRecursiveAttrSet ( this ) ) { throw new TransformerException ( XSLMessages . createMessage ( XSLTErrorResources . ER_XSLATTRSET_USED_ITSELF , new Object [ ] { m_qname . getLocalPart ( ) } ) ) ; } transformer . pushEle...
Apply a set of attributes to the element .
26,293
final Node < E > pred ( Node < E > p ) { Node < E > q = p . prev ; return ( sentinel ( ) == q ) ? last ( ) : q ; }
Returns the predecessor of p or the last node if p . prev has been linked to self which will only be true if traversing with a stale pointer that is now off the list .
26,294
public String getCanonicalID ( ) { if ( canonicalID == null ) { synchronized ( this ) { if ( canonicalID == null ) { canonicalID = getCanonicalID ( getID ( ) ) ; assert ( canonicalID != null ) ; if ( canonicalID == null ) { canonicalID = getID ( ) ; } } } } return canonicalID ; }
Returns the canonical ID of this system time zone
26,295
private void constructEmpty ( ) { transitionCount = 0 ; transitionTimes64 = null ; typeMapData = null ; typeCount = 1 ; typeOffsets = new int [ ] { 0 , 0 } ; finalZone = null ; finalStartYear = Integer . MAX_VALUE ; finalStartMillis = Double . MAX_VALUE ; transitionRulesInitialized = false ; }
Construct a GMT + 0 zone with no transitions . This is done when a constructor fails so the resultant object is well - behaved .
26,296
public static long fieldsToDay ( int year , int month , int dom ) { int y = year - 1 ; long julian = 365 * y + floorDivide ( y , 4 ) + ( JULIAN_1_CE - 3 ) + floorDivide ( y , 400 ) - floorDivide ( y , 100 ) + 2 + DAYS_BEFORE [ month + ( isLeapYear ( year ) ? 12 : 0 ) ] + dom ; return julian - JULIAN_1970_CE ; }
Convert a year month and day - of - month given in the proleptic Gregorian calendar to 1970 epoch days .
26,297
public static String timeToString ( long time ) { int [ ] fields = timeToFields ( time , null ) ; int millis = fields [ 5 ] ; int hour = millis / MILLIS_PER_HOUR ; millis = millis % MILLIS_PER_HOUR ; int min = millis / MILLIS_PER_MINUTE ; millis = millis % MILLIS_PER_MINUTE ; int sec = millis / MILLIS_PER_SECOND ; mill...
Convenient method for formatting time to ISO 8601 style date string .
26,298
public final int getCodePointValue ( int ch ) { int offset ; if ( 0 <= ch && ch < UTF16 . LEAD_SURROGATE_MIN_VALUE ) { offset = ( m_index_ [ ch >> INDEX_STAGE_1_SHIFT_ ] << INDEX_STAGE_2_SHIFT_ ) + ( ch & INDEX_STAGE_3_MASK_ ) ; return m_data_ [ offset ] ; } offset = getCodePointOffset ( ch ) ; return ( offset >= 0 ) ?...
Gets the value associated with the codepoint . If no value is associated with the codepoint a default value will be returned .
26,299
public static Object create ( Delegate delegate , int bufferSize ) { if ( bufferSize < 1 ) { throw new IllegalArgumentException ( "Invalid buffer size: " + bufferSize ) ; } if ( delegate == null ) { throw new IllegalArgumentException ( "Delegate must not be null" ) ; } return nativeCreate ( delegate , bufferSize ) ; }
Creates a native NSInputStream that is piped to a NSOutpuStream which in turn requests data from the supplied delegate asynchronously .