| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.xpath.Expression
org.apache.xpath.patterns.NodeTest
org.apache.xpath.patterns.StepPattern
public class StepPattern
This class represents a single pattern match step.
| Nested Class Summary | |
|---|---|
| (package private)  class | StepPattern.PredOwner | 
| Field Summary | |
|---|---|
| private static boolean | DEBUG_MATCHESSet to true to send diagnostics about pattern matches to the consol. | 
| protected  int | m_axisThe axis for this test. | 
| (package private)  Expression[] | m_predicatesThe list of predicate expressions for this pattern step. | 
| (package private)  StepPattern | m_relativePathPatternReference to nodetest and predicate for parent or ancestor. | 
| (package private)  java.lang.String | m_targetStringThe target local name or psuedo name, for hash table lookup optimization. | 
| (package private) static long | serialVersionUID | 
| Fields inherited from class org.apache.xpath.patterns.NodeTest | 
|---|
| m_name, m_namespace, m_score, m_whatToShow, SCORE_NODETEST, SCORE_NONE, SCORE_NSWILD, SCORE_OTHER, SCORE_QNAME, SHOW_BYFUNCTION, SUPPORTS_PRE_STRIPPING, WILD | 
| Constructor Summary | |
|---|---|
| StepPattern(int whatToShow,
                       int axis,
                       int axisForPredicate)Construct a StepPattern that doesn't test for node names. | |
| StepPattern(int whatToShow,
                       java.lang.String namespace,
                       java.lang.String name,
                       int axis,
                       int axisForPredicate)Construct a StepPattern that tests for namespaces and node names. | |
| Method Summary | |
|---|---|
|  void | calcScore()Static calc of match score. | 
|  void | calcTargetString()Calculate the local name or psuedo name of the node that this pattern will test, for hash table lookup optimization. | 
| protected  void | callSubtreeVisitors(XPathVisitor visitor)Call the visitors on the subtree. | 
|  void | callVisitors(ExpressionOwner owner,
                         XPathVisitor visitor)This will traverse the heararchy, calling the visitor for each member. | 
|  boolean | canTraverseOutsideSubtree()Tell if this expression or it's subexpressions can traverse outside the current subtree. | 
| private  boolean | checkProximityPosition(XPathContext xctxt,
                                             int predPos,
                                             DTM dtm,
                                             int context,
                                             int pos)New Method to check whether the current node satisfies a position predicate | 
|  boolean | deepEquals(Expression expr)Compare this object with another object and see if they are equal, include the sub heararchy. | 
|  XObject | execute(XPathContext xctxt)Execute this pattern step, including predicates. | 
|  XObject | execute(XPathContext xctxt,
               int currentNode)Execute this pattern step, including predicates. | 
|  XObject | execute(XPathContext xctxt,
               int currentNode,
               DTM dtm,
               int expType)Execute an expression in the XPath runtime context, and return the result of the expression. | 
| protected  boolean | executePredicates(XPathContext xctxt,
                                   DTM dtm,
                                   int currentNode)Execute the predicates on this step to determine if the current node should be filtered or accepted. | 
| protected  XObject | executeRelativePathPattern(XPathContext xctxt,
                                                     DTM dtm,
                                                     int currentNode)Execute the match pattern step relative to another step. | 
|  void | fixupVariables(java.util.Vector vars,
                             int globalsSize)This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time. | 
|  int | getAxis()Get the axis that this step follows. | 
|  Expression | getExpression()Get the raw Expression object that this class wraps. | 
|  int | getLastPos(XPathContext xctxt)Get the count of the nodes that match the test, which is the proximity position of the last node that can pass this test in the sub context selection. | 
|  double | getMatchScore(XPathContext xctxt,
                           int context)Get the match score of the given node. | 
|  Expression | getPredicate(int i)Get a predicate expression. | 
|  int | getPredicateCount()Get the number of predicates for this match pattern step. | 
|  Expression[] | getPredicates()Set the list of predicate expressions for this pattern step. | 
|  int | getProximityPosition(XPathContext xctxt)Get the proximity position index of the current node based on this node test. | 
| private  int | getProximityPosition(XPathContext xctxt,
                                         int predPos,
                                         boolean findLast)Get the proximity position index of the current node based on this node test. | 
