Package org.htmlunit.xpath.axes
Class FilterExprWalker
java.lang.Object
org.htmlunit.xpath.Expression
org.htmlunit.xpath.patterns.NodeTest
org.htmlunit.xpath.axes.PredicatedNodeTest
org.htmlunit.xpath.axes.AxesWalker
org.htmlunit.xpath.axes.FilterExprWalker
- All Implemented Interfaces:
Cloneable,SourceLocator,PathComponent,SubContextList,ExpressionNode,XPathVisitable
Walker for the OP_VARIABLE, or OP_FUNCTION, or OP_GROUP, op codes.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ExpressionThe contained expression.private XNodeSetThe result of executing m_expr.Fields inherited from class org.htmlunit.xpath.axes.AxesWalker
m_axis, m_isFresh, m_nextWalker, m_prevWalker, m_root, m_traverserFields inherited from class org.htmlunit.xpath.axes.PredicatedNodeTest
DEBUG_PREDICATECOUNTING, m_foundLast, m_lpi, m_predCount, m_predicateIndex, m_proximityPositionsFields inherited from class org.htmlunit.xpath.patterns.NodeTest
m_name, m_whatToShow, SCORE_NODETEST, SCORE_NONE, SCORE_NSWILD, SCORE_OTHER, SCORE_QNAME, SHOW_BYFUNCTION, WILD -
Constructor Summary
ConstructorsConstructorDescriptionFilterExprWalker(WalkingIterator locPathIterator) Construct a FilterExprWalker using a LocPathIterator. -
Method Summary
Modifier and TypeMethodDescriptionshortacceptNode(int n) Test whether a specified node is visible in the logical view of a TreeWalker or NodeIterator.voidcallPredicateVisitors(XPathVisitor visitor) This will traverse the heararchy, calling the visitor for each member.clone()booleandeepEquals(Expression expr) Compare this object with another object and see if they are equal, include the sub heararchy.voiddetach()Detaches the walker from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state.static XNodeSetexecuteFilterExpr(int context, XPathContext xctxt, PrefixResolver prefixResolver, boolean isTopLevel, Expression expr) Execute the expression.intGet the analysis bits for this path component, as defined in the WalkerFactory.intgetAxis()Returns the axis being iterated, if it is known.intgetLastPos(XPathContext xctxt) Get the number of nodes in the node list, which, in the XSLT 1 based counting system, is the last index position.intGet the next node in document order on the axes.voidInitialize an AxesWalker during the parse of the XPath expression.voidsetRoot(int root) Set the root node of the TreeWalker.Methods inherited from class org.htmlunit.xpath.axes.AxesWalker
callVisitors, cloneDeep, findClone, getDTM, getNextWalker, getRoot, nextNode, setNextWalker, setPrevWalker, wiMethods inherited from class org.htmlunit.xpath.axes.PredicatedNodeTest
canTraverseOutsideSubtree, countProximityPosition, executePredicates, getPredicate, getPredicateCount, getProximityPosition, getProximityPosition, getProximityPosition, initPredicateInfo, initProximityPosition, isReverseAxes, nodeToString, resetProximityPositions, setLocPathIterator, setPredicateCountMethods inherited from class org.htmlunit.xpath.patterns.NodeTest
calcScore, execute, execute, execute, getLocalName, getNamespace, getNodeTypeTest, getStaticScore, getWhatToShow, initNodeTest, initNodeTest, setLocalName, setNamespace, setStaticScore, setWhatToShowMethods inherited from class org.htmlunit.xpath.Expression
asIterator, asNode, assertion, bool, error, execute, exprGetParent, exprSetParent, getColumnNumber, getExpressionOwner, getLineNumber, getPublicId, getSystemId, isSameClass, isStableNumber, num
-
Field Details
-
m_expr
The contained expression. Should be non-null. -
m_exprObj
The result of executing m_expr. Needs to be deep cloned on clone op.
-
-
Constructor Details
-
FilterExprWalker
Construct a FilterExprWalker using a LocPathIterator.- Parameters:
locPathIterator- non-null reference to the parent iterator.
-
-
Method Details
-
init
Initialize an AxesWalker during the parse of the XPath expression.- Overrides:
initin classAxesWalker- Parameters:
compiler- The Compiler object that has information about this walker in the op map.opPos- The op code position of this location step.stepType- The type of location step.- Throws:
TransformerException- if any
-
detach
public void detach()Detaches the walker from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state.- Overrides:
detachin classAxesWalker
-
setRoot
public void setRoot(int root) Set the root node of the TreeWalker. (Not part of the DOM2 TreeWalker interface).- Overrides:
setRootin classAxesWalker- Parameters:
root- The context node of this step.
-
executeFilterExpr
public static XNodeSet executeFilterExpr(int context, XPathContext xctxt, PrefixResolver prefixResolver, boolean isTopLevel, Expression expr) throws WrappedRuntimeException Execute the expression. Meant for reuse by other FilterExpr iterators that are not derived from this object.- Throws:
WrappedRuntimeException
-
clone
- Overrides:
clonein classAxesWalker- Throws:
CloneNotSupportedException
-
acceptNode
public short acceptNode(int n) Test whether a specified node is visible in the logical view of a TreeWalker or NodeIterator. This function will be called by the implementation of TreeWalker and NodeIterator; it is not intended to be called directly from user code.- Overrides:
acceptNodein classPredicatedNodeTest- Parameters:
n- The node to check to see if it passes the filter or not.- Returns:
- a constant to determine whether the node is accepted, rejected, or skipped, as defined above .
-
getNextNode
public int getNextNode()Get the next node in document order on the axes.- Overrides:
getNextNodein classAxesWalker- Returns:
- the next node in document order on the axes, or null.
-
getLastPos
Get the number of nodes in the node list, which, in the XSLT 1 based counting system, is the last index position.- Specified by:
getLastPosin interfaceSubContextList- Overrides:
getLastPosin classAxesWalker- Parameters:
xctxt- The XPath runtime context.- Returns:
- the number of nodes in the node list.
-
getAnalysisBits
public int getAnalysisBits()Get the analysis bits for this path component, as defined in the WalkerFactory.- Specified by:
getAnalysisBitsin interfacePathComponent- Overrides:
getAnalysisBitsin classAxesWalker- Returns:
- One of WalkerFactory#BIT_DESCENDANT, etc.
-
getAxis
public int getAxis()Returns the axis being iterated, if it is known.- Overrides:
getAxisin classAxesWalker- Returns:
- Axis.CHILD, etc., or -1 if the axis is not known or is of multiple types.
-
callPredicateVisitors
This will traverse the heararchy, calling the visitor for each member. If the called visitor method returns false, the subtree should not be called.- Overrides:
callPredicateVisitorsin classPredicatedNodeTest- Parameters:
visitor- The visitor whose appropriate method will be called.
-
deepEquals
Compare this object with another object and see if they are equal, include the sub heararchy.- Overrides:
deepEqualsin classAxesWalker- Parameters:
expr- Another expression object.- Returns:
- true if this objects class and the expr object's class are the same, and the data contained within both objects are considered equal.
-