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 ++ ) ) { remainingMatchLength_ = -- length ; pos_ = pos ; return ( length < 0 && ( node = chars_ . charAt ( pos ) ) >= kMinValueLead ) ? valueResults_ [ node >> 15 ] : Result . NO_VALUE ; } else { break ; } } else if ( ( node & kValueIsFinal ) != 0 ) { break ; } else { pos = skipNodeValue ( pos , node ) ; node &= kNodeTypeMask ; } } stop ( ) ; return Result . NO_MATCH ; } | 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 ; } length = length - ( length >> 1 ) ; pos = skipDelta ( chars , pos ) ; } do { ++ pos ; int node = chars . charAt ( pos ++ ) ; boolean isFinal = ( node & kValueIsFinal ) != 0 ; node &= 0x7fff ; int value = readValue ( chars , pos , node ) ; pos = skipValue ( pos , node ) ; if ( isFinal ) { if ( uniqueValue != 0 ) { if ( value != ( int ) ( uniqueValue >> 1 ) ) { return 0 ; } } else { uniqueValue = ( ( long ) value << 1 ) | 1 ; } } else { uniqueValue = findUniqueValue ( chars , pos + value , uniqueValue ) ; if ( uniqueValue == 0 ) { return 0 ; } } } while ( -- length > 1 ) ; return ( ( long ) ( pos + 1 ) << 33 ) | ( uniqueValue & 0x1ffffffffL ) ; } | 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 ( uniqueValue == 0 ) { return 0 ; } pos = ( int ) ( uniqueValue >>> 33 ) ; node = chars . charAt ( pos ++ ) ; } else if ( node < kMinValueLead ) { pos += node - kMinLinearMatch + 1 ; node = chars . charAt ( pos ++ ) ; } else { boolean isFinal = ( node & kValueIsFinal ) != 0 ; int value ; if ( isFinal ) { value = readValue ( chars , pos , node & 0x7fff ) ; } else { value = readNodeValue ( chars , pos , node ) ; } if ( uniqueValue != 0 ) { if ( value != ( int ) ( uniqueValue >> 1 ) ) { return 0 ; } } else { uniqueValue = ( ( long ) value << 1 ) | 1 ; } if ( isFinal ) { return uniqueValue ; } pos = skipNodeValue ( pos , node ) ; node &= kNodeTypeMask ; } } } | 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 ( "invalid content length" ) ; } fixedContentLengthLong = contentLength ; } | 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 . setPrefix ( attr . getPrefix ( ) ) ; } else { attrCopy = createAttribute ( attr . getName ( ) ) ; } attrCopy . setNodeValue ( attr . getValue ( ) ) ; return attrCopy ; case Node . CDATA_SECTION_NODE : return createCDATASection ( ( ( CharacterData ) node ) . getData ( ) ) ; case Node . COMMENT_NODE : return createComment ( ( ( Comment ) node ) . getData ( ) ) ; case Node . DOCUMENT_FRAGMENT_NODE : return createDocumentFragment ( ) ; case Node . DOCUMENT_NODE : case Node . DOCUMENT_TYPE_NODE : throw new DOMException ( DOMException . NOT_SUPPORTED_ERR , "Cannot copy node of type " + node . getNodeType ( ) ) ; case Node . ELEMENT_NODE : ElementImpl element = ( ElementImpl ) node ; ElementImpl elementCopy ; if ( element . namespaceAware ) { elementCopy = createElementNS ( element . getNamespaceURI ( ) , element . getLocalName ( ) ) ; elementCopy . setPrefix ( element . getPrefix ( ) ) ; } else { elementCopy = createElement ( element . getTagName ( ) ) ; } NamedNodeMap attributes = element . getAttributes ( ) ; for ( int i = 0 ; i < attributes . getLength ( ) ; i ++ ) { AttrImpl elementAttr = ( AttrImpl ) attributes . item ( i ) ; AttrImpl elementAttrCopy = ( AttrImpl ) shallowCopy ( operation , elementAttr ) ; notifyUserDataHandlers ( operation , elementAttr , elementAttrCopy ) ; if ( elementAttr . namespaceAware ) { elementCopy . setAttributeNodeNS ( elementAttrCopy ) ; } else { elementCopy . setAttributeNode ( elementAttrCopy ) ; } } return elementCopy ; case Node . ENTITY_NODE : case Node . NOTATION_NODE : throw new UnsupportedOperationException ( ) ; case Node . ENTITY_REFERENCE_NODE : return createEntityReference ( node . getNodeName ( ) ) ; case Node . PROCESSING_INSTRUCTION_NODE : ProcessingInstruction pi = ( ProcessingInstruction ) node ; return createProcessingInstruction ( pi . getTarget ( ) , pi . getData ( ) ) ; case Node . TEXT_NODE : return createTextNode ( ( ( Text ) node ) . getData ( ) ) ; default : throw new DOMException ( DOMException . NOT_SUPPORTED_ERR , "Unsupported node type " + node . getNodeType ( ) ) ; } } | 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 ) ) ; } } notifyUserDataHandlers ( operation , node , copy ) ; return copy ; } | 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 DOMException ( DOMException . HIERARCHY_REQUEST_ERR , "Only one DOCTYPE element allowed" ) ; } return super . insertChildAt ( toInsert , index ) ; } | 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 , UserData > ( ) ; nodeToUserData . put ( node , userDataMap ) ; } return userDataMap ; } | 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 found = findAndEliminateRedundant ( i + 1 , i , owner , psuedoVarRecipient , paths ) ; if ( found > 0 ) numUniquePathsEliminated ++ ; numPathsEliminated += found ; } } eleminateSharedPartialPaths ( psuedoVarRecipient , paths ) ; if ( DIAGNOSE_NUM_PATHS_REDUCED ) diagnoseNumPaths ( paths , numPathsEliminated , numUniquePathsEliminated ) ; } | 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_stepCount ; for ( int i = longestStepsCount - 1 ; i >= 1 ; i -- ) { MultistepExprHolder next = list ; while ( null != next ) { if ( next . m_stepCount < i ) break ; list = matchAndEliminatePartialPaths ( next , list , isGlobal , i , psuedoVarRecipient ) ; next = next . m_next ; } } } } | 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 ( ) ; if ( partialIsVariable ( testee , lengthToTest ) ) return head ; MultistepExprHolder matchedPaths = null ; MultistepExprHolder matchedPathsTail = null ; MultistepExprHolder meh = head ; while ( null != meh ) { if ( ( meh != testee ) && ( null != meh . m_exprOwner ) ) { WalkingIterator iter2 = ( WalkingIterator ) meh . m_exprOwner . getExpression ( ) ; if ( stepsEqual ( iter1 , iter2 , lengthToTest ) ) { if ( null == matchedPaths ) { try { matchedPaths = ( MultistepExprHolder ) testee . clone ( ) ; testee . m_exprOwner = null ; } catch ( CloneNotSupportedException cnse ) { } matchedPathsTail = matchedPaths ; matchedPathsTail . m_next = null ; } try { matchedPathsTail . m_next = ( MultistepExprHolder ) meh . clone ( ) ; meh . m_exprOwner = null ; } catch ( CloneNotSupportedException cnse ) { } matchedPathsTail = matchedPathsTail . m_next ; matchedPathsTail . m_next = null ; } } meh = meh . m_next ; } int matchCount = 0 ; if ( null != matchedPaths ) { ElemTemplateElement root = isGlobal ? varScope : findCommonAncestor ( matchedPaths ) ; WalkingIterator sharedIter = ( WalkingIterator ) matchedPaths . m_exprOwner . getExpression ( ) ; WalkingIterator newIter = createIteratorFromSteps ( sharedIter , lengthToTest ) ; ElemVariable var = createPseudoVarDecl ( root , newIter , isGlobal ) ; if ( DIAGNOSE_MULTISTEPLIST ) System . err . println ( "Created var: " + var . getName ( ) + ( isGlobal ? "(Global)" : "" ) ) ; while ( null != matchedPaths ) { ExpressionOwner owner = matchedPaths . m_exprOwner ; WalkingIterator iter = ( WalkingIterator ) owner . getExpression ( ) ; if ( DIAGNOSE_MULTISTEPLIST ) diagnoseLineNumber ( iter ) ; LocPathIterator newIter2 = changePartToRef ( var . getName ( ) , iter , lengthToTest , isGlobal ) ; owner . setExpression ( newIter2 ) ; matchedPaths = matchedPaths . m_next ; } } if ( DIAGNOSE_MULTISTEPLIST ) diagnoseMultistepList ( matchCount , lengthToTest , isGlobal ) ; return head ; } | 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 = 0 ; i < numExprs ; i ++ ) { ElemTemplateElement elem = getElemFromExpression ( next . m_exprOwner . getExpression ( ) ) ; elems [ i ] = elem ; int numAncestors = countAncestors ( elem ) ; ancestorCounts [ i ] = numAncestors ; if ( numAncestors < shortestAncestorCount ) { shortestAncestorCount = numAncestors ; } next = next . m_next ; } for ( int i = 0 ; i < numExprs ; i ++ ) { if ( ancestorCounts [ i ] > shortestAncestorCount ) { int numStepCorrection = ancestorCounts [ i ] - shortestAncestorCount ; for ( int j = 0 ; j < numStepCorrection ; j ++ ) { elems [ i ] = elems [ i ] . getParentElem ( ) ; } } } ElemTemplateElement first = null ; while ( shortestAncestorCount -- >= 0 ) { boolean areEqual = true ; first = elems [ 0 ] ; for ( int i = 1 ; i < numExprs ; i ++ ) { if ( first != elems [ i ] ) { areEqual = false ; break ; } } if ( areEqual && isNotSameAsOwner ( head , first ) && first . canAcceptVariables ( ) ) { if ( DIAGNOSE_MULTISTEPLIST ) { System . err . print ( first . getClass ( ) . getName ( ) ) ; System . err . println ( " at " + first . getSystemId ( ) + " Line " + first . getLineNumber ( ) ) ; } return first ; } for ( int i = 0 ; i < numExprs ; i ++ ) { elems [ i ] = elems [ i ] . getParentElem ( ) ; } } assertion ( false , "Could not find common ancestor!!!" ) ; return null ; } | 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 true ; } | 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 = getElemFromExpression ( wi ) ; StylesheetRoot root = elem . getStylesheetRoot ( ) ; Vector vars = root . getVariablesAndParamsComposed ( ) ; var . setIndex ( vars . size ( ) - 1 ) ; } AxesWalker walker = wi . getFirstWalker ( ) ; for ( int i = 0 ; i < numSteps ; i ++ ) { assertion ( null != walker , "Walker should not be null!" ) ; walker = walker . getNextWalker ( ) ; } if ( null != walker ) { FilterExprWalker few = new FilterExprWalker ( wi ) ; few . setInnerExpression ( var ) ; few . exprSetParent ( wi ) ; few . setNextWalker ( walker ) ; walker . setPrevWalker ( few ) ; wi . setFirstWalker ( few ) ; return wi ; } else { FilterExprIteratorSimple feis = new FilterExprIteratorSimple ( var ) ; feis . exprSetParent ( wi . exprGetParent ( ) ) ; return feis ; } } | 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 ( newIter ) ; for ( int i = 1 ; i < numSteps ; i ++ ) { AxesWalker next = ( AxesWalker ) walker . getNextWalker ( ) . clone ( ) ; walker . setNextWalker ( next ) ; next . setLocPathIterator ( newIter ) ; walker = next ; } walker . setNextWalker ( null ) ; } catch ( CloneNotSupportedException cnse ) { throw new WrappedRuntimeException ( cnse ) ; } return newIter ; } | 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 ) ) return false ; aw1 = aw1 . getNextWalker ( ) ; aw2 = aw2 . getNextWalker ( ) ; } assertion ( ( null != aw1 ) || ( null != aw2 ) , "Total match is incorrect!" ) ; return true ; } | 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 . getExpression ( ) ; int numPaths = countSteps ( lpi ) ; if ( numPaths > 1 ) { if ( null == first ) first = new MultistepExprHolder ( eo , numPaths , null ) ; else first = first . addInSortedOrder ( eo , numPaths ) ; } } if ( ( null == first ) || ( first . getLength ( ) <= 1 ) ) return null ; else return first ; } | 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 . size ( ) ; Expression expr1 = firstOccuranceOwner . getExpression ( ) ; if ( DEBUG ) assertIsLocPathIterator ( expr1 , firstOccuranceOwner ) ; boolean isGlobal = ( paths == m_absPaths ) ; LocPathIterator lpi = ( LocPathIterator ) expr1 ; int stepCount = countSteps ( lpi ) ; for ( int j = start ; j < n ; j ++ ) { ExpressionOwner owner2 = ( ExpressionOwner ) paths . elementAt ( j ) ; if ( null != owner2 ) { Expression expr2 = owner2 . getExpression ( ) ; boolean isEqual = expr2 . deepEquals ( lpi ) ; if ( isEqual ) { LocPathIterator lpi2 = ( LocPathIterator ) expr2 ; if ( null == head ) { head = new MultistepExprHolder ( firstOccuranceOwner , stepCount , null ) ; tail = head ; numPathsFound ++ ; } tail . m_next = new MultistepExprHolder ( owner2 , stepCount , null ) ; tail = tail . m_next ; paths . setElementAt ( null , j ) ; numPathsFound ++ ; } } } if ( ( 0 == numPathsFound ) && isGlobal ) { head = new MultistepExprHolder ( firstOccuranceOwner , stepCount , null ) ; numPathsFound ++ ; } if ( null != head ) { ElemTemplateElement root = isGlobal ? psuedoVarRecipient : findCommonAncestor ( head ) ; LocPathIterator sharedIter = ( LocPathIterator ) head . m_exprOwner . getExpression ( ) ; ElemVariable var = createPseudoVarDecl ( root , sharedIter , isGlobal ) ; if ( DIAGNOSE_MULTISTEPLIST ) System . err . println ( "Created var: " + var . getName ( ) + ( isGlobal ? "(Global)" : "" ) ) ; QName uniquePseudoVarName = var . getName ( ) ; while ( null != head ) { ExpressionOwner owner = head . m_exprOwner ; if ( DIAGNOSE_MULTISTEPLIST ) diagnoseLineNumber ( owner . getExpression ( ) ) ; changeToVarRef ( uniquePseudoVarName , owner , paths , root ) ; head = head . m_next ; } paths . setElementAt ( var . getSelect ( ) , firstOccuranceIndex ) ; } return numPathsFound ; } | 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 null . |
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 . size ( ) ; Expression expr1 = firstOccuranceOwner . getExpression ( ) ; if ( DEBUG ) assertIsLocPathIterator ( expr1 , firstOccuranceOwner ) ; boolean isGlobal = ( paths == m_absPaths ) ; LocPathIterator lpi = ( LocPathIterator ) expr1 ; for ( int j = start ; j < n ; j ++ ) { ExpressionOwner owner2 = ( ExpressionOwner ) paths . elementAt ( j ) ; if ( null != owner2 ) { Expression expr2 = owner2 . getExpression ( ) ; boolean isEqual = expr2 . deepEquals ( lpi ) ; if ( isEqual ) { LocPathIterator lpi2 = ( LocPathIterator ) expr2 ; if ( ! foundFirst ) { foundFirst = true ; ElemVariable var = createPseudoVarDecl ( psuedoVarRecipient , lpi , isGlobal ) ; if ( null == var ) return 0 ; uniquePseudoVarName = var . getName ( ) ; changeToVarRef ( uniquePseudoVarName , firstOccuranceOwner , paths , psuedoVarRecipient ) ; paths . setElementAt ( var . getSelect ( ) , firstOccuranceIndex ) ; numPathsFound ++ ; } changeToVarRef ( uniquePseudoVarName , owner2 , paths , psuedoVarRecipient ) ; paths . setElementAt ( null , j ) ; numPathsFound ++ ; } } } if ( ( 0 == numPathsFound ) && ( paths == m_absPaths ) ) { ElemVariable var = createPseudoVarDecl ( psuedoVarRecipient , lpi , true ) ; if ( null == var ) return 0 ; uniquePseudoVarName = var . getName ( ) ; changeToVarRef ( uniquePseudoVarName , firstOccuranceOwner , paths , psuedoVarRecipient ) ; paths . setElementAt ( var . getSelect ( ) , firstOccuranceIndex ) ; numPathsFound ++ ; } return numPathsFound ; } | 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 = ( StylesheetRoot ) psuedoVarRecipient ; Vector globalVars = root . getVariablesAndParamsComposed ( ) ; varRef . setIndex ( globalVars . size ( ) - 1 ) ; varRef . setIsGlobal ( true ) ; } owner . setExpression ( varRef ) ; } | 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 ( uniquePseudoVarName , ( StylesheetRoot ) psuedoVarRecipient , lpi ) ; } else return createLocalPseudoVarDecl ( uniquePseudoVarName , psuedoVarRecipient , lpi ) ; } | 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 . getVarCount ( ) > 0 ) { ElemTemplateElement baseElem = getElemFromExpression ( lpi ) ; ElemVariable varElem = getPrevVariableElem ( baseElem ) ; while ( null != varElem ) { if ( m_varNameCollector . doesOccur ( varElem . getName ( ) ) ) { psuedoVarRecipient = varElem . getParentElem ( ) ; ete = varElem . getNextSiblingElem ( ) ; break ; } varElem = getPrevVariableElem ( varElem ) ; } } if ( ( null != ete ) && ( Constants . ELEMNAME_PARAMVARIABLE == ete . getXSLToken ( ) ) ) { if ( isParam ( lpi ) ) return null ; while ( null != ete ) { ete = ete . getNextSiblingElem ( ) ; if ( ( null != ete ) && Constants . ELEMNAME_PARAMVARIABLE != ete . getXSLToken ( ) ) break ; } } psuedoVarRecipient . insertBefore ( psuedoVar , ete ) ; m_varNameCollector . reset ( ) ; return psuedoVar ; } | 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 . createMessage ( XSLTErrorResources . ER_ASSERT_NO_TEMPLATE_PARENT , null ) ) ; } | 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 . checkAbsolute ( path ) ; } return isAbs ; } | 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 FilterExprWalker ) && ( null == aw . getNextWalker ( ) ) ) { FilterExprWalker few = ( FilterExprWalker ) aw ; Expression exp = few . getInnerExpression ( ) ; if ( exp instanceof Variable ) return true ; } } if ( isAbsolute ( path ) && ( null != m_absPaths ) ) { if ( DEBUG ) validateNewAddition ( m_absPaths , owner , path ) ; m_absPaths . addElement ( owner ) ; } else if ( m_isSameContext && ( null != m_paths ) ) { if ( DEBUG ) validateNewAddition ( m_paths , owner , path ) ; m_paths . addElement ( owner ) ; } return true ; } | 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 ; Expression select = efe . getSelect ( ) ; select . callVisitors ( efe , this ) ; } Vector savedPaths = m_paths ; m_paths = new Vector ( ) ; elem . callChildVisitors ( this , false ) ; eleminateRedundentLocals ( elem ) ; m_paths = savedPaths ; return false ; } case Constants . ELEMNAME_NUMBER : case Constants . ELEMNAME_SORT : boolean savedIsSame = m_isSameContext ; m_isSameContext = false ; elem . callChildVisitors ( this ) ; m_isSameContext = savedIsSame ; return false ; default : return true ; } } | 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 + " redundent paths!" ) ; } else { System . err . println ( "Eliminated " + numPathsEliminated + " total global paths!" ) ; System . err . println ( "Consolodated " + numUniquePathsEliminated + " redundent global paths!" ) ; } } } | 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 { errMsg = "Programmer's assertion: expr1 not an iterator: " + expr1 . getClass ( ) . getName ( ) ; } throw new RuntimeException ( errMsg + ", " + eo . getClass ( ) . getName ( ) + " " + expr1 . exprGetParent ( ) ) ; } } | 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 ) paths . elementAt ( i ) ; assertion ( ew != owner , "duplicate owner on the list!!!" ) ; assertion ( ew . getExpression ( ) != path , "duplicate expression on the list!!!" ) ; } } | 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 ] ; ExceptionNode pred = null ; while ( e != null ) { ExceptionNode next = e . next ; if ( e == x ) { if ( pred == null ) t [ i ] = next ; else pred . next = next ; break ; } pred = e ; e = next ; } } } } | 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 ( int i = 0 ; i < cons . length ; i ++ ) { if ( cons [ i ] . getParameterTypes ( ) . length == m_args . length ) { con = cons [ i ] ; break ; } } } if ( con != null ) handler = ( ExtensionHandler ) con . newInstance ( m_args ) ; else throw new TransformerException ( "ExtensionHandler constructor not found" ) ; } catch ( Exception e ) { throw new TransformerException ( e ) ; } return handler ; } | 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 = - 1 ; } return 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 taskList ; } | 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 ( ) ; } tryTerminate ( ) ; int c = ctl . get ( ) ; if ( runStateLessThan ( c , STOP ) ) { if ( ! completedAbruptly ) { int min = allowCoreThreadTimeOut ? 0 : corePoolSize ; if ( min == 0 && ! workQueue . isEmpty ( ) ) min = 1 ; if ( workerCountOf ( c ) >= min ) return ; } addWorker ( null , false ) ; } } | 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 user task exception or if fewer than corePoolSize workers are running or queue is non - empty but there are no workers . |
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 . interrupted ( ) && runStateAtLeast ( ctl . get ( ) , STOP ) ) ) && ! wt . isInterrupted ( ) ) wt . interrupt ( ) ; try { beforeExecute ( wt , task ) ; Throwable thrown = null ; try { task . run ( ) ; } catch ( RuntimeException x ) { thrown = x ; throw x ; } catch ( Error x ) { thrown = x ; throw x ; } catch ( Throwable x ) { thrown = x ; throw new Error ( x ) ; } finally { afterExecute ( task , thrown ) ; } } finally { task = null ; w . completedTasks ++ ; w . unlock ( ) ; } return false ; } | 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 ( ) ; if ( ! isRunning ( recheck ) && remove ( command ) ) reject ( command ) ; else if ( workerCountOf ( recheck ) == 0 ) addWorker ( null , false ) ; } else if ( ! addWorker ( command , false ) ) reject ( command ) ; } | 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 ++ ) - ARG_NUM_LIMIT ; if ( segmentLength > 0 ) { int limit = i + segmentLength ; sb . append ( compiledPattern , i , limit ) ; i = limit ; } } return sb . toString ( ) ; } | 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_$][a-zA-Z0-9_$]*)*" ; Pattern pattern = Pattern . compile ( reg ) ; Matcher matcher = pattern . matcher ( source ) ; StringBuffer left = new StringBuffer ( ) ; while ( matcher . find ( ) ) { String matched = matcher . group ( ) ; target . append ( matched . replaceFirst ( keyReg , keyStr ) ) ; target . append ( " " ) ; matcher . appendReplacement ( left , "" ) ; } matcher . appendTail ( left ) ; source = left ; keyReg = "[Cc][Oo][Dd][Ee][Bb][Aa][Ss][Ee]=" ; keyStr = "codebase=" ; reg = keyReg + "[^, ;]*" ; pattern = Pattern . compile ( reg ) ; matcher = pattern . matcher ( source ) ; left = new StringBuffer ( ) ; while ( matcher . find ( ) ) { String matched = matcher . group ( ) ; target . append ( matched . replaceFirst ( keyReg , keyStr ) ) ; target . append ( " " ) ; matcher . appendReplacement ( left , "" ) ; } matcher . appendTail ( left ) ; source = left ; target . append ( source . toString ( ) . toLowerCase ( Locale . ENGLISH ) ) ; return target . toString ( ) ; } return null ; } | 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 ( ) , format , args ) ; } } catch ( InterruptedIOException x ) { Thread . currentThread ( ) . interrupt ( ) ; } catch ( IOException x ) { trouble = true ; } return this ; } | 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 . reset ( ) ; nextChar ( iter , det ) ; ) { totalCharCount ++ ; if ( iter . error ) { badCharCount ++ ; } else { long cv = iter . charValue & 0xFFFFFFFFL ; if ( cv <= 0xff ) { singleByteCharCount ++ ; } else { doubleByteCharCount ++ ; if ( commonChars != null ) { if ( Arrays . binarySearch ( commonChars , ( int ) cv ) >= 0 ) { commonCharCount ++ ; } } } } if ( badCharCount >= 2 && badCharCount * 5 >= doubleByteCharCount ) { break detectBlock ; } } if ( doubleByteCharCount <= 10 && badCharCount == 0 ) { if ( doubleByteCharCount == 0 && totalCharCount < 10 ) { confidence = 0 ; } else { confidence = 10 ; } break detectBlock ; } if ( doubleByteCharCount < 20 * badCharCount ) { confidence = 0 ; break detectBlock ; } if ( commonChars == null ) { confidence = 30 + doubleByteCharCount - 20 * badCharCount ; if ( confidence > 100 ) { confidence = 100 ; } } else { double maxVal = Math . log ( ( float ) doubleByteCharCount / 4 ) ; double scaleFactor = 90.0 / maxVal ; confidence = ( int ) ( Math . log ( commonCharCount + 1 ) * scaleFactor + 10 ) ; confidence = Math . min ( confidence , 100 ) ; } } return confidence ; } | 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 IllegalArgumentException ( "The MessagePattern does not represent a MessageFormat pattern" ) ; } return buildMessageNode ( pattern , 0 , limit ) ; } | 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 ) m_dtmManager . release ( m_global_rtfdtm , true ) ; m_global_rtfdtm = null ; m_dtmManager = DTMManager . newInstance ( org . apache . xpath . objects . XMLStringFactoryImpl . getFactory ( ) ) ; m_saxLocations . removeAllElements ( ) ; m_axesIteratorStack . removeAllElements ( ) ; m_contextNodeLists . removeAllElements ( ) ; m_currentExpressionNodes . removeAllElements ( ) ; m_currentNodes . removeAllElements ( ) ; m_iteratorRoots . RemoveAllNoClear ( ) ; m_predicatePos . removeAllElements ( ) ; m_predicateRoots . RemoveAllNoClear ( ) ; m_prefixResolvers . removeAllElements ( ) ; m_prefixResolvers . push ( null ) ; m_currentNodes . push ( DTM . NULL ) ; m_currentExpressionNodes . push ( DTM . NULL ) ; m_saxLocations . push ( 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 == retval ) { if ( null == m_defaultErrorListener ) m_defaultErrorListener = new org . apache . xml . utils . DefaultErrorHandler ( ) ; retval = m_defaultErrorListener ; } return retval ; } | 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 != previous ) { boolean isEmpty = ( ( SAX2RTFDTM ) ( m_rtfdtm_stack . elementAt ( m_which_rtfdtm ) ) ) . popRewindMark ( ) ; -- m_which_rtfdtm ; } } | 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 = new DTMXRTreeFrag ( dtmIdentity , this ) ; m_DTMXRTreeFrags . put ( new Integer ( dtmIdentity ) , frag ) ; return 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 . arraycopy ( indexes , 0 , m_elemIndexes , 0 , indexes . length ) ; } int [ ] [ ] localNameIndex = m_elemIndexes [ namespaceID ] ; if ( null == localNameIndex ) { localNameIndex = new int [ LocalNameID + 100 ] [ ] ; m_elemIndexes [ namespaceID ] = localNameIndex ; } else if ( localNameIndex . length <= LocalNameID ) { int [ ] [ ] indexes = localNameIndex ; localNameIndex = new int [ LocalNameID + 100 ] [ ] ; System . arraycopy ( indexes , 0 , localNameIndex , 0 , indexes . length ) ; m_elemIndexes [ namespaceID ] = localNameIndex ; } int [ ] elemHandles = localNameIndex [ LocalNameID ] ; if ( null == elemHandles ) { elemHandles = new int [ 128 ] ; localNameIndex [ LocalNameID ] = elemHandles ; elemHandles [ 0 ] = 1 ; } else if ( elemHandles . length <= elemHandles [ 0 ] + 1 ) { int [ ] indexes = elemHandles ; elemHandles = new int [ elemHandles [ 0 ] + 1024 ] ; System . arraycopy ( indexes , 0 , elemHandles , 0 , indexes . length ) ; localNameIndex [ LocalNameID ] = elemHandles ; } } | 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 ) ; ensureSizeOfIndex ( namespaceID , localNameID ) ; int [ ] index = m_elemIndexes [ namespaceID ] [ localNameID ] ; index [ index [ 0 ] ] = identity ; index [ 0 ] ++ ; } } | 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 ( low <= end && list [ low ] > value ) ? low : - 1 ; } | 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 ( null != elems ) { int pos = findGTE ( elems , 1 , elems [ 0 ] , firstPotential ) ; if ( pos > - 1 ) { return elems [ pos ] ; } } } } return NOTPROCESSED ; } | 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 == NOTPROCESSED && ! isMore ) return NULL ; } } return info ; } | 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 == NOTPROCESSED && ! isMore ) return NULL ; } } return info ; } | 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 = "COMMENT" ; break ; case DTM . DOCUMENT_FRAGMENT_NODE : typestring = "DOC_FRAG" ; break ; case DTM . DOCUMENT_NODE : typestring = "DOC" ; break ; case DTM . DOCUMENT_TYPE_NODE : typestring = "DOC_TYPE" ; break ; case DTM . ELEMENT_NODE : typestring = "ELEMENT" ; break ; case DTM . ENTITY_NODE : typestring = "ENTITY" ; break ; case DTM . ENTITY_REFERENCE_NODE : typestring = "ENT_REF" ; break ; case DTM . NAMESPACE_NODE : typestring = "NAMESPACE" ; break ; case DTM . NOTATION_NODE : typestring = "NOTATION" ; break ; case DTM . NULL : typestring = "null" ; break ; case DTM . PROCESSING_INSTRUCTION_NODE : typestring = "PI" ; break ; case DTM . TEXT_NODE : typestring = "TEXT" ; break ; default : typestring = "Unknown!" ; break ; } StringBuffer sb = new StringBuffer ( ) ; sb . append ( "[" + nodeHandle + ": " + typestring + "(0x" + Integer . toHexString ( getExpandedTypeID ( nodeHandle ) ) + ") " + getNodeNameX ( nodeHandle ) + " {" + getNamespaceURI ( nodeHandle ) + "}" + "=\"" + getNodeValue ( nodeHandle ) + "\"]" ) ; return sb . toString ( ) ; } | 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 != type ) { break ; } } } return DTM . NULL ; } | 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 . ATTRIBUTE_NODE ) { if ( _exptype ( identity ) == attType ) return makeNodeHandle ( identity ) ; } else if ( DTM . NAMESPACE_NODE != type ) { break ; } } } return DTM . NULL ; } | 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 Vector ( ) ; nsList = new SuballocatedIntVector ( 32 ) ; m_namespaceDeclSets . addElement ( nsList ) ; } else { int last = m_namespaceDeclSetElements . size ( ) - 1 ; if ( last >= 0 && elementNodeIndex == m_namespaceDeclSetElements . elementAt ( last ) ) { nsList = ( SuballocatedIntVector ) m_namespaceDeclSets . elementAt ( last ) ; } } if ( nsList == null ) { m_namespaceDeclSetElements . addElement ( elementNodeIndex ) ; SuballocatedIntVector inherited = findNamespaceContext ( _parent ( elementNodeIndex ) ) ; if ( inherited != null ) { int isize = inherited . size ( ) ; nsList = new SuballocatedIntVector ( Math . max ( Math . min ( isize + 16 , 2048 ) , 32 ) ) ; for ( int i = 0 ; i < isize ; ++ i ) { nsList . addElement ( inherited . elementAt ( i ) ) ; } } else { nsList = new SuballocatedIntVector ( 32 ) ; } m_namespaceDeclSets . addElement ( nsList ) ; } int newEType = _exptype ( namespaceNodeIndex ) ; for ( int i = nsList . size ( ) - 1 ; i >= 0 ; -- i ) { if ( newEType == getExpandedTypeID ( nsList . elementAt ( i ) ) ) { nsList . setElementAt ( makeNodeHandle ( namespaceNodeIndex ) , i ) ; return ; } } nsList . addElement ( makeNodeHandle ( namespaceNodeIndex ) ) ; } | 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 ( wouldBeAt ) ; if ( wouldBeAt == - 1 ) return null ; wouldBeAt = - 1 - wouldBeAt ; int candidate = m_namespaceDeclSetElements . elementAt ( -- wouldBeAt ) ; int ancestor = _parent ( elementNodeIndex ) ; if ( wouldBeAt == 0 && candidate < ancestor ) { int rootHandle = getDocumentRoot ( makeNodeHandle ( elementNodeIndex ) ) ; int rootID = makeNodeIdentity ( rootHandle ) ; int uppermostNSCandidateID ; if ( getNodeType ( rootHandle ) == DTM . DOCUMENT_NODE ) { int ch = _firstch ( rootID ) ; uppermostNSCandidateID = ( ch != DTM . NULL ) ? ch : rootID ; } else { uppermostNSCandidateID = rootID ; } if ( candidate == uppermostNSCandidateID ) { return ( SuballocatedIntVector ) m_namespaceDeclSets . elementAt ( wouldBeAt ) ; } } while ( wouldBeAt >= 0 && ancestor > 0 ) { if ( candidate == ancestor ) { return ( SuballocatedIntVector ) m_namespaceDeclSets . elementAt ( wouldBeAt ) ; } else if ( candidate < ancestor ) { do { ancestor = _parent ( ancestor ) ; } while ( candidate < ancestor ) ; } else if ( wouldBeAt > 0 ) { candidate = m_namespaceDeclSetElements . elementAt ( -- wouldBeAt ) ; } else break ; } } return null ; } | 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 NULL ; return nsContext . elementAt ( 0 ) ; } else return NULL ; } else { int identity = makeNodeIdentity ( nodeHandle ) ; if ( _type ( identity ) == DTM . ELEMENT_NODE ) { while ( DTM . NULL != ( identity = getNextNodeIdentity ( identity ) ) ) { int type = _type ( identity ) ; if ( type == DTM . NAMESPACE_NODE ) return makeNodeHandle ( identity ) ; else if ( DTM . ATTRIBUTE_NODE != type ) break ; } return NULL ; } else return NULL ; } } | 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 . size ( ) ) return NULL ; return nsContext . elementAt ( i ) ; } else { int identity = makeNodeIdentity ( nodeHandle ) ; while ( DTM . NULL != ( identity = getNextNodeIdentity ( identity ) ) ) { int type = _type ( identity ) ; if ( type == DTM . NAMESPACE_NODE ) { return makeNodeHandle ( identity ) ; } else if ( type != DTM . ATTRIBUTE_NODE ) { break ; } } } return DTM . NULL ; } | 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 . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.