|  StepPattern | getRelativePathPattern()Get the reference to nodetest and predicate for parent or ancestor. | 
|  java.lang.String | getTargetString()Get the local name or psuedo name of the node that this pattern will test, for hash table lookup optimization. | 
|  void | setAxis(int axis)Set the axis that this step should follow. | 
|  void | setExpression(Expression exp)Set the raw expression object for this object. | 
|  void | setPredicates(Expression[] predicates)Set the predicates for this match pattern step. | 
|  void | setRelativePathPattern(StepPattern expr)Set the reference to nodetest and predicate for parent or ancestor. | 
|  java.lang.String | toString()Get the string represenentation of this step for diagnostic purposes. | 
| Methods inherited from class org.apache.xpath.patterns.NodeTest | 
|---|
| debugWhatToShow, getDefaultScore, getLocalName, getNamespace, getNodeTypeTest, getStaticScore, getWhatToShow, initNodeTest, initNodeTest, setLocalName, setNamespace, setStaticScore, setWhatToShow | 
| Methods inherited from class org.apache.xpath.Expression | 
|---|
| asIterator, asIteratorRaw, asNode, assertion, bool, error, execute, executeCharsToContentHandler, exprAddChild, exprGetChild, exprGetNumChildren, exprGetParent, exprSetParent, getColumnNumber, getExpressionOwner, getLineNumber, getPublicId, getSystemId, isNodesetExpr, isSameClass, isStableNumber, num, warn, xstr | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
static final long serialVersionUID
protected int m_axis
java.lang.String m_targetString
StepPattern m_relativePathPattern
Expression[] m_predicates
private static final boolean DEBUG_MATCHES
| Constructor Detail | 
|---|
public StepPattern(int whatToShow,
                   java.lang.String namespace,
                   java.lang.String name,
                   int axis,
                   int axisForPredicate)
whatToShow - Bit set defined mainly by NodeFilter.namespace - The namespace to be tested.name - The local name to be tested.axis - The Axis for this test, one of of Axes.ANCESTORORSELF, etc.axisForPredicate - No longer used.
public StepPattern(int whatToShow,
                   int axis,
                   int axisForPredicate)
whatToShow - Bit set defined mainly by NodeFilter.axis - The Axis for this test, one of of Axes.ANCESTORORSELF, etc.axisForPredicate - No longer used.| Method Detail | 
|---|
public void calcTargetString()
PsuedoNamespublic java.lang.String getTargetString()
PsuedoNames
public void fixupVariables(java.util.Vector vars,
                           int globalsSize)
fixupVariables in class NodeTestvars - List of QNames that correspond to variables.  This list
 should be searched backwards for the first qualified name that
 corresponds to the variable reference qname.  The position of the
 QName in the vector from the start of the vector will be its position
 in the stack frame (but variables above the globalsTop value will need
 to be offset to the current stack frame).globalsSize - The number of variables in the global variable area.public void setRelativePathPattern(StepPattern expr)
expr - The relative pattern expression.public StepPattern getRelativePathPattern()
public Expression[] getPredicates()
public boolean canTraverseOutsideSubtree()
canTraverseOutsideSubtree in class Expressionpublic Expression getPredicate(int i)
i - The index of the predicate.
public final int getPredicateCount()
public void setPredicates(Expression[] predicates)
predicates - An array of expressions that define predicates
                   for this step.public void calcScore()
calcScore in class NodeTest
public XObject execute(XPathContext xctxt,
                       int currentNode)
                throws javax.xml.transform.TransformerException
execute in class NodeTestxctxt - XPath runtime context.currentNode - The current node context.
NodeTest.SCORE_NODETEST,
         NodeTest.SCORE_NONE,
         NodeTest.SCORE_NSWILD,
         NodeTest.SCORE_QNAME, or
         NodeTest.SCORE_OTHER.
javax.xml.transform.TransformerException
public XObject execute(XPathContext xctxt)
                throws javax.xml.transform.TransformerException
