idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
25,900
public static BaseLocale createInstance ( String language , String region ) { BaseLocale base = new BaseLocale ( language , region ) ; CACHE . put ( new Key ( language , region ) , base ) ; return base ; }
validation is performed .
25,901
private void initializeFromReadOnlyPatterns ( DateIntervalInfo dii ) { fFallbackIntervalPattern = dii . fFallbackIntervalPattern ; fFirstDateInPtnIsLaterDate = dii . fFirstDateInPtnIsLaterDate ; fIntervalPatterns = dii . fIntervalPatterns ; fIntervalPatternsReadOnly = true ; }
Initialize this object
25,902
public static PatternInfo genPatternInfo ( String intervalPattern , boolean laterDateFirst ) { int splitPoint = splitPatternInto2Part ( intervalPattern ) ; String firstPart = intervalPattern . substring ( 0 , splitPoint ) ; String secondPart = null ; if ( splitPoint < intervalPattern . length ( ) ) { secondPart = inter...
Break interval patterns as 2 part and save them into pattern info .
25,903
public PatternInfo getIntervalPattern ( String skeleton , int field ) { if ( field > MINIMUM_SUPPORTED_CALENDAR_FIELD ) { throw new IllegalArgumentException ( "no support for field less than SECOND" ) ; } Map < String , PatternInfo > patternsOfOneSkeleton = fIntervalPatterns . get ( skeleton ) ; if ( patternsOfOneSkele...
Get the interval pattern given the largest different calendar field .
25,904
public void setFallbackIntervalPattern ( String fallbackPattern ) { if ( frozen ) { throw new UnsupportedOperationException ( "no modification is allowed after DII is frozen" ) ; } int firstPatternIndex = fallbackPattern . indexOf ( "{0}" ) ; int secondPatternIndex = fallbackPattern . indexOf ( "{1}" ) ; if ( firstPatt...
Re - set the fallback interval pattern .
25,905
static void parseSkeleton ( String skeleton , int [ ] skeletonFieldWidth ) { int PATTERN_CHAR_BASE = 0x41 ; for ( int i = 0 ; i < skeleton . length ( ) ; ++ i ) { ++ skeletonFieldWidth [ skeleton . charAt ( i ) - PATTERN_CHAR_BASE ] ; } }
Parse skeleton save each field s width . It is used for looking for best match skeleton and adjust pattern field width .
25,906
public Map < String , Map < String , PatternInfo > > getRawPatterns ( ) { LinkedHashMap < String , Map < String , PatternInfo > > result = new LinkedHashMap < String , Map < String , PatternInfo > > ( ) ; for ( Entry < String , Map < String , PatternInfo > > entry : fIntervalPatterns . entrySet ( ) ) { result . put ( e...
Get the internal patterns with a deep clone for safety .
25,907
private void init ( String publicId , String systemId , int lineNumber , int columnNumber ) { this . publicId = publicId ; this . systemId = systemId ; this . lineNumber = lineNumber ; this . columnNumber = columnNumber ; }
Internal initialization method .
25,908
void addExpectedPolicy ( String expectedPolicy ) { if ( isImmutable ) { throw new IllegalStateException ( "PolicyNode is immutable" ) ; } if ( mOriginalExpectedPolicySet ) { mExpectedPolicySet . clear ( ) ; mOriginalExpectedPolicySet = false ; } mExpectedPolicySet . add ( expectedPolicy ) ; }
Adds an expectedPolicy to the expected policy set . If this is the original expected policy set initialized by the constructor then the expected policy set is cleared before the expected policy is added .
25,909
void prune ( int depth ) { if ( isImmutable ) throw new IllegalStateException ( "PolicyNode is immutable" ) ; if ( mChildren . size ( ) == 0 ) return ; Iterator < PolicyNodeImpl > it = mChildren . iterator ( ) ; while ( it . hasNext ( ) ) { PolicyNodeImpl node = it . next ( ) ; node . prune ( depth ) ; if ( ( node . mC...
Removes all paths which don t reach the specified depth .
25,910
Set < PolicyNodeImpl > getPolicyNodes ( int depth ) { Set < PolicyNodeImpl > set = new HashSet < > ( ) ; getPolicyNodes ( depth , set ) ; return set ; }
Returns all nodes at the specified depth in the tree .
25,911
private void getPolicyNodes ( int depth , Set < PolicyNodeImpl > set ) { if ( mDepth == depth ) { set . add ( this ) ; } else { for ( PolicyNodeImpl node : mChildren ) { node . getPolicyNodes ( depth , set ) ; } } }
Add all nodes at depth depth to set and return the Set . Internal recursion helper .
25,912
Set < PolicyNodeImpl > getPolicyNodesValid ( int depth , String validOID ) { HashSet < PolicyNodeImpl > set = new HashSet < > ( ) ; if ( mDepth < depth ) { for ( PolicyNodeImpl node : mChildren ) { set . addAll ( node . getPolicyNodesValid ( depth , validOID ) ) ; } } else { if ( mValidPolicy . equals ( validOID ) ) se...
Finds all nodes at the specified depth that contains the specified valid OID
25,913
String asString ( ) { if ( mParent == null ) { return "anyPolicy ROOT\n" ; } else { StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 , n = getDepth ( ) ; i < n ; i ++ ) { sb . append ( " " ) ; } sb . append ( policyToString ( getValidPolicy ( ) ) ) ; sb . append ( " CRIT: " ) ; sb . append ( isCritical ( )...
Prints out some data on this node .
25,914
Element getElementById ( String name ) { for ( Attr attr : attributes ) { if ( attr . isId ( ) && name . equals ( attr . getValue ( ) ) ) { return this ; } } if ( name . equals ( getAttribute ( "id" ) ) ) { return this ; } for ( NodeImpl node : children ) { if ( node . getNodeType ( ) == Node . ELEMENT_NODE ) { Element...
This implementation walks the entire document looking for an element with the given ID attribute . We should consider adding an index to speed navigation of large documents .
25,915
private static Locale strip ( Locale locale ) { String language = locale . getLanguage ( ) ; String country = locale . getCountry ( ) ; String variant = locale . getVariant ( ) ; if ( ! variant . isEmpty ( ) ) { variant = "" ; } else if ( ! country . isEmpty ( ) ) { country = "" ; } else if ( ! language . isEmpty ( ) )...
Returns a locale with the most - specific field removed or null if this locale had an empty language country and variant .
25,916
public static byte getBaseDirection ( CharSequence paragraph ) { if ( paragraph == null || paragraph . length ( ) == 0 ) { return NEUTRAL ; } int length = paragraph . length ( ) ; int c ; byte direction ; for ( int i = 0 ; i < length ; ) { c = UCharacter . codePointAt ( paragraph , i ) ; direction = UCharacter . getDir...
Get the base direction of the text provided according to the Unicode Bidirectional Algorithm . The base direction is derived from the first character in the string with bidirectional character type L R or AL . If the first such character has type L LTR is returned . If the first such character has type R or AL RTL is r...
25,917
private byte firstL_R_AL ( ) { byte result = ON ; for ( int i = 0 ; i < prologue . length ( ) ; ) { int uchar = prologue . codePointAt ( i ) ; i += Character . charCount ( uchar ) ; byte dirProp = ( byte ) getCustomizedClass ( uchar ) ; if ( result == ON ) { if ( dirProp == L || dirProp == R || dirProp == AL ) { result...
Returns the directionality of the first strong character after the last B in prologue if any . Requires prologue! = null .
25,918
private byte lastL_R_AL ( ) { for ( int i = prologue . length ( ) ; i > 0 ; ) { int uchar = prologue . codePointBefore ( i ) ; i -= Character . charCount ( uchar ) ; byte dirProp = ( byte ) getCustomizedClass ( uchar ) ; if ( dirProp == L ) { return _L ; } if ( dirProp == R || dirProp == AL ) { return _R ; } if ( dirPr...
Returns the directionality of the last strong character at the end of the prologue if any . Requires prologue! = null .
25,919
private byte firstL_R_AL_EN_AN ( ) { for ( int i = 0 ; i < epilogue . length ( ) ; ) { int uchar = epilogue . codePointAt ( i ) ; i += Character . charCount ( uchar ) ; byte dirProp = ( byte ) getCustomizedClass ( uchar ) ; if ( dirProp == L ) { return _L ; } if ( dirProp == R || dirProp == AL ) { return _R ; } if ( di...
Returns the directionality of the first strong character or digit in the epilogue if any . Requires epilogue! = null .
25,920
public BidiRun getParagraphByIndex ( int paraIndex ) { verifyValidParaOrLine ( ) ; verifyRange ( paraIndex , 0 , paraCount ) ; Bidi bidi = paraBidi ; int paraStart ; if ( paraIndex == 0 ) { paraStart = 0 ; } else { paraStart = bidi . paras_limit [ paraIndex - 1 ] ; } BidiRun bidiRun = new BidiRun ( ) ; bidiRun . start ...
Get a paragraph given the index of this paragraph .
25,921
void getLogicalToVisualRunsMap ( ) { if ( isGoodLogicalToVisualRunsMap ) { return ; } int count = countRuns ( ) ; if ( ( logicalToVisualRunsMap == null ) || ( logicalToVisualRunsMap . length < count ) ) { logicalToVisualRunsMap = new int [ count ] ; } int i ; long [ ] keys = new long [ count ] ; for ( i = 0 ; i < count...
Compute the logical to visual run mapping
25,922
public int getRunLevel ( int run ) { verifyValidParaOrLine ( ) ; BidiLine . getRuns ( this ) ; verifyRange ( run , 0 , runCount ) ; getLogicalToVisualRunsMap ( ) ; return runs [ logicalToVisualRunsMap [ run ] ] . level ; }
Return the level of the nth logical run in this line .
25,923
public int getRunStart ( int run ) { verifyValidParaOrLine ( ) ; BidiLine . getRuns ( this ) ; verifyRange ( run , 0 , runCount ) ; getLogicalToVisualRunsMap ( ) ; return runs [ logicalToVisualRunsMap [ run ] ] . start ; }
Return the index of the character at the start of the nth logical run in this line as an offset from the start of the line .
25,924
public int getRunLimit ( int run ) { verifyValidParaOrLine ( ) ; BidiLine . getRuns ( this ) ; verifyRange ( run , 0 , runCount ) ; getLogicalToVisualRunsMap ( ) ; int idx = logicalToVisualRunsMap [ run ] ; int len = idx == 0 ? runs [ idx ] . limit : runs [ idx ] . limit - runs [ idx - 1 ] . limit ; return runs [ idx ]...
Return the index of the character past the end of the nth logical run in this line as an offset from the start of the line . For example this will return the length of the line for the last run on the line .
25,925
public static boolean requiresBidi ( char [ ] text , int start , int limit ) { final int RTLMask = ( 1 << UCharacter . DIRECTIONALITY_RIGHT_TO_LEFT | 1 << UCharacter . DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC | 1 << UCharacter . DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING | 1 << UCharacter . DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE...
Return true if the specified text requires bidi analysis . If this returns false the text will display left - to - right . Clients can then avoid constructing a Bidi object . Text in the Arabic Presentation Forms area of Unicode is presumed to already be shaped and ordered for display and so will not cause this method ...
25,926
public static String writeReverse ( String src , int options ) { if ( src == null ) { throw new IllegalArgumentException ( ) ; } if ( src . length ( ) > 0 ) { return BidiWriter . writeReverse ( src , options ) ; } else { return "" ; } }
Reverse a Right - To - Left run of Unicode text .
25,927
private static final int compareInt64AsUnsigned ( long a , long b ) { a += 0x8000000000000000L ; b += 0x8000000000000000L ; if ( a < b ) { return - 1 ; } else if ( a > b ) { return 1 ; } else { return 0 ; } }
Compare two signed long values as if they were unsigned .
25,928
public boolean containsKey ( Object key ) { Object k = maskNull ( key ) ; Object [ ] tab = table ; int len = tab . length ; int i = hash ( k , len ) ; while ( true ) { Object item = tab [ i ] ; if ( item == k ) return true ; if ( item == null ) return false ; i = nextKeyIndex ( i , len ) ; } }
Tests whether the specified object reference is a key in this identity hash map .
25,929
public boolean containsValue ( Object value ) { Object [ ] tab = table ; for ( int i = 1 ; i < tab . length ; i += 2 ) if ( tab [ i ] == value && tab [ i - 1 ] != null ) return true ; return false ; }
Tests whether the specified object reference is a value in this identity hash map .
25,930
private boolean resize ( int newCapacity ) { int newLength = newCapacity * 2 ; Object [ ] oldTable = table ; int oldLength = oldTable . length ; if ( oldLength == 2 * MAXIMUM_CAPACITY ) { if ( size == MAXIMUM_CAPACITY - 1 ) throw new IllegalStateException ( "Capacity exhausted." ) ; return false ; } if ( oldLength >= n...
Resizes the table if necessary to hold given capacity .
25,931
private boolean removeMapping ( Object key , Object value ) { Object k = maskNull ( key ) ; Object [ ] tab = table ; int len = tab . length ; int i = hash ( k , len ) ; while ( true ) { Object item = tab [ i ] ; if ( item == k ) { if ( tab [ i + 1 ] != value ) return false ; modCount ++ ; size -- ; tab [ i ] = null ; t...
Removes the specified key - value mapping from the map if it is present .
25,932
private void closeDeletion ( int d ) { Object [ ] tab = table ; int len = tab . length ; Object item ; for ( int i = nextKeyIndex ( d , len ) ; ( item = tab [ i ] ) != null ; i = nextKeyIndex ( i , len ) ) { int r = hash ( item , len ) ; if ( ( i < r && ( r <= d || d <= i ) ) || ( r <= d && d <= i ) ) { tab [ d ] = ite...
Rehash all possibly - colliding entries following a deletion . This preserves the linear - probe collision properties required by get put etc .
25,933
private void putForCreate ( K key , V value ) throws java . io . StreamCorruptedException { Object k = maskNull ( key ) ; Object [ ] tab = table ; int len = tab . length ; int i = hash ( k , len ) ; Object item ; while ( ( item = tab [ i ] ) != null ) { if ( item == k ) throw new java . io . StreamCorruptedException ( ...
The put method for readObject . It does not resize the table update modCount etc .
25,934
public void setAttribute ( String name , Object value ) throws IllegalArgumentException { if ( name . equals ( FEATURE_INCREMENTAL ) ) { if ( value instanceof Boolean ) { m_incremental = ( ( Boolean ) value ) . booleanValue ( ) ; } else if ( value instanceof String ) { m_incremental = ( new Boolean ( ( String ) value )...
Allows the user to set specific attributes on the underlying implementation .
25,935
public Object getAttribute ( String name ) throws IllegalArgumentException { if ( name . equals ( FEATURE_INCREMENTAL ) ) { return new Boolean ( m_incremental ) ; } else if ( name . equals ( FEATURE_OPTIMIZE ) ) { return new Boolean ( m_optimize ) ; } else if ( name . equals ( FEATURE_SOURCE_LOCATION ) ) { return new B...
Allows the user to retrieve specific attributes on the underlying implementation .
25,936
public TransformerHandler newTransformerHandler ( Source src ) throws TransformerConfigurationException { Templates templates = newTemplates ( src ) ; if ( templates == null ) return null ; return newTransformerHandler ( templates ) ; }
Get a TransformerHandler object that can process SAX ContentHandler events into a Result based on the transformation instructions specified by the argument .
25,937
public TransformerHandler newTransformerHandler ( Templates templates ) throws TransformerConfigurationException { try { TransformerImpl transformer = ( TransformerImpl ) templates . newTransformer ( ) ; transformer . setURIResolver ( m_uriResolver ) ; TransformerHandler th = ( TransformerHandler ) transformer . getInp...
Get a TransformerHandler object that can process SAX ContentHandler events into a Result based on the Templates argument .
25,938
public Transformer newTransformer ( Source source ) throws TransformerConfigurationException { try { Templates tmpl = newTemplates ( source ) ; if ( tmpl == null ) return null ; Transformer transformer = tmpl . newTransformer ( ) ; transformer . setURIResolver ( m_uriResolver ) ; return transformer ; } catch ( Transfor...
Process the source into a Transformer object . Care must be given to know that this object can not be used concurrently in multiple threads .
25,939
public Templates newTemplates ( Source source ) throws TransformerConfigurationException { String baseID = source . getSystemId ( ) ; if ( null != baseID ) { baseID = SystemIDResolver . getAbsoluteURI ( baseID ) ; } if ( source instanceof DOMSource ) { DOMSource dsource = ( DOMSource ) source ; Node node = dsource . ge...
Process the source into a Templates object which is likely a compiled representation of the source . This Templates object may then be used concurrently across multiple threads . Creating a Templates object allows the TransformerFactory to do detailed performance optimization of transformation instructions without pena...
25,940
public void setErrorListener ( ErrorListener listener ) throws IllegalArgumentException { if ( null == listener ) throw new IllegalArgumentException ( XSLMessages . createMessage ( XSLTErrorResources . ER_ERRORLISTENER , null ) ) ; m_errorListener = listener ; }
Set an error listener for the TransformerFactory .
25,941
public static Datasubtype isValid ( Datatype datatype , Set < Datasubtype > datasubtypes , String code ) { Map < Datasubtype , ValiditySet > subtable = ValidityData . data . get ( datatype ) ; if ( subtable != null ) { for ( Datasubtype datasubtype : datasubtypes ) { ValiditySet validitySet = subtable . get ( datasubty...
Returns the Datasubtype containing the code or null if there is none .
25,942
private void setup ( Parser parser ) { if ( parser == null ) { throw new NullPointerException ( "Parser argument must not be null" ) ; } this . parser = parser ; atts = new AttributesImpl ( ) ; nsSupport = new NamespaceSupport ( ) ; attAdapter = new AttributeListAdapter ( ) ; }
Internal setup method .
25,943
public void setFeature ( String name , boolean value ) throws SAXNotRecognizedException , SAXNotSupportedException { if ( name . equals ( NAMESPACES ) ) { checkNotParsing ( "feature" , name ) ; namespaces = value ; if ( ! namespaces && ! prefixes ) { prefixes = true ; } } else if ( name . equals ( NAMESPACE_PREFIXES ) ...
Set a feature flag for the parser .
25,944
public boolean getFeature ( String name ) throws SAXNotRecognizedException , SAXNotSupportedException { if ( name . equals ( NAMESPACES ) ) { return namespaces ; } else if ( name . equals ( NAMESPACE_PREFIXES ) ) { return prefixes ; } else if ( name . equals ( XMLNS_URIs ) ) { return uris ; } else { throw new SAXNotRec...
Check a parser feature flag .
25,945
public void endElement ( String qName ) throws SAXException { if ( ! namespaces ) { if ( contentHandler != null ) { contentHandler . endElement ( "" , "" , qName . intern ( ) ) ; } return ; } String names [ ] = processName ( qName , false , false ) ; if ( contentHandler != null ) { contentHandler . endElement ( names [...
Adapter implementation method ; do not call . Adapt a SAX1 end element event .
25,946
public void ignorableWhitespace ( char ch [ ] , int start , int length ) throws SAXException { if ( contentHandler != null ) { contentHandler . ignorableWhitespace ( ch , start , length ) ; } }
Adapter implementation method ; do not call . Adapt a SAX1 ignorable whitespace event .
25,947
public void processingInstruction ( String target , String data ) throws SAXException { if ( contentHandler != null ) { contentHandler . processingInstruction ( target , data ) ; } }
Adapter implementation method ; do not call . Adapt a SAX1 processing instruction event .
25,948
private void setupParser ( ) { if ( ! prefixes && ! namespaces ) throw new IllegalStateException ( ) ; nsSupport . reset ( ) ; if ( uris ) nsSupport . setNamespaceDeclUris ( true ) ; if ( entityResolver != null ) { parser . setEntityResolver ( entityResolver ) ; } if ( dtdHandler != null ) { parser . setDTDHandler ( dt...
Initialize the parser before each run .
25,949
void reportError ( String message ) throws SAXException { if ( errorHandler != null ) errorHandler . error ( makeException ( message ) ) ; }
Report a non - fatal error .
25,950
private SAXParseException makeException ( String message ) { if ( locator != null ) { return new SAXParseException ( message , locator ) ; } else { return new SAXParseException ( message , null , null , - 1 , - 1 ) ; } }
Construct an exception for the current context .
25,951
private void checkNotParsing ( String type , String name ) throws SAXNotSupportedException { if ( parsing ) { throw new SAXNotSupportedException ( "Cannot change " + type + ' ' + name + " while parsing" ) ; } }
Throw an exception if we are parsing .
25,952
public static boolean isConformantSchemeName ( String p_scheme ) { if ( p_scheme == null || p_scheme . trim ( ) . length ( ) == 0 ) { return false ; } if ( ! isAlpha ( p_scheme . charAt ( 0 ) ) ) { return false ; } char testChar ; for ( int i = 1 ; i < p_scheme . length ( ) ; i ++ ) { testChar = p_scheme . charAt ( i )...
Determine whether a scheme conforms to the rules for a scheme name . A scheme is conformant if it starts with an alphanumeric and contains only alphanumerics + - and . .
25,953
private void setBigDecimalDigits ( String stringDigits , int maximumDigits , boolean fixedPoint ) { didRound = false ; set ( stringDigits , stringDigits . length ( ) ) ; round ( fixedPoint ? ( maximumDigits + decimalAt ) : maximumDigits == 0 ? - 1 : maximumDigits ) ; }
Internal method that sets this digit list to represent the given value . The value is given as a String of the format returned by BigDecimal .
25,954
public XObject execute ( XPathContext xctxt , int context ) throws javax . xml . transform . TransformerException { DTMIterator nl = m_functionExpr . asIterator ( xctxt , context ) ; XNumber score = SCORE_NONE ; if ( null != nl ) { int n ; while ( DTM . NULL != ( n = nl . nextNode ( ) ) ) { score = ( n == context ) ? S...
Test a node to see if it matches the given node test .
25,955
private void setClassPath ( ) throws IOException { String fullPath = file . getAbsolutePath ( ) ; String rootPath = fullPath . substring ( 0 , fullPath . lastIndexOf ( classFile . getRelativePath ( ) ) ) ; List < File > classPath = new ArrayList < > ( ) ; classPath . add ( new File ( rootPath ) ) ; parserEnv . fileMana...
Set classpath to the root path of the input file to support typeElement lookup .
25,956
private void convertClassInitializer ( AbstractTypeDeclaration typeDecl ) { EntityDeclaration decl = classFile . getMethod ( "<clinit>" , "()V" ) ; if ( decl == null ) { return ; } MethodTranslator translator = new MethodTranslator ( parserEnv , translationEnv , null , typeDecl , null ) ; Block block = ( Block ) decl ....
The clinit method isn t converted into a member element by javac so extract it separately from the classfile .
25,957
protected String toExternalForm ( URL url ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "jar:" ) ; sb . append ( url . getFile ( ) ) ; String ref = url . getRef ( ) ; if ( ref != null ) { sb . append ( ref ) ; } return sb . toString ( ) ; }
Build and return the externalized string representation of url .
25,958
public void encode ( DerOutputStream out ) throws IOException { DerOutputStream seq = new DerOutputStream ( ) ; for ( int i = 0 , n = size ( ) ; i < n ; i ++ ) { get ( i ) . encode ( seq ) ; } out . write ( DerValue . tag_Sequence , seq ) ; }
Encode the GeneralSubtrees .
25,959
private void minimize ( ) { for ( int i = 0 ; i < size ( ) ; i ++ ) { GeneralNameInterface current = getGeneralNameInterface ( i ) ; boolean remove1 = false ; for ( int j = i + 1 ; j < size ( ) ; j ++ ) { GeneralNameInterface subsequent = getGeneralNameInterface ( j ) ; switch ( current . constrains ( subsequent ) ) { ...
minimize this GeneralSubtrees by removing all redundant entries . Internal method used by intersect and reduce .
25,960
private GeneralSubtree createWidestSubtree ( GeneralNameInterface name ) { try { GeneralName newName ; switch ( name . getType ( ) ) { case GeneralNameInterface . NAME_ANY : ObjectIdentifier otherOID = ( ( OtherName ) name ) . getOID ( ) ; newName = new GeneralName ( new OtherName ( otherOID , null ) ) ; break ; case G...
create a subtree containing an instance of the input name type that widens all other names of that type .
25,961
public void union ( GeneralSubtrees other ) { if ( other != null ) { for ( int i = 0 , n = other . size ( ) ; i < n ; i ++ ) { add ( other . get ( i ) ) ; } minimize ( ) ; } }
construct union of this GeneralSubtrees with other .
25,962
public void reduce ( GeneralSubtrees excluded ) { if ( excluded == null ) { return ; } for ( int i = 0 , n = excluded . size ( ) ; i < n ; i ++ ) { GeneralNameInterface excludedName = excluded . getGeneralNameInterface ( i ) ; for ( int j = 0 ; j < size ( ) ; j ++ ) { GeneralNameInterface permitted = getGeneralNameInte...
reduce this GeneralSubtrees by contents of another . This function is used in merging excluded NameConstraints with permitted NameConstraints to obtain a minimal form of permitted NameConstraints . It is an optimization and does not affect correctness of the results .
25,963
String getFunctionName ( int funcID ) { if ( funcID < NUM_BUILT_IN_FUNCS ) return m_functions [ funcID ] . getName ( ) ; else return m_functions_customer [ funcID - NUM_BUILT_IN_FUNCS ] . getName ( ) ; }
Return the name of the a function in the static table . Needed to avoid making the table publicly available .
25,964
Function getFunction ( int which ) throws javax . xml . transform . TransformerException { try { if ( which < NUM_BUILT_IN_FUNCS ) return ( Function ) m_functions [ which ] . newInstance ( ) ; else return ( Function ) m_functions_customer [ which - NUM_BUILT_IN_FUNCS ] . newInstance ( ) ; } catch ( IllegalAccessExcepti...
Obtain a new Function object from a function ID .
25,965
Object getFunctionID ( String key ) { Object id = m_functionID_customer . get ( key ) ; if ( null == id ) id = m_functionID . get ( key ) ; return id ; }
Obtain a function ID from a given function name
25,966
public int installFunction ( String name , Class func ) { int funcIndex ; Object funcIndexObj = getFunctionID ( name ) ; if ( null != funcIndexObj ) { funcIndex = ( ( Integer ) funcIndexObj ) . intValue ( ) ; if ( funcIndex < NUM_BUILT_IN_FUNCS ) { funcIndex = m_funcNextFreeIndex ++ ; m_functionID_customer . put ( name...
Install a built - in function .
25,967
public boolean functionAvailable ( String methName ) { Object tblEntry = m_functionID . get ( methName ) ; if ( null != tblEntry ) return true ; else { tblEntry = m_functionID_customer . get ( methName ) ; return ( null != tblEntry ) ? true : false ; } }
Tell if a built - in non - namespaced function is available .
25,968
void setExtensionsTable ( StylesheetRoot sroot ) throws javax . xml . transform . TransformerException { try { if ( sroot . getExtensions ( ) != null ) if ( ! sroot . isSecureProcessing ( ) ) m_extensionsTable = new ExtensionsTable ( sroot ) ; } catch ( javax . xml . transform . TransformerException te ) { te . printSt...
If the stylesheet contains extensions set the extensions table object .
25,969
public boolean functionAvailable ( String ns , String funcName ) throws javax . xml . transform . TransformerException { return getExtensionsTable ( ) . functionAvailable ( ns , funcName ) ; }
== Implementation of the XPath ExtensionsProvider interface .
25,970
public ContentHandler getInputContentHandler ( boolean doDocFrag ) { if ( null == m_inputContentHandler ) { m_inputContentHandler = new TransformerHandlerImpl ( this , doDocFrag , m_urlOfSource ) ; } return m_inputContentHandler ; }
Get a SAX2 ContentHandler for the input .
25,971
public OutputProperties getOutputFormat ( ) { OutputProperties format = ( null == m_outputFormat ) ? getStylesheet ( ) . getOutputComposed ( ) : m_outputFormat ; return format ; }
Get the output properties used for the transformation .
25,972
public void setParameter ( String name , String namespace , Object value ) { VariableStack varstack = getXPathContext ( ) . getVarStack ( ) ; QName qname = new QName ( namespace , name ) ; XObject xobject = XObject . create ( value , getXPathContext ( ) ) ; StylesheetRoot sroot = m_stylesheetRoot ; Vector vars = sroot ...
Set a parameter for the templates .
25,973
public void setParameter ( String name , Object value ) { if ( value == null ) { throw new IllegalArgumentException ( XSLMessages . createMessage ( XSLTErrorResources . ER_INVALID_SET_PARAM_VALUE , new Object [ ] { name } ) ) ; } StringTokenizer tokenizer = new StringTokenizer ( name , "{}" , false ) ; try { String s1 ...
Set a parameter for the transformation .
25,974
private void replaceOrPushUserParam ( QName qname , XObject xval ) { int n = m_userParams . size ( ) ; for ( int i = n - 1 ; i >= 0 ; i -- ) { Arg arg = ( Arg ) m_userParams . elementAt ( i ) ; if ( arg . getQName ( ) . equals ( qname ) ) { m_userParams . setElementAt ( new Arg ( qname , xval , true ) , i ) ; return ; ...
NEEDSDOC Method replaceOrPushUserParam
25,975
public void setParameters ( Properties params ) { clearParameters ( ) ; Enumeration names = params . propertyNames ( ) ; while ( names . hasMoreElements ( ) ) { String name = params . getProperty ( ( String ) names . nextElement ( ) ) ; StringTokenizer tokenizer = new StringTokenizer ( name , "{}" , false ) ; try { Str...
Set a bag of parameters for the transformation . Note that these will not be additive they will replace the existing set of parameters .
25,976
public void clearParameters ( ) { synchronized ( m_reentryGuard ) { VariableStack varstack = new VariableStack ( ) ; m_xcontext . setVarStack ( varstack ) ; m_userParams = null ; } }
Reset the parameters to a null list .
25,977
public void setContentHandler ( ContentHandler handler ) { if ( handler == null ) { throw new NullPointerException ( XSLMessages . createMessage ( XSLTErrorResources . ER_NULL_CONTENT_HANDLER , null ) ) ; } else { m_outputContentHandler = handler ; if ( null == m_serializationHandler ) { ToXMLSAXHandler h = new ToXMLSA...
Set the content event handler .
25,978
public int transformToGlobalRTF ( ElemTemplateElement templateParent ) throws TransformerException { DTM dtmFrag = m_xcontext . getGlobalRTFDTM ( ) ; return transformToRTF ( templateParent , dtmFrag ) ; }
Given a stylesheet element create a result tree fragment from it s contents . The fragment will also use the shared DTM system but will obtain its space from the global variable pool rather than the dynamic variable stack . This allows late binding of XUnresolvedVariables without the risk that their content will be dis...
25,979
public String transformToString ( ElemTemplateElement elem ) throws TransformerException { ElemTemplateElement firstChild = elem . getFirstChildElem ( ) ; if ( null == firstChild ) return "" ; if ( elem . hasTextLitOnly ( ) && m_optimizer ) { return ( ( ElemTextLiteral ) firstChild ) . getNodeValue ( ) ; } Serializatio...
Take the contents of a template element process it and convert it to a string .
25,980
public void executeChildTemplates ( ElemTemplateElement elem , org . w3c . dom . Node context , QName mode , ContentHandler handler ) throws TransformerException { XPathContext xctxt = m_xcontext ; try { if ( null != mode ) pushMode ( mode ) ; xctxt . pushCurrentNode ( xctxt . getDTMHandleFromNode ( context ) ) ; execu...
Execute each of the children of a template element . This method is only for extension use .
25,981
public boolean isRecursiveAttrSet ( ElemAttributeSet attrSet ) { if ( null == m_attrSetStack ) { m_attrSetStack = new Stack ( ) ; } if ( ! m_attrSetStack . empty ( ) ) { int loc = m_attrSetStack . search ( attrSet ) ; if ( loc > - 1 ) { return true ; } } return false ; }
Check to see if this is a recursive attribute definition .
25,982
public void setErrorListener ( ErrorListener listener ) throws IllegalArgumentException { synchronized ( m_reentryGuard ) { if ( listener == null ) throw new IllegalArgumentException ( XSLMessages . createMessage ( XSLTErrorResources . ER_NULL_ERROR_HANDLER , null ) ) ; m_errorHandler = listener ; } }
Set the error event listener .
25,983
public void waitTransformThread ( ) throws SAXException { Thread transformThread = this . getTransformThread ( ) ; if ( null != transformThread ) { try { ThreadControllerWrapper . waitThread ( transformThread , this ) ; if ( ! this . hasTransformThreadErrorCatcher ( ) ) { Exception e = this . getExceptionThrown ( ) ; i...
Used by SourceTreeHandler to wait until the transform completes
25,984
public void run ( ) { m_hasBeenReset = false ; try { try { transformNode ( m_doc ) ; } catch ( Exception e ) { if ( null != m_transformThread ) postExceptionFromThread ( e ) ; else throw new RuntimeException ( e . getMessage ( ) ) ; } finally { if ( m_inputContentHandler instanceof TransformerHandlerImpl ) { ( ( Transf...
Run the transform thread .
25,985
public void init ( ToXMLSAXHandler h , Transformer transformer , ContentHandler realHandler ) { h . setTransformer ( transformer ) ; h . setContentHandler ( realHandler ) ; }
Initializer method .
25,986
public void write ( Writer writer ) throws IOException { BufferedWriter bw = new BufferedWriter ( writer ) ; if ( vtzlines != null ) { for ( String line : vtzlines ) { if ( line . startsWith ( ICAL_TZURL + COLON ) ) { if ( tzurl != null ) { bw . write ( ICAL_TZURL ) ; bw . write ( COLON ) ; bw . write ( tzurl ) ; bw . ...
Writes RFC2445 VTIMEZONE data for this time zone
25,987
public void write ( Writer writer , long start ) throws IOException { TimeZoneRule [ ] rules = tz . getTimeZoneRules ( start ) ; RuleBasedTimeZone rbtz = new RuleBasedTimeZone ( tz . getID ( ) , ( InitialTimeZoneRule ) rules [ 0 ] ) ; for ( int i = 1 ; i < rules . length ; i ++ ) { rbtz . addTransitionRule ( rules [ i ...
Writes RFC2445 VTIMEZONE data applicable for dates after the specified start time .
25,988
public int getOffset ( int era , int year , int month , int day , int dayOfWeek , int millis ) { long calc = ( year / 400 ) * MILLISECONDS_PER_400_YEARS ; year %= 400 ; calc += year * ( 365 * MILLISECONDS_PER_DAY ) ; calc += ( ( year + 3 ) / 4 ) * MILLISECONDS_PER_DAY ; if ( year > 0 ) { calc -= ( ( year - 1 ) / 100 ) ...
This implementation is adapted from libcore s ZoneInfo .
25,989
public XObject execute ( XPathContext xctxt ) throws javax . xml . transform . TransformerException { return operate ( m_right . execute ( xctxt ) ) ; }
Execute the operand and apply the unary operation to the result .
25,990
public String formatDuration ( Object obj ) { javax . xml . datatype . DatatypeConstants . Field inFields [ ] = { javax . xml . datatype . DatatypeConstants . YEARS , javax . xml . datatype . DatatypeConstants . MONTHS , javax . xml . datatype . DatatypeConstants . DAYS , javax . xml . datatype . DatatypeConstants . HO...
JDK 1 . 5 + only
25,991
public static Calendar getInstance ( TimeZone zone , Locale aLocale ) { return getInstanceInternal ( zone , ULocale . forLocale ( aLocale ) ) ; }
Returns a calendar with the specified time zone and locale .
25,992
public final void set ( int field , int value ) { if ( areFieldsVirtuallySet ) { computeFields ( ) ; } fields [ field ] = value ; if ( nextStamp == STAMP_MAX ) { recalculateStamp ( ) ; } stamp [ field ] = nextStamp ++ ; isTimeSet = areFieldsSet = areFieldsVirtuallySet = false ; }
Sets the time field with the given value .
25,993
private static int gregoYearFromIslamicStart ( int year ) { int cycle , offset , shift = 0 ; if ( year >= 1397 ) { cycle = ( year - 1397 ) / 67 ; offset = ( year - 1397 ) % 67 ; shift = 2 * cycle + ( ( offset >= 33 ) ? 1 : 0 ) ; } else { cycle = ( year - 1396 ) / 67 - 1 ; offset = - ( year - 1396 ) % 67 ; shift = 2 * c...
utility function for getRelatedYear
25,994
private static int firstIslamicStartYearFromGrego ( int year ) { int cycle , offset , shift = 0 ; if ( year >= 1977 ) { cycle = ( year - 1977 ) / 65 ; offset = ( year - 1977 ) % 65 ; shift = 2 * cycle + ( ( offset >= 32 ) ? 1 : 0 ) ; } else { cycle = ( year - 1976 ) / 65 - 1 ; offset = - ( year - 1976 ) % 65 ; shift = ...
utility function for setRelatedYear
25,995
public final void clear ( int field ) { if ( areFieldsVirtuallySet ) { computeFields ( ) ; } fields [ field ] = 0 ; stamp [ field ] = UNSET ; isTimeSet = areFieldsSet = areAllFieldsSet = areFieldsVirtuallySet = false ; }
Clears the value in the given time field .
25,996
private long compare ( Object that ) { long thatMs ; if ( that instanceof Calendar ) { thatMs = ( ( Calendar ) that ) . getTimeInMillis ( ) ; } else if ( that instanceof Date ) { thatMs = ( ( Date ) that ) . getTime ( ) ; } else { throw new IllegalArgumentException ( that + "is not a Calendar or Date" ) ; } return getT...
Returns the difference in milliseconds between the moment this calendar is set to and the moment the given calendar or Date object is set to .
25,997
protected void prepareGetActual ( int field , boolean isMinimum ) { set ( MILLISECONDS_IN_DAY , 0 ) ; switch ( field ) { case YEAR : case EXTENDED_YEAR : set ( DAY_OF_YEAR , getGreatestMinimum ( DAY_OF_YEAR ) ) ; break ; case YEAR_WOY : set ( WEEK_OF_YEAR , getGreatestMinimum ( WEEK_OF_YEAR ) ) ; break ; case MONTH : s...
Prepare this calendar for computing the actual minimum or maximum . This method modifies this calendar s fields ; it is called on a temporary calendar .
25,998
private static PatternData getPatternData ( ULocale locale , String calType ) { ICUResourceBundle rb = ( ICUResourceBundle ) UResourceBundle . getBundleInstance ( ICUData . ICU_BASE_NAME , locale ) ; ICUResourceBundle dtPatternsRb = rb . findWithFallback ( "calendar/" + calType + "/DateTimePatterns" ) ; if ( dtPatterns...
Retrieves the DateTime patterns and overrides from the resource bundle and generates a new PatternData object .
25,999
public void setMinimalDaysInFirstWeek ( int value ) { if ( value < 1 ) { value = 1 ; } else if ( value > 7 ) { value = 7 ; } if ( minimalDaysInFirstWeek != value ) { minimalDaysInFirstWeek = value ; areFieldsSet = false ; } }
Sets what the minimal days required in the first week of the year are . For example if the first week is defined as one that contains the first day of the first month of a year call the method with value 1 . If it must be a full week use value 7 .