idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
26,400
private Result nextImpl ( int pos , int inUnit ) { int node = chars_ . charAt ( pos ++ ) ; for ( ; ; ) { if ( node < kMinLinearMatch ) { return branchNext ( pos , node , inUnit ) ; } else if ( node < kMinValueLead ) { int length = node - kMinLinearMatch ; if ( inUnit == chars_ . charAt ( pos ++ ) ) { remainingMatchLeng...
Requires remainingLength_<0 .
26,401
private static long findUniqueValueFromBranch ( CharSequence chars , int pos , int length , long uniqueValue ) { while ( length > kMaxBranchLinearSubNodeLength ) { ++ pos ; uniqueValue = findUniqueValueFromBranch ( chars , jumpByDelta ( chars , pos ) , length >> 1 , uniqueValue ) ; if ( uniqueValue == 0 ) { return 0 ; ...
On return if not 0 then bits 63 .. 33 contain the updated non - negative pos .
26,402
private static long findUniqueValue ( CharSequence chars , int pos , long uniqueValue ) { int node = chars . charAt ( pos ++ ) ; for ( ; ; ) { if ( node < kMinLinearMatch ) { if ( node == 0 ) { node = chars . charAt ( pos ++ ) ; } uniqueValue = findUniqueValueFromBranch ( chars , pos , node + 1 , uniqueValue ) ; if ( u...
Otherwise uniqueValue is 0 . Bits 63 .. 33 are ignored .
26,403
public void setFixedLengthStreamingMode ( long contentLength ) { if ( connected ) { throw new IllegalStateException ( "Already connected" ) ; } if ( chunkLength != - 1 ) { throw new IllegalStateException ( "Chunked encoding streaming mode set" ) ; } if ( contentLength < 0 ) { throw new IllegalArgumentException ( "inval...
This method is used to enable streaming of a HTTP request body without internal buffering when the content length is known in advance .
26,404
private NodeImpl shallowCopy ( short operation , Node node ) { switch ( node . getNodeType ( ) ) { case Node . ATTRIBUTE_NODE : AttrImpl attr = ( AttrImpl ) node ; AttrImpl attrCopy ; if ( attr . namespaceAware ) { attrCopy = createAttributeNS ( attr . getNamespaceURI ( ) , attr . getLocalName ( ) ) ; attrCopy . setPre...
Returns a shallow copy of the given node . If the node is an element node its attributes are always copied .
26,405
Node cloneOrImportNode ( short operation , Node node , boolean deep ) { NodeImpl copy = shallowCopy ( operation , node ) ; if ( deep ) { NodeList list = node . getChildNodes ( ) ; for ( int i = 0 ; i < list . getLength ( ) ; i ++ ) { copy . appendChild ( cloneOrImportNode ( operation , list . item ( i ) , deep ) ) ; } ...
Returns a copy of the given node or subtree with this document as its owner .
26,406
public Node insertChildAt ( Node toInsert , int index ) { if ( toInsert instanceof Element && getDocumentElement ( ) != null ) { throw new DOMException ( DOMException . HIERARCHY_REQUEST_ERR , "Only one root element allowed" ) ; } if ( toInsert instanceof DocumentType && getDoctype ( ) != null ) { throw new DOMExceptio...
Document elements may have at most one root element and at most one DTD element .
26,407
Map < String , UserData > getUserDataMap ( NodeImpl node ) { if ( nodeToUserData == null ) { nodeToUserData = new WeakHashMap < NodeImpl , Map < String , UserData > > ( ) ; } Map < String , UserData > userDataMap = nodeToUserData . get ( node ) ; if ( userDataMap == null ) { userDataMap = new HashMap < String , UserDat...
Returns a map with the user data objects attached to the specified node . This map is readable and writable .
26,408
Map < String , UserData > getUserDataMapForRead ( NodeImpl node ) { if ( nodeToUserData == null ) { return Collections . emptyMap ( ) ; } Map < String , UserData > userDataMap = nodeToUserData . get ( node ) ; return userDataMap == null ? Collections . < String , UserData > emptyMap ( ) : userDataMap ; }
Returns a map with the user data objects attached to the specified node . The returned map may be read - only .
26,409
protected void eleminateRedundent ( ElemTemplateElement psuedoVarRecipient , Vector paths ) { int n = paths . size ( ) ; int numPathsEliminated = 0 ; int numUniquePathsEliminated = 0 ; for ( int i = 0 ; i < n ; i ++ ) { ExpressionOwner owner = ( ExpressionOwner ) paths . elementAt ( i ) ; if ( null != owner ) { int fou...
Method to be called after the all expressions within an node context have been visited . It eliminates redundent expressions by creating a variable in the psuedoVarRecipient for each redundent expression and then rewriting the redundent expression to be a variable reference .
26,410
protected void eleminateSharedPartialPaths ( ElemTemplateElement psuedoVarRecipient , Vector paths ) { MultistepExprHolder list = createMultistepExprList ( paths ) ; if ( null != list ) { if ( DIAGNOSE_MULTISTEPLIST ) list . diagnose ( ) ; boolean isGlobal = ( paths == m_absPaths ) ; int longestStepsCount = list . m_st...
Eliminate the shared partial paths in the expression list .
26,411
protected MultistepExprHolder matchAndEliminatePartialPaths ( MultistepExprHolder testee , MultistepExprHolder head , boolean isGlobal , int lengthToTest , ElemTemplateElement varScope ) { if ( null == testee . m_exprOwner ) return head ; WalkingIterator iter1 = ( WalkingIterator ) testee . m_exprOwner . getExpression ...
For a given path see if there are any partitial matches in the list and if there are replace those partial paths with psuedo variable refs and create the psuedo variable decl .
26,412
boolean partialIsVariable ( MultistepExprHolder testee , int lengthToTest ) { if ( 1 == lengthToTest ) { WalkingIterator wi = ( WalkingIterator ) testee . m_exprOwner . getExpression ( ) ; if ( wi . getFirstWalker ( ) instanceof FilterExprWalker ) return true ; } return false ; }
Check if results of partial reduction will just be a variable in which case skip it .
26,413
protected void diagnoseLineNumber ( Expression expr ) { ElemTemplateElement e = getElemFromExpression ( expr ) ; System . err . println ( " " + e . getSystemId ( ) + " Line " + e . getLineNumber ( ) ) ; }
Tell what line number belongs to a given expression .
26,414
protected ElemTemplateElement findCommonAncestor ( MultistepExprHolder head ) { int numExprs = head . getLength ( ) ; ElemTemplateElement [ ] elems = new ElemTemplateElement [ numExprs ] ; int [ ] ancestorCounts = new int [ numExprs ] ; MultistepExprHolder next = head ; int shortestAncestorCount = 10000 ; for ( int i =...
Given a linked list of expressions find the common ancestor that is suitable for holding a psuedo variable for shared access .
26,415
protected boolean isNotSameAsOwner ( MultistepExprHolder head , ElemTemplateElement ete ) { MultistepExprHolder next = head ; while ( null != next ) { ElemTemplateElement elemOwner = getElemFromExpression ( next . m_exprOwner . getExpression ( ) ) ; if ( elemOwner == ete ) return false ; next = next . m_next ; } return...
Find out if the given ElemTemplateElement is not the same as one of the ElemTemplateElement owners of the expressions .
26,416
protected int countAncestors ( ElemTemplateElement elem ) { int count = 0 ; while ( null != elem ) { count ++ ; elem = elem . getParentElem ( ) ; } return count ; }
Count the number of ancestors that a ElemTemplateElement has .
26,417
protected void diagnoseMultistepList ( int matchCount , int lengthToTest , boolean isGlobal ) { if ( matchCount > 0 ) { System . err . print ( "Found multistep matches: " + matchCount + ", " + lengthToTest + " length" ) ; if ( isGlobal ) System . err . println ( " (global)" ) ; else System . err . println ( ) ; } }
Print out diagnostics about partial multistep evaluation .
26,418
protected LocPathIterator changePartToRef ( final QName uniquePseudoVarName , WalkingIterator wi , final int numSteps , final boolean isGlobal ) { Variable var = new Variable ( ) ; var . setQName ( uniquePseudoVarName ) ; var . setIsGlobal ( isGlobal ) ; if ( isGlobal ) { ElemTemplateElement elem = getElemFromExpressio...
Change a given number of steps to a single variable reference .
26,419
protected WalkingIterator createIteratorFromSteps ( final WalkingIterator wi , int numSteps ) { WalkingIterator newIter = new WalkingIterator ( wi . getPrefixResolver ( ) ) ; try { AxesWalker walker = ( AxesWalker ) wi . getFirstWalker ( ) . clone ( ) ; newIter . setFirstWalker ( walker ) ; walker . setLocPathIterator ...
Create a new WalkingIterator from the steps in another WalkingIterator .
26,420
protected boolean stepsEqual ( WalkingIterator iter1 , WalkingIterator iter2 , int numSteps ) { AxesWalker aw1 = iter1 . getFirstWalker ( ) ; AxesWalker aw2 = iter2 . getFirstWalker ( ) ; for ( int i = 0 ; ( i < numSteps ) ; i ++ ) { if ( ( null == aw1 ) || ( null == aw2 ) ) return false ; if ( ! aw1 . deepEquals ( aw2...
Compare a given number of steps between two iterators to see if they are equal .
26,421
protected MultistepExprHolder createMultistepExprList ( Vector paths ) { MultistepExprHolder first = null ; int n = paths . size ( ) ; for ( int i = 0 ; i < n ; i ++ ) { ExpressionOwner eo = ( ExpressionOwner ) paths . elementAt ( i ) ; if ( null == eo ) continue ; LocPathIterator lpi = ( LocPathIterator ) eo . getExpr...
For the reduction of location path parts create a list of all the multistep paths with more than one step sorted by the number of steps with the most steps occuring earlier in the list . If the list is only one member don t bother returning it .
26,422
protected int findAndEliminateRedundant ( int start , int firstOccuranceIndex , ExpressionOwner firstOccuranceOwner , ElemTemplateElement psuedoVarRecipient , Vector paths ) throws org . w3c . dom . DOMException { MultistepExprHolder head = null ; MultistepExprHolder tail = null ; int numPathsFound = 0 ; int n = paths ...
Look through the vector from start point looking for redundant occurances . When one or more are found create a psuedo variable declaration insert it into the stylesheet and replace the occurance with a reference to the psuedo variable . When a redundent variable is found it s slot in the vector will be replaced by nul...
26,423
protected int oldFindAndEliminateRedundant ( int start , int firstOccuranceIndex , ExpressionOwner firstOccuranceOwner , ElemTemplateElement psuedoVarRecipient , Vector paths ) throws org . w3c . dom . DOMException { QName uniquePseudoVarName = null ; boolean foundFirst = false ; int numPathsFound = 0 ; int n = paths ....
To be removed .
26,424
protected int countSteps ( LocPathIterator lpi ) { if ( lpi instanceof WalkingIterator ) { WalkingIterator wi = ( WalkingIterator ) lpi ; AxesWalker aw = wi . getFirstWalker ( ) ; int count = 0 ; while ( null != aw ) { count ++ ; aw = aw . getNextWalker ( ) ; } return count ; } else return 1 ; }
Count the steps in a given location path .
26,425
protected void changeToVarRef ( QName varName , ExpressionOwner owner , Vector paths , ElemTemplateElement psuedoVarRecipient ) { Variable varRef = ( paths == m_absPaths ) ? new VariableSafeAbsRef ( ) : new Variable ( ) ; varRef . setQName ( varName ) ; if ( paths == m_absPaths ) { StylesheetRoot root = ( StylesheetRoo...
Change the expression owned by the owner argument to a variable reference of the given name .
26,426
protected ElemVariable createPseudoVarDecl ( ElemTemplateElement psuedoVarRecipient , LocPathIterator lpi , boolean isGlobal ) throws org . w3c . dom . DOMException { QName uniquePseudoVarName = new QName ( PSUEDOVARNAMESPACE , "#" + getPseudoVarID ( ) ) ; if ( isGlobal ) { return createGlobalPseudoVarDecl ( uniquePseu...
Create a psuedo variable reference that will represent the shared redundent XPath and add it to the stylesheet .
26,427
protected ElemVariable addVarDeclToElem ( ElemTemplateElement psuedoVarRecipient , LocPathIterator lpi , ElemVariable psuedoVar ) throws org . w3c . dom . DOMException { ElemTemplateElement ete = psuedoVarRecipient . getFirstChildElem ( ) ; lpi . callVisitors ( null , m_varNameCollector ) ; if ( m_varNameCollector . ge...
Add the given variable to the psuedoVarRecipient .
26,428
protected ElemTemplateElement getElemFromExpression ( Expression expr ) { ExpressionNode parent = expr . exprGetParent ( ) ; while ( null != parent ) { if ( parent instanceof ElemTemplateElement ) return ( ElemTemplateElement ) parent ; parent = parent . exprGetParent ( ) ; } throw new RuntimeException ( XSLMessages . ...
From an XPath expression component get the ElemTemplateElement owner .
26,429
public boolean isAbsolute ( LocPathIterator path ) { int analysis = path . getAnalysisBits ( ) ; boolean isAbs = ( WalkerFactory . isSet ( analysis , WalkerFactory . BIT_ROOT ) || WalkerFactory . isSet ( analysis , WalkerFactory . BIT_ANY_DESCENDANT_FROM_ROOT ) ) ; if ( isAbs ) { isAbs = m_absPathChecker . checkAbsolut...
Tell if the given LocPathIterator is relative to an absolute path i . e . in not dependent on the context .
26,430
public boolean visitLocationPath ( ExpressionOwner owner , LocPathIterator path ) { if ( path instanceof SelfIteratorNoPredicate ) { return true ; } else if ( path instanceof WalkingIterator ) { WalkingIterator wi = ( WalkingIterator ) path ; AxesWalker aw = wi . getFirstWalker ( ) ; if ( ( aw instanceof FilterExprWalk...
Visit a LocationPath .
26,431
public boolean visitTopLevelInstruction ( ElemTemplateElement elem ) { int type = elem . getXSLToken ( ) ; switch ( type ) { case Constants . ELEMNAME_TEMPLATE : return visitInstruction ( elem ) ; default : return true ; } }
Visit an XSLT top - level instruction .
26,432
public boolean visitInstruction ( ElemTemplateElement elem ) { int type = elem . getXSLToken ( ) ; switch ( type ) { case Constants . ELEMNAME_CALLTEMPLATE : case Constants . ELEMNAME_TEMPLATE : case Constants . ELEMNAME_FOREACH : { if ( type == Constants . ELEMNAME_FOREACH ) { ElemForEach efe = ( ElemForEach ) elem ; ...
Visit an XSLT instruction . Any element that isn t called by one of the other visit methods will be called by this method .
26,433
protected void diagnoseNumPaths ( Vector paths , int numPathsEliminated , int numUniquePathsEliminated ) { if ( numPathsEliminated > 0 ) { if ( paths == m_paths ) { System . err . println ( "Eliminated " + numPathsEliminated + " total paths!" ) ; System . err . println ( "Consolodated " + numUniquePathsEliminated + " r...
Print out to std err the number of paths reduced .
26,434
private final void assertIsLocPathIterator ( Expression expr1 , ExpressionOwner eo ) throws RuntimeException { if ( ! ( expr1 instanceof LocPathIterator ) ) { String errMsg ; if ( expr1 instanceof Variable ) { errMsg = "Programmer's assertion: expr1 not an iterator: " + ( ( Variable ) expr1 ) . getQName ( ) ; } else { ...
Assert that the expression is a LocPathIterator and if not try to give some diagnostic info .
26,435
private static void validateNewAddition ( Vector paths , ExpressionOwner owner , LocPathIterator path ) throws RuntimeException { assertion ( owner . getExpression ( ) == path , "owner.getExpression() != path!!!" ) ; int n = paths . size ( ) ; for ( int i = 0 ; i < n ; i ++ ) { ExpressionOwner ew = ( ExpressionOwner ) ...
Validate some assumptions about the new LocPathIterator and it s owner and the state of the list .
26,436
protected static void assertion ( boolean b , String msg ) { if ( ! b ) { throw new RuntimeException ( XSLMessages . createMessage ( XSLTErrorResources . ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR , new Object [ ] { msg } ) ) ; } }
Simple assertion .
26,437
private static void expungeStaleExceptions ( ) { for ( Object x ; ( x = exceptionTableRefQueue . poll ( ) ) != null ; ) { if ( x instanceof ExceptionNode ) { int hashCode = ( ( ExceptionNode ) x ) . hashCode ; ExceptionNode [ ] t = exceptionTable ; int i = hashCode & ( t . length - 1 ) ; ExceptionNode e = t [ i ] ; Exc...
Polls stale refs and removes them . Call only while holding lock .
26,438
public ExtensionHandler launch ( ) throws TransformerException { ExtensionHandler handler = null ; try { Class cl = ExtensionHandler . getClassForName ( m_handlerClass ) ; Constructor con = null ; if ( m_sig != null ) con = cl . getConstructor ( m_sig ) ; else { Constructor [ ] cons = cl . getConstructors ( ) ; for ( i...
Launch the ExtensionHandler that this ExtensionNamespaceSupport object defines .
26,439
private int findIndex ( Object key , Object [ ] array ) { int length = array . length ; int index = getModuloHash ( key , length ) ; int last = ( index + length - 1 ) % length ; while ( index != last ) { if ( array [ index ] == key || array [ index ] == null ) { break ; } index = ( index + 1 ) % length ; } return index...
Returns the index where the key is found at or the index of the next empty spot if the key is not found in this table .
26,440
public final void reset ( ) { while ( stackIsNotEmpty ( ) ) { pop ( ) ; } scriptStart = textStart ; scriptLimit = textStart ; scriptCode = UScript . INVALID_CODE ; parenSP = - 1 ; pushCount = 0 ; fixupCount = 0 ; textIndex = textStart ; }
Reset the iterator to the start of the text .
26,441
public final void reset ( int start , int count ) throws IllegalArgumentException { int len = 0 ; if ( text != null ) { len = text . length ; } if ( start < 0 || count < 0 || start > len - count ) { throw new IllegalArgumentException ( ) ; } textStart = start ; textLimit = start + count ; reset ( ) ; }
Reset the iterator to iterate over the given range of the text . Throws IllegalArgumentException if the range is outside of the bounds of the character array .
26,442
private static boolean sameScript ( int scriptOne , int scriptTwo ) { return scriptOne <= UScript . INHERITED || scriptTwo <= UScript . INHERITED || scriptOne == scriptTwo ; }
Compare two script codes to see if they are in the same script . If one script is a strong script and the other is INHERITED or COMMON it will compare equal .
26,443
private static int getPairIndex ( int ch ) { int probe = pairedCharPower ; int index = 0 ; if ( ch >= pairedChars [ pairedCharExtra ] ) { index = pairedCharExtra ; } while ( probe > ( 1 << 0 ) ) { probe >>= 1 ; if ( ch >= pairedChars [ index + probe ] ) { index += probe ; } } if ( pairedChars [ index ] != ch ) { index ...
Search the pairedChars array for the given character .
26,444
private void advanceRunState ( int targetState ) { for ( ; ; ) { int c = ctl . get ( ) ; if ( runStateAtLeast ( c , targetState ) || ctl . compareAndSet ( c , ctlOf ( targetState , workerCountOf ( c ) ) ) ) break ; } }
Transitions runState to given target or leaves it alone if already at least the given target .
26,445
final boolean isRunningOrShutdown ( boolean shutdownOK ) { int rs = runStateOf ( ctl . get ( ) ) ; return rs == RUNNING || ( rs == SHUTDOWN && shutdownOK ) ; }
State check needed by ScheduledThreadPoolExecutor to enable running tasks during shutdown .
26,446
private List < Runnable > drainQueue ( ) { BlockingQueue < Runnable > q = workQueue ; ArrayList < Runnable > taskList = new ArrayList < > ( ) ; q . drainTo ( taskList ) ; if ( ! q . isEmpty ( ) ) { for ( Runnable r : q . toArray ( new Runnable [ 0 ] ) ) { if ( q . remove ( r ) ) taskList . add ( r ) ; } } return taskLi...
Drains the task queue into a new list normally using drainTo . But if the queue is a DelayQueue or any other kind of queue for which poll or drainTo may fail to remove some elements it deletes them one by one .
26,447
private void addWorkerFailed ( Worker w ) { final ReentrantLock mainLock = this . mainLock ; mainLock . lock ( ) ; try { if ( w != null ) workers . remove ( w ) ; decrementWorkerCount ( ) ; tryTerminate ( ) ; } finally { mainLock . unlock ( ) ; } }
Rolls back the worker thread creation . - removes worker from workers if present - decrements worker count - rechecks for termination in case the existence of this worker was holding up termination
26,448
private void processWorkerExit ( Worker w , boolean completedAbruptly ) { if ( completedAbruptly ) decrementWorkerCount ( ) ; final ReentrantLock mainLock = this . mainLock ; mainLock . lock ( ) ; try { completedTaskCount += w . completedTasks ; workers . remove ( w ) ; } finally { mainLock . unlock ( ) ; } tryTerminat...
Performs cleanup and bookkeeping for a dying worker . Called only from worker threads . Unless completedAbruptly is set assumes that workerCount has already been adjusted to account for exit . This method removes thread from worker set and possibly terminates the pool or replaces the worker if either it exited due to u...
26,449
private boolean runTask ( boolean isFirstRun , Thread wt , Worker w ) { Runnable task = null ; if ( isFirstRun ) { task = w . firstTask ; w . firstTask = null ; } if ( task == null && ( task = getTask ( ) ) == null ) { return true ; } w . lock ( ) ; if ( ( runStateAtLeast ( ctl . get ( ) , STOP ) || ( Thread . interrup...
Runs a single scheduled and ready task .
26,450
public void execute ( Runnable command ) { if ( command == null ) throw new NullPointerException ( ) ; int c = ctl . get ( ) ; if ( workerCountOf ( c ) < corePoolSize ) { if ( addWorker ( command , true ) ) return ; c = ctl . get ( ) ; } if ( isRunning ( c ) && workQueue . offer ( command ) ) { int recheck = ctl . get ...
Executes the given task sometime in the future . The task may execute in a new thread or in an existing pooled thread .
26,451
void ensurePrestart ( ) { int wc = workerCountOf ( ctl . get ( ) ) ; if ( wc < corePoolSize ) addWorker ( null , true ) ; else if ( wc == 0 ) addWorker ( null , false ) ; }
Same as prestartCoreThread except arranges that at least one thread is started even if corePoolSize is 0 .
26,452
public void setMaximumPoolSize ( int maximumPoolSize ) { if ( maximumPoolSize <= 0 || maximumPoolSize < corePoolSize ) throw new IllegalArgumentException ( ) ; this . maximumPoolSize = maximumPoolSize ; if ( workerCountOf ( ctl . get ( ) ) > maximumPoolSize ) interruptIdleWorkers ( ) ; }
Sets the maximum allowed number of threads . This overrides any value set in the constructor . If the new value is smaller than the current value excess existing threads will be terminated when they next become idle .
26,453
public int getPoolSize ( ) { final ReentrantLock mainLock = this . mainLock ; mainLock . lock ( ) ; try { return runStateAtLeast ( ctl . get ( ) , TIDYING ) ? 0 : workers . size ( ) ; } finally { mainLock . unlock ( ) ; } }
Returns the current number of threads in the pool .
26,454
public int getActiveCount ( ) { final ReentrantLock mainLock = this . mainLock ; mainLock . lock ( ) ; try { int n = 0 ; for ( Worker w : workers ) if ( w . isLocked ( ) ) ++ n ; return n ; } finally { mainLock . unlock ( ) ; } }
Returns the approximate number of threads that are actively executing tasks .
26,455
public long getTaskCount ( ) { final ReentrantLock mainLock = this . mainLock ; mainLock . lock ( ) ; try { long n = completedTaskCount ; for ( Worker w : workers ) { n += w . completedTasks ; if ( w . isLocked ( ) ) ++ n ; } return n + workQueue . size ( ) ; } finally { mainLock . unlock ( ) ; } }
Returns the approximate total number of tasks that have ever been scheduled for execution . Because the states of tasks and threads may change dynamically during computation the returned value is only an approximation .
26,456
public long getCompletedTaskCount ( ) { final ReentrantLock mainLock = this . mainLock ; mainLock . lock ( ) ; try { long n = completedTaskCount ; for ( Worker w : workers ) n += w . completedTasks ; return n ; } finally { mainLock . unlock ( ) ; } }
Returns the approximate total number of tasks that have completed execution . Because the states of tasks and threads may change dynamically during computation the returned value is only an approximation but one that does not ever decrease across successive calls .
26,457
public static String formatCompiledPattern ( String compiledPattern , CharSequence ... values ) { return formatAndAppend ( compiledPattern , new StringBuilder ( ) , null , values ) . toString ( ) ; }
Formats the given values .
26,458
public static String getTextWithNoArguments ( String compiledPattern ) { int capacity = compiledPattern . length ( ) - 1 - getArgumentLimit ( compiledPattern ) ; StringBuilder sb = new StringBuilder ( capacity ) ; for ( int i = 1 ; i < compiledPattern . length ( ) ; ) { int segmentLength = compiledPattern . charAt ( i ...
Returns the pattern text with none of the arguments . Like formatting with all - empty string values .
26,459
public static Debug getInstance ( String option , String prefix ) { if ( isOn ( option ) ) { Debug d = new Debug ( prefix ) ; return d ; } else { return null ; } }
Get a Debug object corresponding to whether or not the given option is set . Set the prefix to be prefix .
26,460
public static boolean isOn ( String option ) { if ( args == null ) return false ; else { if ( args . indexOf ( "all" ) != - 1 ) return true ; else return ( args . indexOf ( option ) != - 1 ) ; } }
True if the system property security . debug contains the string option .
26,461
private static String marshal ( String args ) { if ( args != null ) { StringBuffer target = new StringBuffer ( ) ; StringBuffer source = new StringBuffer ( args ) ; String keyReg = "[Pp][Ee][Rr][Mm][Ii][Ss][Ss][Ii][Oo][Nn]=" ; String keyStr = "permission=" ; String reg = keyReg + "[a-zA-Z_$][a-zA-Z0-9_$]*([.][a-zA-Z_$]...
change a string into lower case except permission classes and URLs .
26,462
private static void verify ( boolean check , String zoneId , String message ) { if ( ! check ) { throw new ZoneRulesException ( String . format ( "Failed verification of zone %s: %s" , zoneId , message ) ) ; } }
Verify an assumption about the zone rules .
26,463
public static synchronized DeleteOnExit getInstance ( ) { if ( instance == null ) { instance = new DeleteOnExit ( ) ; Runtime . getRuntime ( ) . addShutdownHook ( instance ) ; } return instance ; }
Returns our singleton instance creating it if necessary .
26,464
public void addFile ( String filename ) { synchronized ( files ) { if ( ! files . contains ( filename ) ) { files . add ( filename ) ; } } }
Schedules a file for deletion .
26,465
public void removeAt ( int index ) { System . arraycopy ( mKeys , index + 1 , mKeys , index , mSize - ( index + 1 ) ) ; System . arraycopy ( mValues , index + 1 , mValues , index , mSize - ( index + 1 ) ) ; mSize -- ; }
Removes the mapping at the given index .
26,466
public void close ( ) { synchronized ( this ) { if ( ! closing ) { closing = true ; try { if ( textOut != null ) { textOut . close ( ) ; } out . close ( ) ; } catch ( IOException x ) { trouble = true ; } textOut = null ; charOut = null ; out = null ; } } }
Closes the stream . This is done by flushing the stream and then closing the underlying output stream .
26,467
public PrintStream format ( String format , Object ... args ) { try { synchronized ( this ) { ensureOpen ( ) ; if ( ( formatter == null ) || ( formatter . locale ( ) != Locale . getDefault ( ) ) ) formatter = new Formatter ( ( Appendable ) WeakProxy . forObject ( this ) ) ; formatter . format ( Locale . getDefault ( ) ...
Writes a formatted string to this output stream using the specified format string and arguments .
26,468
public PrintStream append ( CharSequence csq ) { if ( csq == null ) print ( "null" ) ; else print ( csq . toString ( ) ) ; return this ; }
Appends the specified character sequence to this output stream .
26,469
int match ( CharsetDetector det , int [ ] commonChars ) { @ SuppressWarnings ( "unused" ) int singleByteCharCount = 0 ; int doubleByteCharCount = 0 ; int commonCharCount = 0 ; int badCharCount = 0 ; int totalCharCount = 0 ; int confidence = 0 ; iteratedChar iter = new iteratedChar ( ) ; detectBlock : { for ( iter . res...
Test the match of this charset with the input text data which is obtained via the CharsetDetector object .
26,470
public static MessageNode buildMessageNode ( MessagePattern pattern ) { int limit = pattern . countParts ( ) - 1 ; if ( limit < 0 ) { throw new IllegalArgumentException ( "The MessagePattern is empty" ) ; } else if ( pattern . getPartType ( 0 ) != MessagePattern . Part . Type . MSG_START ) { throw new IllegalArgumentEx...
Factory method builds and returns a MessageNode from a MessagePattern .
26,471
public void reset ( ) { releaseDTMXRTreeFrags ( ) ; if ( m_rtfdtm_stack != null ) for ( java . util . Enumeration e = m_rtfdtm_stack . elements ( ) ; e . hasMoreElements ( ) ; ) m_dtmManager . release ( ( DTM ) e . nextElement ( ) , true ) ; m_rtfdtm_stack = null ; m_which_rtfdtm = - 1 ; if ( m_global_rtfdtm != null ) ...
Reset for new run .
26,472
public final ErrorListener getErrorListener ( ) { if ( null != m_errorListener ) return m_errorListener ; ErrorListener retval = null ; try { if ( null != m_ownerGetErrorListener ) retval = ( ErrorListener ) m_ownerGetErrorListener . invoke ( m_owner , new Object [ ] { } ) ; } catch ( Exception e ) { } if ( null == ret...
Get the ErrorListener where errors and warnings are to be reported .
26,473
public void setErrorListener ( ErrorListener listener ) throws IllegalArgumentException { if ( listener == null ) throw new IllegalArgumentException ( XSLMessages . createXPATHMessage ( XPATHErrorResources . ER_NULL_ERROR_HANDLER , null ) ) ; m_errorListener = listener ; }
Set the ErrorListener where errors and warnings are to be reported .
26,474
public final void pushExpressionState ( int cn , int en , PrefixResolver nc ) { m_currentNodes . push ( cn ) ; m_currentExpressionNodes . push ( cn ) ; m_prefixResolvers . push ( nc ) ; }
Push the current context node expression node and prefix resolver .
26,475
public void popRTFContext ( ) { int previous = m_last_pushed_rtfdtm . pop ( ) ; if ( null == m_rtfdtm_stack ) return ; if ( m_which_rtfdtm == previous ) { if ( previous >= 0 ) { boolean isEmpty = ( ( SAX2RTFDTM ) ( m_rtfdtm_stack . elementAt ( previous ) ) ) . popRewindMark ( ) ; } } else while ( m_which_rtfdtm != prev...
Pop the RTFDTM s context mark . This discards any RTFs added after the last mark was set .
26,476
public DTMXRTreeFrag getDTMXRTreeFrag ( int dtmIdentity ) { if ( m_DTMXRTreeFrags == null ) { m_DTMXRTreeFrags = new HashMap ( ) ; } if ( m_DTMXRTreeFrags . containsKey ( new Integer ( dtmIdentity ) ) ) { return ( DTMXRTreeFrag ) m_DTMXRTreeFrags . get ( new Integer ( dtmIdentity ) ) ; } else { final DTMXRTreeFrag frag...
Gets DTMXRTreeFrag object if one has already been created . Creates new DTMXRTreeFrag object and adds to m_DTMXRTreeFrags HashMap otherwise .
26,477
private final void releaseDTMXRTreeFrags ( ) { if ( m_DTMXRTreeFrags == null ) { return ; } final Iterator iter = ( m_DTMXRTreeFrags . values ( ) ) . iterator ( ) ; while ( iter . hasNext ( ) ) { DTMXRTreeFrag frag = ( DTMXRTreeFrag ) iter . next ( ) ; frag . destruct ( ) ; iter . remove ( ) ; } m_DTMXRTreeFrags = null...
Cleans DTMXRTreeFrag objects by removing references to DTM and XPathContext objects .
26,478
public void setSelect ( XPath v ) { if ( null != v ) { String s = v . getPatternString ( ) ; m_isDot = ( null != s ) && s . equals ( "." ) ; } m_selectExpression = v ; }
Set the select attribute . The required select attribute is an expression ; this expression is evaluated and the resulting object is converted to a string as if by a call to the string function .
26,479
protected void ensureSizeOfIndex ( int namespaceID , int LocalNameID ) { if ( null == m_elemIndexes ) { m_elemIndexes = new int [ namespaceID + 20 ] [ ] [ ] ; } else if ( m_elemIndexes . length <= namespaceID ) { int [ ] [ ] [ ] indexes = m_elemIndexes ; m_elemIndexes = new int [ namespaceID + 20 ] [ ] [ ] ; System . a...
Ensure that the size of the element indexes can hold the information .
26,480
protected void indexNode ( int expandedTypeID , int identity ) { ExpandedNameTable ent = m_expandedNameTable ; short type = ent . getType ( expandedTypeID ) ; if ( DTM . ELEMENT_NODE == type ) { int namespaceID = ent . getNamespaceID ( expandedTypeID ) ; int localNameID = ent . getLocalNameID ( expandedTypeID ) ; ensur...
Add a node to the element indexes . The node will not be added unless it s an element .
26,481
protected int findGTE ( int [ ] list , int start , int len , int value ) { int low = start ; int high = start + ( len - 1 ) ; int end = high ; while ( low <= high ) { int mid = ( low + high ) / 2 ; int c = list [ mid ] ; if ( c > value ) high = mid - 1 ; else if ( c < value ) low = mid + 1 ; else return mid ; } return ...
Find the first index that occurs in the list that is greater than or equal to the given value .
26,482
int findElementFromIndex ( int nsIndex , int lnIndex , int firstPotential ) { int [ ] [ ] [ ] indexes = m_elemIndexes ; if ( null != indexes && nsIndex < indexes . length ) { int [ ] [ ] lnIndexs = indexes [ nsIndex ] ; if ( null != lnIndexs && lnIndex < lnIndexs . length ) { int [ ] elems = lnIndexs [ lnIndex ] ; if (...
Find the first matching element from the index at or after the given node .
26,483
protected short _type ( int identity ) { int info = _exptype ( identity ) ; if ( NULL != info ) return m_expandedNameTable . getType ( info ) ; else return NULL ; }
Get the simple type ID for the given node identity .
26,484
protected int _exptype ( int identity ) { if ( identity == DTM . NULL ) return NULL ; while ( identity >= m_size ) { if ( ! nextNode ( ) && identity >= m_size ) return NULL ; } return m_exptype . elementAt ( identity ) ; }
Get the expanded type ID for the given node identity .
26,485
protected int _level ( int identity ) { while ( identity >= m_size ) { boolean isMore = nextNode ( ) ; if ( ! isMore && identity >= m_size ) return NULL ; } int i = 0 ; while ( NULL != ( identity = _parent ( identity ) ) ) ++ i ; return i ; }
Get the level in the tree for the given node identity .
26,486
protected int _firstch ( int identity ) { int info = ( identity >= m_size ) ? NOTPROCESSED : m_firstch . elementAt ( identity ) ; while ( info == NOTPROCESSED ) { boolean isMore = nextNode ( ) ; if ( identity >= m_size && ! isMore ) return NULL ; else { info = m_firstch . elementAt ( identity ) ; if ( info == NOTPROCES...
Get the first child for the given node identity .
26,487
protected int _nextsib ( int identity ) { int info = ( identity >= m_size ) ? NOTPROCESSED : m_nextsib . elementAt ( identity ) ; while ( info == NOTPROCESSED ) { boolean isMore = nextNode ( ) ; if ( identity >= m_size && ! isMore ) return NULL ; else { info = m_nextsib . elementAt ( identity ) ; if ( info == NOTPROCES...
Get the next sibling for the given node identity .
26,488
protected int _prevsib ( int identity ) { if ( identity < m_size ) return m_prevsib . elementAt ( identity ) ; while ( true ) { boolean isMore = nextNode ( ) ; if ( identity >= m_size && ! isMore ) return NULL ; else if ( identity < m_size ) return m_prevsib . elementAt ( identity ) ; } }
Get the previous sibling for the given node identity .
26,489
protected int _parent ( int identity ) { if ( identity < m_size ) return m_parent . elementAt ( identity ) ; while ( true ) { boolean isMore = nextNode ( ) ; if ( identity >= m_size && ! isMore ) return NULL ; else if ( identity < m_size ) return m_parent . elementAt ( identity ) ; } }
Get the parent for the given node identity .
26,490
public String dumpNode ( int nodeHandle ) { if ( nodeHandle == DTM . NULL ) return "[null]" ; String typestring ; switch ( getNodeType ( nodeHandle ) ) { case DTM . ATTRIBUTE_NODE : typestring = "ATTR" ; break ; case DTM . CDATA_SECTION_NODE : typestring = "CDATA" ; break ; case DTM . COMMENT_NODE : typestring = "COMME...
Diagnostics function to dump a single node .
26,491
protected int getFirstAttributeIdentity ( int identity ) { int type = _type ( identity ) ; if ( DTM . ELEMENT_NODE == type ) { while ( DTM . NULL != ( identity = getNextNodeIdentity ( identity ) ) ) { type = _type ( identity ) ; if ( type == DTM . ATTRIBUTE_NODE ) { return identity ; } else if ( DTM . NAMESPACE_NODE !=...
Given a node identity get the index of the node s first attribute .
26,492
protected int getTypedAttribute ( int nodeHandle , int attType ) { int type = getNodeType ( nodeHandle ) ; if ( DTM . ELEMENT_NODE == type ) { int identity = makeNodeIdentity ( nodeHandle ) ; while ( DTM . NULL != ( identity = getNextNodeIdentity ( identity ) ) ) { type = _type ( identity ) ; if ( type == DTM . ATTRIBU...
Given a node handle and an expanded type ID get the index of the node s attribute of that type if any .
26,493
public int getNextAttribute ( int nodeHandle ) { int nodeID = makeNodeIdentity ( nodeHandle ) ; if ( _type ( nodeID ) == DTM . ATTRIBUTE_NODE ) { return makeNodeHandle ( getNextAttributeIdentity ( nodeID ) ) ; } return DTM . NULL ; }
Given a node handle advance to the next attribute . If an attr we advance to the next attr on the same node . If not an attribute we return NULL .
26,494
protected int getNextAttributeIdentity ( int identity ) { while ( DTM . NULL != ( identity = getNextNodeIdentity ( identity ) ) ) { int type = _type ( identity ) ; if ( type == DTM . ATTRIBUTE_NODE ) { return identity ; } else if ( type != DTM . NAMESPACE_NODE ) { break ; } } return DTM . NULL ; }
Given a node identity for an attribute advance to the next attribute .
26,495
protected void declareNamespaceInContext ( int elementNodeIndex , int namespaceNodeIndex ) { SuballocatedIntVector nsList = null ; if ( m_namespaceDeclSets == null ) { m_namespaceDeclSetElements = new SuballocatedIntVector ( 32 ) ; m_namespaceDeclSetElements . addElement ( elementNodeIndex ) ; m_namespaceDeclSets = new...
Build table of namespace declaration locations during DTM construction . Table is a Vector of SuballocatedIntVectors containing the namespace node HANDLES declared at that ID plus an SuballocatedIntVector of the element node INDEXES at which these declarations appeared .
26,496
protected SuballocatedIntVector findNamespaceContext ( int elementNodeIndex ) { if ( null != m_namespaceDeclSetElements ) { int wouldBeAt = findInSortedSuballocatedIntVector ( m_namespaceDeclSetElements , elementNodeIndex ) ; if ( wouldBeAt >= 0 ) return ( SuballocatedIntVector ) m_namespaceDeclSets . elementAt ( would...
Retrieve list of namespace declaration locations active at this node . List is an SuballocatedIntVector whose entries are the namespace node HANDLES declared at that ID .
26,497
public int getFirstNamespaceNode ( int nodeHandle , boolean inScope ) { if ( inScope ) { int identity = makeNodeIdentity ( nodeHandle ) ; if ( _type ( identity ) == DTM . ELEMENT_NODE ) { SuballocatedIntVector nsContext = findNamespaceContext ( identity ) ; if ( nsContext == null || nsContext . size ( ) < 1 ) return NU...
Given a node handle get the index of the node s first child . If not yet resolved waits for more nodes to be added to the document and tries again
26,498
public int getNextNamespaceNode ( int baseHandle , int nodeHandle , boolean inScope ) { if ( inScope ) { SuballocatedIntVector nsContext = findNamespaceContext ( makeNodeIdentity ( baseHandle ) ) ; if ( nsContext == null ) return NULL ; int i = 1 + nsContext . indexOf ( nodeHandle ) ; if ( i <= 0 || i == nsContext . si...
Given a namespace handle advance to the next namespace .
26,499
public int getParent ( int nodeHandle ) { int identity = makeNodeIdentity ( nodeHandle ) ; if ( identity > 0 ) return makeNodeHandle ( _parent ( identity ) ) ; else return DTM . NULL ; }
Given a node handle find its parent node .