execute in class NodeTestxctxt - XPath runtime context.
NodeTest.SCORE_NODETEST,
         NodeTest.SCORE_NONE,
         NodeTest.SCORE_NSWILD,
         NodeTest.SCORE_QNAME, or
         NodeTest.SCORE_OTHER.
javax.xml.transform.TransformerException
public XObject execute(XPathContext xctxt,
                       int currentNode,
                       DTM dtm,
                       int expType)
                throws javax.xml.transform.TransformerException
execute in class NodeTestxctxt - The XPath runtime context.currentNode - The currentNode.dtm - The DTM of the current node.expType - The expanded type ID of the current node.
XObject.
javax.xml.transform.TransformerException - if a runtime exception
         occurs.
private final boolean checkProximityPosition(XPathContext xctxt,
                                             int predPos,
                                             DTM dtm,
                                             int context,
                                             int pos)
xctxt - The XPath runtime context.predPos - Which predicate we're evaluating of foo[1][2][3].dtm - The DTM of the current node.context - The currentNode.pos - The position being requested, i.e. the value returned by 
            m_predicates[predPos].execute(xctxt).
private final int getProximityPosition(XPathContext xctxt,
                                       int predPos,
                                       boolean findLast)
xctxt - XPath runtime context.predPos - Which predicate we're evaluating of foo[1][2][3].findLast - If true, don't terminate when the context node is found.
public int getProximityPosition(XPathContext xctxt)
getProximityPosition in interface SubContextListxctxt - XPath runtime context.
public int getLastPos(XPathContext xctxt)
getLastPos in interface SubContextListxctxt - XPath runtime context.
protected final XObject executeRelativePathPattern(XPathContext xctxt,
                                                   DTM dtm,
                                                   int currentNode)
                                            throws javax.xml.transform.TransformerException
xctxt - The XPath runtime context.dtm - The DTM of the current node.currentNode - The current node context.
NodeTest.SCORE_NODETEST,
         NodeTest.SCORE_NONE,
         NodeTest.SCORE_NSWILD,
         NodeTest.SCORE_QNAME, or
         NodeTest.SCORE_OTHER.
javax.xml.transform.TransformerException
protected final boolean executePredicates(XPathContext xctxt,
                                          DTM dtm,
                                          int currentNode)
                                   throws javax.xml.transform.TransformerException
xctxt - The XPath runtime context.dtm - The DTM of the current node.currentNode - The current node context.
javax.xml.transform.TransformerExceptionpublic java.lang.String toString()
toString in class java.lang.Object
public double getMatchScore(XPathContext xctxt,
                            int context)
                     throws javax.xml.transform.TransformerException
xctxt - The XPath runtime context.context - The node to be tested.
NodeTest.SCORE_NODETEST,
         NodeTest.SCORE_NONE,
         NodeTest.SCORE_NSWILD,
         NodeTest.SCORE_QNAME, or
         NodeTest.SCORE_OTHER.
javax.xml.transform.TransformerExceptionpublic void setAxis(int axis)
axis - The Axis for this test, one of of Axes.ANCESTORORSELF, etc.public int getAxis()
public void callVisitors(ExpressionOwner owner,
                         XPathVisitor visitor)
XPathVisitable
callVisitors in interface XPathVisitablecallVisitors in class NodeTestowner - The owner of the visitor, where that path may be 
              rewritten if needed.visitor - The visitor whose appropriate method will be called.XPathVisitable.callVisitors(ExpressionOwner, XPathVisitor)protected void callSubtreeVisitors(XPathVisitor visitor)
public Expression getExpression()
ExpressionOwner
getExpression in interface ExpressionOwnerExpressionOwner.getExpression()public void setExpression(Expression exp)
ExpressionOwner
setExpression in interface ExpressionOwnerexp - the raw Expression object, which should not normally be null.ExpressionOwner.setExpression(Expression)public boolean deepEquals(Expression expr)
Expression
deepEquals in class NodeTestexpr - Another expression object.
Expression.deepEquals(Expression)| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||