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 Expression
The contained expression.private XNodeSet
The 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_traverser
Fields inherited from class org.htmlunit.xpath.axes.PredicatedNodeTest
DEBUG_PREDICATECOUNTING, m_foundLast, m_lpi, m_predCount, m_predicateIndex, m_proximityPositions
Fields 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 TypeMethodDescriptionshort
acceptNode
(int n) Test whether a specified node is visible in the logical view of a TreeWalker or NodeIterator.void
callPredicateVisitors
(XPathVisitor visitor) This will traverse the heararchy, calling the visitor for each member.clone()
boolean
deepEquals
(Expression expr) Compare this object with another object and see if they are equal, include the sub heararchy.void
detach()
Detaches the walker from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state.static XNodeSet
executeFilterExpr
(int context, XPathContext xctxt, PrefixResolver prefixResolver, boolean isTopLevel, Expression expr) Execute the expression.int
Get the analysis bits for this path component, as defined in the WalkerFactory.int
getAxis()
Returns the axis being iterated, if it is known.int
getLastPos
(XPathContext xctxt) Get the number of nodes in the node list, which, in the XSLT 1 based counting system, is the last index position.int
Get the next node in document order on the axes.void
Initialize an AxesWalker during the parse of the XPath expression.void
setRoot
(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, wi
Methods inherited from class org.htmlunit.xpath.axes.PredicatedNodeTest
canTraverseOutsideSubtree, countProximityPosition, executePredicates, getPredicate, getPredicateCount, getProximityPosition, getProximityPosition, getProximityPosition, initPredicateInfo, initProximityPosition, isReverseAxes, nodeToString, resetProximityPositions, setLocPathIterator, setPredicateCount
Methods inherited from class org.htmlunit.xpath.patterns.NodeTest
calcScore, execute, execute, execute, getLocalName, getNamespace, getNodeTypeTest, getStaticScore, getWhatToShow, initNodeTest, initNodeTest, setLocalName, setNamespace, setStaticScore, setWhatToShow
Methods 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:
init
in 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:
detach
in classAxesWalker
-
setRoot
public void setRoot(int root) Set the root node of the TreeWalker. (Not part of the DOM2 TreeWalker interface).- Overrides:
setRoot
in 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:
clone
in 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:
acceptNode
in 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:
getNextNode
in 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:
getLastPos
in interfaceSubContextList
- Overrides:
getLastPos
in 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:
getAnalysisBits
in interfacePathComponent
- Overrides:
getAnalysisBits
in classAxesWalker
- Returns:
- One of WalkerFactory#BIT_DESCENDANT, etc.
-
getAxis
public int getAxis()Returns the axis being iterated, if it is known.- Overrides:
getAxis
in 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:
callPredicateVisitors
in 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:
deepEquals
in 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.
-