idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
25,600
public final void pushPair ( int v1 , int v2 ) { if ( null == m_map ) { m_map = new int [ m_blocksize ] ; m_mapSize = m_blocksize ; } else { if ( ( m_firstFree + 2 ) >= m_mapSize ) { m_mapSize += m_blocksize ; int newMap [ ] = new int [ m_mapSize ] ; System . arraycopy ( m_map , 0 , newMap , 0 , m_firstFree ) ; m_map =...
Push a pair of nodes into the stack . Special purpose method for TransformerImpl pushElemTemplateElement . Performance critical .
25,601
public final void popPair ( ) { m_firstFree -= 2 ; m_map [ m_firstFree ] = DTM . NULL ; m_map [ m_firstFree + 1 ] = DTM . NULL ; }
Pop a pair of nodes from the tail of the stack . Special purpose method for TransformerImpl pushElemTemplateElement . Performance critical .
25,602
public void insertInOrder ( int value ) { for ( int i = 0 ; i < m_firstFree ; i ++ ) { if ( value < m_map [ i ] ) { insertElementAt ( value , i ) ; return ; } } addElement ( value ) ; }
Insert a node in order in the list .
25,603
public void sort ( int a [ ] , int lo0 , int hi0 ) throws Exception { int lo = lo0 ; int hi = hi0 ; if ( lo >= hi ) { return ; } else if ( lo == hi - 1 ) { if ( a [ lo ] > a [ hi ] ) { int T = a [ lo ] ; a [ lo ] = a [ hi ] ; a [ hi ] = T ; } return ; } int pivot = a [ ( lo + hi ) / 2 ] ; a [ ( lo + hi ) / 2 ] = a [ hi...
Sort an array using a quicksort algorithm .
25,604
public static RelativeDateTimeFormatter getInstance ( ULocale locale ) { return getInstance ( locale , null , Style . LONG , DisplayContext . CAPITALIZATION_NONE ) ; }
Returns a RelativeDateTimeFormatter for a particular locale .
25,605
public static RelativeDateTimeFormatter getInstance ( ULocale locale , NumberFormat nf ) { return getInstance ( locale , nf , Style . LONG , DisplayContext . CAPITALIZATION_NONE ) ; }
Returns a RelativeDateTimeFormatter for a particular locale that uses a particular NumberFormat object .
25,606
public static RelativeDateTimeFormatter getInstance ( ULocale locale , NumberFormat nf , Style style , DisplayContext capitalizationContext ) { RelativeDateTimeFormatterData data = cache . get ( locale ) ; if ( nf == null ) { nf = NumberFormat . getInstance ( locale ) ; } else { nf = ( NumberFormat ) nf . clone ( ) ; }...
Returns a RelativeDateTimeFormatter for a particular locale that uses a particular NumberFormat object style and capitalization context
25,607
public String format ( double quantity , Direction direction , RelativeUnit unit ) { if ( direction != Direction . LAST && direction != Direction . NEXT ) { throw new IllegalArgumentException ( "direction must be NEXT or LAST" ) ; } String result ; int pastFutureIndex = ( direction == Direction . NEXT ? 1 : 0 ) ; synch...
Formats a relative date with a quantity such as in 5 days or 3 months ago
25,608
public String format ( Direction direction , AbsoluteUnit unit ) { if ( unit == AbsoluteUnit . NOW && direction != Direction . PLAIN ) { throw new IllegalArgumentException ( "NOW can only accept direction PLAIN." ) ; } String result ; if ( ( direction == Direction . PLAIN ) && ( AbsoluteUnit . SUNDAY . ordinal ( ) <= u...
Formats a relative date without a quantity .
25,609
private String getAbsoluteUnitString ( Style style , AbsoluteUnit unit , Direction direction ) { EnumMap < AbsoluteUnit , EnumMap < Direction , String > > unitMap ; EnumMap < Direction , String > dirMap ; do { unitMap = qualitativeUnitMap . get ( style ) ; if ( unitMap != null ) { dirMap = unitMap . get ( unit ) ; if (...
Gets the string value from qualitativeUnitMap with fallback based on style .
25,610
public String combineDateAndTime ( String relativeDateString , String timeString ) { return SimpleFormatterImpl . formatCompiledPattern ( combinedDateAndTime , timeString , relativeDateString ) ; }
Combines a relative date string and a time string in this object s locale . This is done with the same date - time separator used for the default calendar in this locale .
25,611
private void handleThrows ( ) { Scope curScope = scope ; while ( curScope != null ) { if ( curScope . kind == Scope . Kind . TRY ) { scope . mergeInto ( curScope . next ) ; } curScope = curScope . next ; } }
scope of each try block .
25,612
private boolean isBoxingMethod ( ExecutableElement method ) { TypeElement declaringClass = ElementUtil . getDeclaringClass ( method ) ; if ( typeUtil . isBoxedType ( declaringClass . asType ( ) ) ) { String name = ElementUtil . getName ( method ) ; TypeMirror returnType = method . getReturnType ( ) ; List < ? extends V...
Checks if the given method is a primitive boxing or unboxing method .
25,613
public void endVisit ( FunctionInvocation node ) { if ( Objects . equals ( node . getFunctionElement ( ) , NIL_CHK_ELEM ) ) { VariableElement var = TreeUtil . getVariableElement ( node . getArgument ( 0 ) ) ; if ( var != null ) { addSafeVar ( var ) ; } } }
added nil_chk s .
25,614
public void setRequestProperty ( String key , String value ) { if ( connected ) throw new IllegalStateException ( "Already connected" ) ; if ( key == null ) throw new NullPointerException ( "key is null" ) ; if ( requests == null ) requests = new MessageHeader ( ) ; requests . set ( key , value ) ; }
Sets the general request property . If a property with the key already exists overwrite its value with the new value .
25,615
public void addRequestProperty ( String key , String value ) { if ( connected ) throw new IllegalStateException ( "Already connected" ) ; if ( key == null ) throw new NullPointerException ( "key is null" ) ; if ( requests == null ) requests = new MessageHeader ( ) ; requests . add ( key , value ) ; }
Adds a general request property specified by a key - value pair . This method will not overwrite existing values associated with the same key .
25,616
public String getRequestProperty ( String key ) { if ( connected ) throw new IllegalStateException ( "Already connected" ) ; if ( requests == null ) return null ; return requests . findValue ( key ) ; }
Returns the value of the named general request property for this connection .
25,617
public Map < String , List < String > > getRequestProperties ( ) { if ( connected ) throw new IllegalStateException ( "Already connected" ) ; if ( requests == null ) return Collections . EMPTY_MAP ; return requests . getHeaders ( null ) ; }
Returns an unmodifiable Map of general request properties for this connection . The Map keys are Strings that represent the request - header field names . Each Map value is a unmodifiable List of Strings that represents the corresponding field values .
25,618
synchronized ContentHandler getContentHandler ( ) throws IOException { String contentType = stripOffParameters ( getContentType ( ) ) ; ContentHandler handler = null ; if ( contentType == null ) { if ( ( contentType = guessContentTypeFromName ( url . getFile ( ) ) ) == null ) { contentType = guessContentTypeFromStream ...
Gets the Content Handler appropriate for this connection .
25,619
private String getContentHandlerPkgPrefixes ( ) { String packagePrefixList = System . getProperty ( contentPathProp , "" ) ; if ( packagePrefixList != "" ) { packagePrefixList += "|" ; } return packagePrefixList + contentClassPrefix ; }
Returns a vertical bar separated list of package prefixes for potential content handlers . Tries to get the java . content . handler . pkgs property to use as a set of package prefixes to search . Whether or not that property has been defined the sun . net . www . content is always the last one on the returned package ...
25,620
static private int readBytes ( int c [ ] , int len , InputStream is ) throws IOException { byte buf [ ] = new byte [ len ] ; if ( is . read ( buf , 0 , len ) < len ) { return - 1 ; } for ( int i = 0 ; i < len ; i ++ ) { c [ i ] = buf [ i ] & 0xff ; } return 0 ; }
Tries to read the specified number of bytes from the stream Returns - 1 If EOF is reached before len bytes are read returns 0 otherwise
25,621
static private long skipForward ( InputStream is , long toSkip ) throws IOException { long eachSkip = 0 ; long skipped = 0 ; while ( skipped != toSkip ) { eachSkip = is . skip ( toSkip - skipped ) ; if ( eachSkip <= 0 ) { if ( is . read ( ) == - 1 ) { return skipped ; } else { skipped ++ ; } } skipped += eachSkip ; } r...
Skips through the specified number of bytes from the stream until either EOF is reached or the specified number of bytes have been skipped
25,622
public static final ElemDesc getElemDesc ( String name ) { Object obj = m_elementFlags . get ( name ) ; if ( null != obj ) return ( ElemDesc ) obj ; return m_dummy ; }
Get a description of the given element .
25,623
private void outputDocTypeDecl ( String name ) throws SAXException { if ( true == m_needToOutputDocTypeDecl ) { String doctypeSystem = getDoctypeSystem ( ) ; String doctypePublic = getDoctypePublic ( ) ; if ( ( null != doctypeSystem ) || ( null != doctypePublic ) ) { final java . io . Writer writer = m_writer ; try { w...
This method should only get called once . If a DOCTYPE declaration needs to get written out it will be written out . If it doesn t need to be written out then the call to this method has no effect .
25,624
private static String makeHHString ( int i ) { String s = Integer . toHexString ( i ) . toUpperCase ( ) ; if ( s . length ( ) == 1 ) { s = "0" + s ; } return s ; }
Make an integer into an HH hex value . Does no checking on the size of the input since this is only meant to be used locally by writeAttrURI .
25,625
protected void closeStartTag ( ) throws SAXException { try { if ( m_tracer != null ) super . fireStartElem ( m_elemContext . m_elementName ) ; int nAttrs = m_attributes . getLength ( ) ; if ( nAttrs > 0 ) { processAttributes ( m_writer , nAttrs ) ; m_attributes . clear ( ) ; } m_writer . write ( '>' ) ; if ( m_CdataEle...
For the enclosing elements starting tag write out out any attributes followed by > . At this point we also mark if this element is a cdata - section - element .
25,626
public void attributeDecl ( String eName , String aName , String type , String valueDefault , String value ) throws SAXException { }
This method does nothing .
25,627
public byte [ ] getEncodedInfo ( ) throws CertificateEncodingException { try { if ( rawCertInfo == null ) { DerOutputStream tmp = new DerOutputStream ( ) ; emit ( tmp ) ; rawCertInfo = tmp . toByteArray ( ) ; } return rawCertInfo . clone ( ) ; } catch ( IOException e ) { throw new CertificateEncodingException ( e . toS...
Returns the encoded certificate info .
25,628
public void set ( String name , Object val ) throws CertificateException , IOException { X509AttributeName attrName = new X509AttributeName ( name ) ; int attr = attributeMap ( attrName . getPrefix ( ) ) ; if ( attr == 0 ) { throw new CertificateException ( "Attribute name not recognized: " + name ) ; } rawCertInfo = n...
Set the certificate attribute .
25,629
public void delete ( String name ) throws CertificateException , IOException { X509AttributeName attrName = new X509AttributeName ( name ) ; int attr = attributeMap ( attrName . getPrefix ( ) ) ; if ( attr == 0 ) { throw new CertificateException ( "Attribute name not recognized: " + name ) ; } rawCertInfo = null ; Stri...
Delete the certificate attribute .
25,630
public Object get ( String name ) throws CertificateException , IOException { X509AttributeName attrName = new X509AttributeName ( name ) ; int attr = attributeMap ( attrName . getPrefix ( ) ) ; if ( attr == 0 ) { throw new CertificateParsingException ( "Attribute name not recognized: " + name ) ; } String suffix = att...
Get the certificate attribute .
25,631
private int attributeMap ( String name ) { Integer num = map . get ( name ) ; if ( num == null ) { return 0 ; } return num . intValue ( ) ; }
Returns the integer attribute number for the passed attribute name .
25,632
private void setVersion ( Object val ) throws CertificateException { if ( ! ( val instanceof CertificateVersion ) ) { throw new CertificateException ( "Version class type invalid." ) ; } version = ( CertificateVersion ) val ; }
Set the version number of the certificate .
25,633
private void setSerialNumber ( Object val ) throws CertificateException { if ( ! ( val instanceof CertificateSerialNumber ) ) { throw new CertificateException ( "SerialNumber class type invalid." ) ; } serialNum = ( CertificateSerialNumber ) val ; }
Set the serial number of the certificate .
25,634
private void setAlgorithmId ( Object val ) throws CertificateException { if ( ! ( val instanceof CertificateAlgorithmId ) ) { throw new CertificateException ( "AlgorithmId class type invalid." ) ; } algId = ( CertificateAlgorithmId ) val ; }
Set the algorithm id of the certificate .
25,635
private void setIssuer ( Object val ) throws CertificateException { if ( ! ( val instanceof X500Name ) ) { throw new CertificateException ( "Issuer class type invalid." ) ; } issuer = ( X500Name ) val ; }
Set the issuer name of the certificate .
25,636
private void setValidity ( Object val ) throws CertificateException { if ( ! ( val instanceof CertificateValidity ) ) { throw new CertificateException ( "CertificateValidity class type invalid." ) ; } interval = ( CertificateValidity ) val ; }
Set the validity interval of the certificate .
25,637
private void setSubject ( Object val ) throws CertificateException { if ( ! ( val instanceof X500Name ) ) { throw new CertificateException ( "Subject class type invalid." ) ; } subject = ( X500Name ) val ; }
Set the subject name of the certificate .
25,638
private void setKey ( Object val ) throws CertificateException { if ( ! ( val instanceof CertificateX509Key ) ) { throw new CertificateException ( "Key class type invalid." ) ; } pubKey = ( CertificateX509Key ) val ; }
Set the public key in the certificate .
25,639
private void setIssuerUniqueId ( Object val ) throws CertificateException { if ( version . compare ( CertificateVersion . V2 ) < 0 ) { throw new CertificateException ( "Invalid version" ) ; } if ( ! ( val instanceof UniqueIdentity ) ) { throw new CertificateException ( "IssuerUniqueId class type invalid." ) ; } issuerU...
Set the Issuer Unique Identity in the certificate .
25,640
private void setSubjectUniqueId ( Object val ) throws CertificateException { if ( version . compare ( CertificateVersion . V2 ) < 0 ) { throw new CertificateException ( "Invalid version" ) ; } if ( ! ( val instanceof UniqueIdentity ) ) { throw new CertificateException ( "SubjectUniqueId class type invalid." ) ; } subje...
Set the Subject Unique Identity in the certificate .
25,641
private void setExtensions ( Object val ) throws CertificateException { if ( version . compare ( CertificateVersion . V3 ) < 0 ) { throw new CertificateException ( "Invalid version" ) ; } if ( ! ( val instanceof CertificateExtensions ) ) { throw new CertificateException ( "Extensions class type invalid." ) ; } extensio...
Set the extensions in the certificate .
25,642
public final Object parseObject ( String source , ParsePosition parsePosition ) { return parse ( source , parsePosition ) ; }
Parses text from a string to produce a number .
25,643
public final String format ( long number ) { StringBuffer buf = new StringBuffer ( 19 ) ; FieldPosition pos = new FieldPosition ( 0 ) ; format ( number , buf , pos ) ; return buf . toString ( ) ; }
Specialization of format .
25,644
public final String format ( java . math . BigDecimal number ) { return format ( number , new StringBuffer ( ) , new FieldPosition ( 0 ) ) . toString ( ) ; }
Convenience method to format a BigDecimal .
25,645
public void setMaximumIntegerDigits ( int newValue ) { maximumIntegerDigits = Math . max ( 0 , newValue ) ; if ( minimumIntegerDigits > maximumIntegerDigits ) minimumIntegerDigits = maximumIntegerDigits ; }
Sets the maximum number of digits allowed in the integer portion of a number . This must be &gt ; = minimumIntegerDigits . If the new value for maximumIntegerDigits is less than the current value of minimumIntegerDigits then minimumIntegerDigits will also be set to the new value .
25,646
public void setMinimumIntegerDigits ( int newValue ) { minimumIntegerDigits = Math . max ( 0 , newValue ) ; if ( minimumIntegerDigits > maximumIntegerDigits ) maximumIntegerDigits = minimumIntegerDigits ; }
Sets the minimum number of digits allowed in the integer portion of a number . This must be &lt ; = maximumIntegerDigits . If the new value for minimumIntegerDigits is more than the current value of maximumIntegerDigits then maximumIntegerDigits will also be set to the new value .
25,647
public void setMinimumFractionDigits ( int newValue ) { minimumFractionDigits = Math . max ( 0 , newValue ) ; if ( maximumFractionDigits < minimumFractionDigits ) maximumFractionDigits = minimumFractionDigits ; }
Sets the minimum number of digits allowed in the fraction portion of a number . This must be &lt ; = maximumFractionDigits . If the new value for minimumFractionDigits exceeds the current value of maximumFractionDigits then maximumFractionDigits will also be set to the new value .
25,648
public static NumberFormat getInstance ( ULocale desiredLocale , int choice ) { if ( choice < NUMBERSTYLE || choice > STANDARDCURRENCYSTYLE ) { throw new IllegalArgumentException ( "choice should be from NUMBERSTYLE to STANDARDCURRENCYSTYLE" ) ; } return getShim ( ) . createInstance ( desiredLocale , choice ) ; }
Returns a specific style number format for a specific locale .
25,649
static NumberFormat createInstance ( ULocale desiredLocale , int choice ) { String pattern = getPattern ( desiredLocale , choice ) ; DecimalFormatSymbols symbols = new DecimalFormatSymbols ( desiredLocale ) ; if ( choice == CURRENCYSTYLE || choice == ISOCURRENCYSTYLE || choice == ACCOUNTINGCURRENCYSTYLE || choice == CA...
Hook for service
25,650
public static boolean isXML11ValidLiteral ( int c ) { return ( ( c < 0x10000 && ( ( XML11CHARS [ c ] & MASK_XML11_VALID ) != 0 && ( XML11CHARS [ c ] & MASK_XML11_CONTROL ) == 0 ) ) || ( 0x10000 <= c && c <= 0x10FFFF ) ) ; }
Returns true if the specified character is valid and permitted outside of a character reference . That is this method will return false for the same set as isXML11Valid except it also reports false for control characters .
25,651
private static int scriptNameToCode ( String name ) { try { int [ ] codes = UScript . getCode ( name ) ; return codes != null ? codes [ 0 ] : UScript . INVALID_CODE ; } catch ( MissingResourceException e ) { return UScript . INVALID_CODE ; } }
Return the script code for a given name or UScript . INVALID_CODE if not found .
25,652
protected String resolvePrefix ( SerializationHandler rhandler , String prefix , String nodeNamespace ) throws TransformerException { return prefix ; }
Resolve the namespace into a prefix . Meant to be overidded by elemAttribute if this class is derived .
25,653
private boolean mapPatternElemPos ( int nesting , boolean isStart , boolean isAttrName ) { if ( 0 == nesting ) { if ( m_patternMapSize >= m_patternMap . length ) { int patternMap [ ] = m_patternMap ; int len = m_patternMap . length ; m_patternMap = new int [ m_patternMapSize + 100 ] ; System . arraycopy ( patternMap , ...
Record the current position on the token queue as long as this is a top - level element . Must be called before the next token is added to the m_tokenQueue .
25,654
private int getTokenQueuePosFromMap ( int i ) { int pos = m_patternMap [ i ] ; return ( pos >= TARGETEXTRA ) ? ( pos - TARGETEXTRA ) : pos ; }
Given a map pos return the corresponding token queue pos .
25,655
private final void resetTokenMark ( int mark ) { int qsz = m_compiler . getTokenQueueSize ( ) ; m_processor . m_queueMark = ( mark > 0 ) ? ( ( mark <= qsz ) ? mark - 1 : mark ) : 0 ; if ( m_processor . m_queueMark < qsz ) { m_processor . m_token = ( String ) m_compiler . getTokenQueue ( ) . elementAt ( m_processor . m_...
Reset token queue mark and m_token to a given position .
25,656
final int getKeywordToken ( String key ) { int tok ; try { Integer itok = ( Integer ) Keywords . getKeyWord ( key ) ; tok = ( null != itok ) ? itok . intValue ( ) : 0 ; } catch ( NullPointerException npe ) { tok = 0 ; } catch ( ClassCastException cce ) { tok = 0 ; } return tok ; }
Given a string return the corresponding keyword token .
25,657
private void recordTokenString ( Vector targetStrings ) { int tokPos = getTokenQueuePosFromMap ( m_patternMapSize - 1 ) ; resetTokenMark ( tokPos + 1 ) ; if ( m_processor . lookahead ( '(' , 1 ) ) { int tok = getKeywordToken ( m_processor . m_token ) ; switch ( tok ) { case OpCodes . NODETYPE_COMMENT : targetStrings . ...
Record the current token in the passed vector .
25,658
private int mapNSTokens ( String pat , int startSubstring , int posOfNSSep , int posOfScan ) throws javax . xml . transform . TransformerException { String prefix = "" ; if ( ( startSubstring >= 0 ) && ( posOfNSSep >= 0 ) ) { prefix = pat . substring ( startSubstring , posOfNSSep ) ; } String uName ; if ( ( null != m_n...
When a seperator token is found see if there s a element name or the like to map .
25,659
public ULocale getLocale ( int index ) { List < ULocale > lcls = locales ; if ( lcls == null ) { lcls = guessLocales ( ) ; } if ( index >= 0 && index < lcls . size ( ) ) { return lcls . get ( index ) ; } return null ; }
Convenience function for getting the locales in priority order
25,660
public GlobalizationPreferences setLocales ( String acceptLanguageString ) { if ( isFrozen ( ) ) { throw new UnsupportedOperationException ( "Attempt to modify immutable object" ) ; } ULocale [ ] acceptLocales = null ; try { acceptLocales = ULocale . parseAcceptLanguage ( acceptLanguageString , true ) ; } catch ( Parse...
Convenience routine for setting the locale priority list from an Accept - Language string .
25,661
public GlobalizationPreferences setCalendar ( Calendar calendar ) { if ( isFrozen ( ) ) { throw new UnsupportedOperationException ( "Attempt to modify immutable object" ) ; } this . calendar = ( Calendar ) calendar . clone ( ) ; return this ; }
Sets the calendar . If this has not been set uses default for territory .
25,662
public Calendar getCalendar ( ) { if ( calendar == null ) { return guessCalendar ( ) ; } Calendar temp = ( Calendar ) calendar . clone ( ) ; temp . setTimeZone ( getTimeZone ( ) ) ; temp . setTimeInMillis ( System . currentTimeMillis ( ) ) ; return temp ; }
Get a copy of the calendar according to the settings .
25,663
public GlobalizationPreferences setTimeZone ( TimeZone timezone ) { if ( isFrozen ( ) ) { throw new UnsupportedOperationException ( "Attempt to modify immutable object" ) ; } this . timezone = ( TimeZone ) timezone . clone ( ) ; return this ; }
Sets the timezone ID . If this has not been set uses default for territory .
25,664
public Collator getCollator ( ) { if ( collator == null ) { return guessCollator ( ) ; } try { return ( Collator ) collator . clone ( ) ; } catch ( CloneNotSupportedException e ) { throw new ICUCloneNotSupportedException ( "Error in cloning collator" , e ) ; } }
Get a copy of the collator according to the settings .
25,665
public GlobalizationPreferences setCollator ( Collator collator ) { if ( isFrozen ( ) ) { throw new UnsupportedOperationException ( "Attempt to modify immutable object" ) ; } try { this . collator = ( Collator ) collator . clone ( ) ; } catch ( CloneNotSupportedException e ) { throw new ICUCloneNotSupportedException ( ...
Explicitly set the collator for this object .
25,666
public BreakIterator getBreakIterator ( int type ) { if ( type < BI_CHARACTER || type >= BI_LIMIT ) { throw new IllegalArgumentException ( "Illegal break iterator type" ) ; } if ( breakIterators == null || breakIterators [ type ] == null ) { return guessBreakIterator ( type ) ; } return ( BreakIterator ) breakIterators...
Get a copy of the break iterator for the specified type according to the settings .
25,667
public GlobalizationPreferences setBreakIterator ( int type , BreakIterator iterator ) { if ( type < BI_CHARACTER || type >= BI_LIMIT ) { throw new IllegalArgumentException ( "Illegal break iterator type" ) ; } if ( isFrozen ( ) ) { throw new UnsupportedOperationException ( "Attempt to modify immutable object" ) ; } if...
Explicitly set the break iterator for this object .
25,668
public GlobalizationPreferences setDateFormat ( int dateStyle , int timeStyle , DateFormat format ) { if ( isFrozen ( ) ) { throw new UnsupportedOperationException ( "Attempt to modify immutable object" ) ; } if ( dateFormats == null ) { dateFormats = new DateFormat [ DF_LIMIT ] [ DF_LIMIT ] ; } dateFormats [ dateStyle...
Set an explicit date format . Overrides the locale priority list for a particular combination of dateStyle and timeStyle . DF_NONE should be used if for the style where only the date or time format individually is being set .
25,669
public GlobalizationPreferences setNumberFormat ( int style , NumberFormat format ) { if ( isFrozen ( ) ) { throw new UnsupportedOperationException ( "Attempt to modify immutable object" ) ; } if ( numberFormats == null ) { numberFormats = new NumberFormat [ NF_LIMIT ] ; } numberFormats [ style ] = ( NumberFormat ) for...
Sets a number format explicitly . Overrides the general locale settings .
25,670
public GlobalizationPreferences reset ( ) { if ( isFrozen ( ) ) { throw new UnsupportedOperationException ( "Attempt to modify immutable object" ) ; } locales = null ; territory = null ; calendar = null ; collator = null ; breakIterators = null ; timezone = null ; currency = null ; dateFormats = null ; numberFormats = ...
Restore the object to the initial state .
25,671
protected String guessTerritory ( ) { String result ; for ( ULocale locale : getLocales ( ) ) { result = locale . getCountry ( ) ; if ( result . length ( ) != 0 ) { return result ; } } ULocale firstLocale = getLocale ( 0 ) ; String language = firstLocale . getLanguage ( ) ; String script = firstLocale . getScript ( ) ;...
This function can be overridden by subclasses to use different heuristics .
25,672
public void error ( TransformerException exception ) throws TransformerException { if ( m_throwExceptionOnError ) throw exception ; else { PrintWriter pw = getErrorWriter ( ) ; printLocation ( pw , exception ) ; pw . println ( exception . getMessage ( ) ) ; } }
Receive notification of a recoverable error .
25,673
private void readInput ( ) { if ( buf . limit ( ) == buf . capacity ( ) ) makeSpace ( ) ; int p = buf . position ( ) ; buf . position ( buf . limit ( ) ) ; buf . limit ( buf . capacity ( ) ) ; int n = 0 ; try { n = source . read ( buf ) ; } catch ( IOException ioe ) { lastException = ioe ; n = - 1 ; } if ( n == - 1 ) {...
Tries to read more input . May block .
25,674
private boolean makeSpace ( ) { clearCaches ( ) ; int offset = savedScannerPosition == - 1 ? position : savedScannerPosition ; buf . position ( offset ) ; if ( offset > 0 ) { buf . compact ( ) ; translateSavedIndexes ( offset ) ; position -= offset ; buf . flip ( ) ; return true ; } int newSize = buf . capacity ( ) * 2...
or else there will be space in the buffer
25,675
private boolean hasTokenInBuffer ( ) { matchValid = false ; matcher . usePattern ( delimPattern ) ; matcher . region ( position , buf . limit ( ) ) ; if ( matcher . lookingAt ( ) ) position = matcher . end ( ) ; if ( position == buf . limit ( ) ) return false ; return true ; }
means that there will be another token with or without more input .
25,676
private String findPatternInBuffer ( Pattern pattern , int horizon ) { matchValid = false ; matcher . usePattern ( pattern ) ; int bufferLimit = buf . limit ( ) ; int horizonLimit = - 1 ; int searchLimit = bufferLimit ; if ( horizon > 0 ) { horizonLimit = position + horizon ; if ( horizonLimit < bufferLimit ) searchLim...
Returns a match for the specified input pattern .
25,677
private String matchPatternInBuffer ( Pattern pattern ) { matchValid = false ; matcher . usePattern ( pattern ) ; matcher . region ( position , buf . limit ( ) ) ; if ( matcher . lookingAt ( ) ) { if ( matcher . hitEnd ( ) && ( ! sourceClosed ) ) { needInput = true ; return null ; } position = matcher . end ( ) ; retur...
the current position
25,678
public void close ( ) { if ( closed ) return ; if ( source instanceof Closeable ) { try { ( ( Closeable ) source ) . close ( ) ; } catch ( IOException ioe ) { lastException = ioe ; } } sourceClosed = true ; source = null ; closed = true ; }
Closes this scanner .
25,679
public Scanner useLocale ( Locale locale ) { if ( locale . equals ( this . locale ) ) return this ; this . locale = locale ; DecimalFormat df = ( DecimalFormat ) NumberFormat . getNumberInstance ( locale ) ; DecimalFormatSymbols dfs = DecimalFormatSymbols . getInstance ( locale ) ; groupSeparator = "\\" + dfs . getGrou...
Sets this scanner s locale to the specified locale .
25,680
public Scanner useRadix ( int radix ) { if ( ( radix < Character . MIN_RADIX ) || ( radix > Character . MAX_RADIX ) ) throw new IllegalArgumentException ( "radix:" + radix ) ; if ( this . defaultRadix == radix ) return this ; this . defaultRadix = radix ; integerPattern = null ; return this ; }
Sets this scanner s default radix to the specified radix .
25,681
private void setRadix ( int radix ) { if ( radix > Character . MAX_RADIX ) { throw new IllegalArgumentException ( "radix == " + radix ) ; } if ( this . radix != radix ) { integerPattern = null ; this . radix = radix ; } }
the default is left untouched .
25,682
public boolean hasNext ( ) { ensureOpen ( ) ; saveState ( ) ; while ( ! sourceClosed ) { if ( hasTokenInBuffer ( ) ) return revertState ( true ) ; readInput ( ) ; } boolean result = hasTokenInBuffer ( ) ; return revertState ( result ) ; }
Returns true if this scanner has another token in its input . This method may block while waiting for input to scan . The scanner does not advance past any input .
25,683
public boolean hasNext ( Pattern pattern ) { ensureOpen ( ) ; if ( pattern == null ) throw new NullPointerException ( ) ; hasNextPattern = null ; saveState ( ) ; while ( true ) { if ( getCompleteTokenInBuffer ( pattern ) != null ) { matchValid = true ; cacheResult ( ) ; return revertState ( true ) ; } if ( needInput ) ...
Returns true if the next complete token matches the specified pattern . A complete token is prefixed and postfixed by input that matches the delimiter pattern . This method may block while waiting for input . The scanner does not advance past any input .
25,684
public boolean hasNextLine ( ) { saveState ( ) ; String result = findWithinHorizon ( linePattern ( ) , 0 ) ; if ( result != null ) { MatchResult mr = this . match ( ) ; String lineSep = mr . group ( 1 ) ; if ( lineSep != null ) { result = result . substring ( 0 , result . length ( ) - lineSep . length ( ) ) ; cacheResu...
Returns true if there is another line in the input of this scanner . This method may block while waiting for input . The scanner does not advance past any input .
25,685
public String nextLine ( ) { if ( hasNextPattern == linePattern ( ) ) return getCachedResult ( ) ; clearCaches ( ) ; String result = findWithinHorizon ( linePattern , 0 ) ; if ( result == null ) throw new NoSuchElementException ( "No line found" ) ; MatchResult mr = this . match ( ) ; String lineSep = mr . group ( 1 ) ...
Advances this scanner past the current line and returns the input that was skipped .
25,686
public String findWithinHorizon ( String pattern , int horizon ) { return findWithinHorizon ( patternCache . forName ( pattern ) , horizon ) ; }
Attempts to find the next occurrence of a pattern constructed from the specified string ignoring delimiters .
25,687
public String findWithinHorizon ( Pattern pattern , int horizon ) { ensureOpen ( ) ; if ( pattern == null ) throw new NullPointerException ( ) ; if ( horizon < 0 ) throw new IllegalArgumentException ( "horizon < 0" ) ; clearCaches ( ) ; while ( true ) { String token = findPatternInBuffer ( pattern , horizon ) ; if ( to...
Attempts to find the next occurrence of the specified pattern .
25,688
public Scanner skip ( Pattern pattern ) { ensureOpen ( ) ; if ( pattern == null ) throw new NullPointerException ( ) ; clearCaches ( ) ; while ( true ) { String token = matchPatternInBuffer ( pattern ) ; if ( token != null ) { matchValid = true ; position = matcher . end ( ) ; return this ; } if ( needInput ) readInput...
Skips input that matches the specified pattern ignoring delimiters . This method will skip input if an anchored match of the specified pattern succeeds .
25,689
private String processIntegerToken ( String token ) { String result = token . replaceAll ( "" + groupSeparator , "" ) ; boolean isNegative = false ; int preLen = negativePrefix . length ( ) ; if ( ( preLen > 0 ) && result . startsWith ( negativePrefix ) ) { isNegative = true ; result = result . substring ( preLen ) ; }...
The integer token must be stripped of prefixes group separators and suffixes non ascii digits must be converted into ascii digits before parse will accept it .
25,690
private String processFloatToken ( String token ) { String result = token . replaceAll ( groupSeparator , "" ) ; if ( ! decimalSeparator . equals ( "\\." ) ) result = result . replaceAll ( decimalSeparator , "." ) ; boolean isNegative = false ; int preLen = negativePrefix . length ( ) ; if ( ( preLen > 0 ) && result . ...
The float token must be stripped of prefixes group separators and suffixes non ascii digits must be converted into ascii digits before parseFloat will accept it .
25,691
public Scanner reset ( ) { delimPattern = WHITESPACE_PATTERN ; useLocale ( Locale . getDefault ( Locale . Category . FORMAT ) ) ; useRadix ( 10 ) ; clearCaches ( ) ; return this ; }
Resets this scanner .
25,692
public void removeAttribute ( int index ) { int origMax = getLength ( ) - 1 ; super . removeAttribute ( index ) ; if ( index != origMax ) { System . arraycopy ( declared , index + 1 , declared , index , origMax - index ) ; System . arraycopy ( specified , index + 1 , specified , index , origMax - index ) ; } }
javadoc entirely from superclass
25,693
public void setDeclared ( int index , boolean value ) { if ( index < 0 || index >= getLength ( ) ) throw new ArrayIndexOutOfBoundsException ( "No attribute at index: " + index ) ; declared [ index ] = value ; }
Assign a value to the declared flag of a specific attribute . This is normally needed only for attributes of type CDATA including attributes whose type is changed to or from CDATA .
25,694
public void setSpecified ( int index , boolean value ) { if ( index < 0 || index >= getLength ( ) ) throw new ArrayIndexOutOfBoundsException ( "No attribute at index: " + index ) ; specified [ index ] = value ; }
Assign a value to the specified flag of a specific attribute . This is the only way this flag can be cleared except clearing by initialization with the copy constructor .
25,695
public Expression getArg ( int n ) { if ( n >= 0 && n < m_argVec . size ( ) ) return ( Expression ) m_argVec . elementAt ( n ) ; else return null ; }
Return the nth argument passed to the extension function .
25,696
public void callArgVisitors ( XPathVisitor visitor ) { for ( int i = 0 ; i < m_argVec . size ( ) ; i ++ ) { Expression exp = ( Expression ) m_argVec . elementAt ( i ) ; exp . callVisitors ( new ArgExtOwner ( exp ) , visitor ) ; } }
Call the visitors for the function arguments .
25,697
public void exprSetParent ( ExpressionNode n ) { super . exprSetParent ( n ) ; int nArgs = m_argVec . size ( ) ; for ( int i = 0 ; i < nArgs ; i ++ ) { Expression arg = ( Expression ) m_argVec . elementAt ( i ) ; arg . exprSetParent ( n ) ; } }
Set the parent node . For an extension function we also need to set the parent node for all argument expressions .
25,698
protected void reportWrongNumberArgs ( ) throws WrongNumberArgsException { String fMsg = XSLMessages . createXPATHMessage ( XPATHErrorResources . ER_INCORRECT_PROGRAMMER_ASSERTION , new Object [ ] { "Programmer's assertion: the method FunctionMultiArgs.reportWrongNumberArgs() should never be called." } ) ; throw new R...
Constructs and throws a WrongNumberArgException with the appropriate message for this function object . This class supports an arbitrary number of arguments so this method must never be called .
25,699
public void execute ( TransformerImpl transformer ) throws TransformerException { try { SerializationHandler rth = transformer . getResultTreeHandler ( ) ; if ( m_disableOutputEscaping ) { rth . processingInstruction ( javax . xml . transform . Result . PI_DISABLE_OUTPUT_ESCAPING , "" ) ; } rth . characters ( m_ch , 0 ...
Copy the text literal to the result tree .