sboag 00/12/17 11:31:26
Modified: java/src/org/apache/xpath/patterns AncestorStepPattern.java
FunctionPattern.java NodeTest.java
NodeTestFilter.java StepPattern.java
UnionPattern.java
Log:
Java docs.
Revision Changes Path
1.8 +21 -13
xml-xalan/java/src/org/apache/xpath/patterns/AncestorStepPattern.java
Index: AncestorStepPattern.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/AncestorStepPattern.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- AncestorStepPattern.java 2000/11/23 04:59:23 1.7
+++ AncestorStepPattern.java 2000/12/17 19:31:25 1.8
@@ -66,19 +66,19 @@
import org.w3c.dom.traversal.NodeIterator;
/**
- * <meta name="usage" content="internal"/>
- * NEEDSDOC Class AncestorStepPattern <needs-comment/>
+ * <meta name="usage" content="advanced"/>
+ * Implements a match pattern step that tests an ancestor.
*/
public class AncestorStepPattern extends StepPattern
{
/**
- * Constructor AncestorStepPattern
+ * Construct an AncestorStepPattern that tests for namespaces and node
names.
*
*
- * NEEDSDOC @param whatToShow
- * NEEDSDOC @param namespace
- * NEEDSDOC @param name
+ * @param whatToShow Bit set defined mainly by [EMAIL PROTECTED]
org.w3c.dom.NodeFilter}.
+ * @param namespace The namespace to be tested.
+ * @param name The local name to be tested.
*/
public AncestorStepPattern(int whatToShow, String namespace, String name)
{
@@ -86,10 +86,10 @@
}
/**
- * Constructor AncestorStepPattern
+ * Construct an AncestorStepPattern that doesn't test for node names.
*
*
- * NEEDSDOC @param whatToShow
+ * @param whatToShow Bit set defined mainly by [EMAIL PROTECTED]
org.w3c.dom.NodeFilter}.
*/
public AncestorStepPattern(int whatToShow)
{
@@ -112,9 +112,13 @@
* Overide the super method so that we can handle
* match patterns starting with a function such as id()/
*
- * NEEDSDOC @param xctxt
+ * @param xctxt XPath runtime context.
*
- * NEEDSDOC ($objectName$) @return
+ * @return [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NODETEST},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NONE},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NSWILD},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_QNAME}, or
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_OTHER}.
*
* @throws javax.xml.transform.TransformerException
*/
@@ -139,12 +143,16 @@
}
/**
- * NEEDSDOC Method executeRelativePathPattern
+ * Execute the match pattern step relative to another step.
*
*
- * NEEDSDOC @param xctxt
+ * @param xctxt The XPath runtime context.
*
- * NEEDSDOC (executeRelativePathPattern) @return
+ * @return [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NODETEST},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NONE},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NSWILD},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_QNAME}, or
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_OTHER}.
*
* @throws javax.xml.transform.TransformerException
*/
1.6 +12 -14
xml-xalan/java/src/org/apache/xpath/patterns/FunctionPattern.java
Index: FunctionPattern.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/FunctionPattern.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FunctionPattern.java 2000/11/16 20:04:51 1.5
+++ FunctionPattern.java 2000/12/17 19:31:25 1.6
@@ -67,17 +67,18 @@
import org.w3c.dom.traversal.NodeIterator;
/**
- * <meta name="usage" content="internal"/>
- * NEEDSDOC Class FunctionPattern <needs-comment/>
+ * <meta name="usage" content="advanced"/>
+ * Match pattern step that contains a function.
*/
public class FunctionPattern extends StepPattern
{
/**
- * Constructor FunctionPattern
+ * Construct a FunctionPattern from a
+ * [EMAIL PROTECTED] org.apache.xpath.functions.Function expression}.
*
*
- * NEEDSDOC @param expr
+ * @param a should be a [EMAIL PROTECTED]
org.apache.xpath.functions.Function expression}.
*/
public FunctionPattern(Expression expr)
{
@@ -99,22 +100,19 @@
calcTargetString();
}
- /** NEEDSDOC Field m_functionExpr */
+ /** Should be a [EMAIL PROTECTED] org.apache.xpath.functions.Function
expression}. */
Expression m_functionExpr;
/**
* Test a node to see if it matches the given node test.
- * @param xpath The xpath that is executing.
- * @param context The current source tree context node.
- * @param opPos The current position in the xpath.m_opMap array.
- * @param len The length of the argument.
- * @param len The type of the step.
- * @returns score in an XNumber, one of MATCH_SCORE_NODETEST,
- * MATCH_SCORE_NONE, MATCH_SCORE_OTHER, MATCH_SCORE_QNAME.
*
- * NEEDSDOC @param xctxt
+ * @param xctxt XPath runtime context.
*
- * NEEDSDOC ($objectName$) @return
+ * @return [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NODETEST},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NONE},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NSWILD},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_QNAME}, or
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_OTHER}.
*
* @throws javax.xml.transform.TransformerException
*/
1.14 +132 -89
xml-xalan/java/src/org/apache/xpath/patterns/NodeTest.java
Index: NodeTest.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/NodeTest.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- NodeTest.java 2000/11/16 20:04:51 1.13
+++ NodeTest.java 2000/12/17 19:31:25 1.14
@@ -70,13 +70,15 @@
import org.w3c.dom.traversal.NodeFilter;
/**
- * <meta name="usage" content="internal"/>
- * NEEDSDOC Class NodeTest <needs-comment/>
+ * <meta name="usage" content="advanced"/>
+ * This is the basic node test class for both match patterns and location
path
+ * steps.
*/
public class NodeTest extends Expression
{
- /** NEEDSDOC Field WILD */
+ /** The namespace or local name for node tests with a wildcard.
+ * @see <a href="http://www.w3.org/TR/xpath#NT-NameTest">the XPath
NameTest production.</a> */
public static final String WILD = "*";
/**
@@ -84,80 +86,104 @@
*/
protected int m_whatToShow;
- /** NEEDSDOC Field SHOW_NAMESPACE */
+ /** This bit specifies a namespace, and extends the SHOW_XXX stuff
+ * in [EMAIL PROTECTED] org.w3c.dom.NodeFilter}. */
public static final int SHOW_NAMESPACE = 0x00001000;
/**
* Special bitmap for match patterns starting with a function.
- * Make sure this does not conflict with dom.traversal.NodeFilter
+ * Make sure this does not conflict with [EMAIL PROTECTED]
org.w3c.dom.NodeFilter}.
*/
public static final int SHOW_BYFUNCTION = 0x00010000;
/**
* This attribute determines which node types are accepted.
- * These constants are defined in the <code>NodeFilter</code>
+ * These constants are defined in the [EMAIL PROTECTED]
org.w3c.dom.NodeFilter}
* interface.
*
- * NEEDSDOC ($objectName$) @return
+ * @return bitset mainly defined in [EMAIL PROTECTED]
org.w3c.dom.NodeFilter}.
*/
public int getWhatToShow()
{
return m_whatToShow;
}
- /** NEEDSDOC Field m_namespace */
+ /** The namespace to be tested for, which may be null. */
String m_namespace;
/**
* Return the namespace to be tested.
*
- * NEEDSDOC ($objectName$) @return
+ * @return The namespace to be tested for, or [EMAIL PROTECTED] #WILD}, or
null.
*/
public String getNamespace()
{
return m_namespace;
}
- /** NEEDSDOC Field m_name */
+ /** The local name to be tested for. */
String m_name;
/**
* Return the local namespace to be tested.
*
- * NEEDSDOC ($objectName$) @return
+ * @return the local namespace to be tested, or [EMAIL PROTECTED] #WILD},
or null.
*/
public String getLocalName()
{
return m_name;
}
- /** NEEDSDOC Field m_score */
+ /** Statically calculated score for this test. One of
+ * [EMAIL PROTECTED] #SCORE_NODETEST},
+ * [EMAIL PROTECTED] #SCORE_NONE},
+ * [EMAIL PROTECTED] #SCORE_NSWILD},
+ * [EMAIL PROTECTED] #SCORE_QNAME}, or
+ * [EMAIL PROTECTED] #SCORE_OTHER}.
+ */
XNumber m_score;
- /** NEEDSDOC Field SCORE_NODETEST */
+ /**
+ * The match score if the pattern consists of just a NodeTest.
+ * @see XSLT Specification -
+ * <a href="http://www.w3.org/TR/xslt#conflict">5.5 Conflict Resolution
for Template Rules</a> */
static final XNumber SCORE_NODETEST =
- new
XNumber(XPath.MATCH_SCORE_NODETEST);
+ new XNumber(XPath.MATCH_SCORE_NODETEST);
- /** NEEDSDOC Field SCORE_NSWILD */
+ /**
+ * The match score if the pattern pattern has the form NCName:*.
+ * @see XSLT Specification -
+ * <a href="http://www.w3.org/TR/xslt#conflict">5.5 Conflict Resolution
for Template Rules</a> */
static final XNumber SCORE_NSWILD = new XNumber(XPath.MATCH_SCORE_NSWILD);
- /** NEEDSDOC Field SCORE_QNAME */
+ /**
+ * The match score if the pattern has the form
+ * of a QName optionally preceded by an @ character.
+ * @see XSLT Specification -
+ * <a href="http://www.w3.org/TR/xslt#conflict">5.5 Conflict Resolution
for Template Rules</a> */
static final XNumber SCORE_QNAME = new XNumber(XPath.MATCH_SCORE_QNAME);
- /** NEEDSDOC Field SCORE_OTHER */
+ /**
+ * The match score if the pattern consists of something
+ * other than just a NodeTest or just a qname.
+ * @see XSLT Specification -
+ * <a href="http://www.w3.org/TR/xslt#conflict">5.5 Conflict Resolution
for Template Rules</a> */
static final XNumber SCORE_OTHER = new XNumber(XPath.MATCH_SCORE_OTHER);
- /** NEEDSDOC Field SCORE_NONE */
+ /**
+ * The match score if no match is made.
+ * @see XSLT Specification -
+ * <a href="http://www.w3.org/TR/xslt#conflict">5.5 Conflict Resolution
for Template Rules</a> */
public static final XNumber SCORE_NONE =
- new
XNumber(XPath.MATCH_SCORE_NONE);
+ new XNumber(XPath.MATCH_SCORE_NONE);
/**
- * Constructor NodeTest
+ * Construct an NodeTest that tests for namespaces and node names.
*
*
- * NEEDSDOC @param whatToShow
- * NEEDSDOC @param namespace
- * NEEDSDOC @param name
+ * @param whatToShow Bit set defined mainly by [EMAIL PROTECTED]
org.w3c.dom.NodeFilter}.
+ * @param namespace The namespace to be tested.
+ * @param name The local name to be tested.
*/
public NodeTest(int whatToShow, String namespace, String name)
{
@@ -165,10 +191,10 @@
}
/**
- * Constructor NodeTest
+ * Construct an NodeTest that doesn't test for node names.
*
*
- * NEEDSDOC @param whatToShow
+ * @param whatToShow Bit set defined mainly by [EMAIL PROTECTED]
org.w3c.dom.NodeFilter}.
*/
public NodeTest(int whatToShow)
{
@@ -176,16 +202,16 @@
}
/**
- * Constructor NodeTest
- *
+ * Null argument constructor.
*/
public NodeTest(){}
/**
- * NEEDSDOC Method initNodeTest
+ * Initialize this node test by setting the whatToShow property, and
+ * calculating the score that this test will return if a test succeeds.
*
*
- * NEEDSDOC @param whatToShow
+ * @param whatToShow Bit set defined mainly by [EMAIL PROTECTED]
org.w3c.dom.NodeFilter}.
*/
public void initNodeTest(int whatToShow)
{
@@ -196,12 +222,14 @@
}
/**
- * NEEDSDOC Method initNodeTest
+ * Initialize this node test by setting the whatToShow property and the
+ * namespace and local name, and
+ * calculating the score that this test will return if a test succeeds.
*
*
- * NEEDSDOC @param whatToShow
- * NEEDSDOC @param namespace
- * NEEDSDOC @param name
+ * @param whatToShow Bit set defined mainly by [EMAIL PROTECTED]
org.w3c.dom.NodeFilter}.
+ * @param namespace The namespace to be tested.
+ * @param name The local name to be tested.
*/
public void initNodeTest(int whatToShow, String namespace, String name)
{
@@ -213,7 +241,7 @@
calcScore();
}
- /** NEEDSDOC Field m_isTotallyWild */
+ /** True if this test has a null namespace and a local name of [EMAIL
PROTECTED] #WILD}. */
private boolean m_isTotallyWild;
/**
@@ -236,10 +264,10 @@
}
/**
- * NEEDSDOC Method getDefaultScore
+ * Get the score that this test will return if a test succeeds.
*
*
- * NEEDSDOC (getDefaultScore) @return
+ * @return the score that this test will return if a test succeeds.
*/
public double getDefaultScore()
{
@@ -247,10 +275,10 @@
}
/**
- * NEEDSDOC Method debugWhatToShow
+ * Do a diagnostics dump of a whatToShow bit set.
*
*
- * NEEDSDOC @param whatToShow
+ * @param whatToShow Bit set defined mainly by [EMAIL PROTECTED]
org.w3c.dom.NodeFilter}.
*/
public static void debugWhatToShow(int whatToShow)
{
@@ -314,10 +342,10 @@
* the name t is wild and the name p is non-null, or the two
* strings are equal.
*
- * NEEDSDOC @param p
- * NEEDSDOC @param t
+ * @param p part string from the node.
+ * @param t target string, which may be [EMAIL PROTECTED] #WILD}.
*
- * NEEDSDOC ($objectName$) @return
+ * @return true if the strings match according to the rules of this method.
*/
private static final boolean subPartMatch(String p, String t)
{
@@ -326,10 +354,26 @@
// System.out.println("subPartMatch - p: "+p+", t: "+t+", result: "+b);
return (p == t) || ((null != p) && ((t == WILD) || p.equals(t)));
}
-
+
+ /**
+ * Tell what the test score is for the given node.
+ *
+ *
+ * @param xctxt XPath runtime context.
+ * @param context The node being tested.
+ *
+ * @return [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NODETEST},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NONE},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NSWILD},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_QNAME}, or
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_OTHER}.
+ *
+ * @throws javax.xml.transform.TransformerException
+ */
public XObject execute(XPathContext xctxt, Node context)
- throws javax.xml.transform.TransformerException
+ throws javax.xml.transform.TransformerException
{
+
short nodeType = context.getNodeType();
int nodeBit = (m_whatToShow & (0x00000001 << (nodeType - 1)));
@@ -348,79 +392,78 @@
return subPartMatch(context.getNodeName(), m_name)
? m_score : SCORE_NONE;
- // From the draft: "Two expanded names are equal if they
- // have the same local part, and either both have no URI or
- // both have the same URI."
- // "A node test * is true for any node of the principal node type.
- // For example, child::* will select all element children of the
- // context node, and attribute::* will select all attributes of
- // the context node."
- // "A node test can have the form NCName:*. In this case, the prefix
- // is expanded in the same way as with a QName using the context
- // namespace declarations. The node test will be true for any node
- // of the principal type whose expanded name has the URI to which
- // the prefix expands, regardless of the local part of the name."
+ // From the draft: "Two expanded names are equal if they
+ // have the same local part, and either both have no URI or
+ // both have the same URI."
+ // "A node test * is true for any node of the principal node type.
+ // For example, child::* will select all element children of the
+ // context node, and attribute::* will select all attributes of
+ // the context node."
+ // "A node test can have the form NCName:*. In this case, the prefix
+ // is expanded in the same way as with a QName using the context
+ // namespace declarations. The node test will be true for any node
+ // of the principal type whose expanded name has the URI to which
+ // the prefix expands, regardless of the local part of the name."
case NodeFilter.SHOW_ATTRIBUTE :
+ {
+ int isNamespace = (m_whatToShow & SHOW_NAMESPACE);
+
+ if (0 == isNamespace)
{
- int isNamespace = (m_whatToShow & SHOW_NAMESPACE);
+ DOMHelper dh = xctxt.getDOMHelper();
- if (0 == isNamespace)
+ if (!dh.isNamespaceNode(context))
+ return (m_isTotallyWild ||
(subPartMatch(dh.getNamespaceOfNode(context), m_namespace) &&
subPartMatch(dh.getLocalNameOfNode(context), m_name)))
+ ? m_score : SCORE_NONE;
+ else
+ return SCORE_NONE;
+ }
+ else
+ {
+ if (xctxt.getDOMHelper().isNamespaceNode(context))
{
- DOMHelper dh = xctxt.getDOMHelper();
+ String ns = context.getNodeValue();
- if (!dh.isNamespaceNode(context))
- return (m_isTotallyWild ||
(subPartMatch(dh.getNamespaceOfNode(context), m_namespace) &&
subPartMatch(dh.getLocalNameOfNode(context), m_name)))
- ? m_score : SCORE_NONE;
- else
- return SCORE_NONE;
+ return (subPartMatch(ns, m_name)) ? m_score : SCORE_NONE;
}
else
- {
- if (xctxt.getDOMHelper().isNamespaceNode(context))
- {
- String ns = context.getNodeValue();
-
- return (subPartMatch(ns, m_name)) ? m_score : SCORE_NONE;
- }
- else
- return SCORE_NONE;
- }
+ return SCORE_NONE;
}
+ }
case NodeFilter.SHOW_ELEMENT :
- {
- DOMHelper dh = xctxt.getDOMHelper();
+ {
+ DOMHelper dh = xctxt.getDOMHelper();
- return (m_isTotallyWild ||
(subPartMatch(dh.getNamespaceOfNode(context), m_namespace) &&
subPartMatch(dh.getLocalNameOfNode(context), m_name)))
- ? m_score : SCORE_NONE;
- }
+ return (m_isTotallyWild ||
(subPartMatch(dh.getNamespaceOfNode(context), m_namespace) &&
subPartMatch(dh.getLocalNameOfNode(context), m_name)))
+ ? m_score : SCORE_NONE;
+ }
default :
return SCORE_NONE;
} // end switch(testType)
}
/**
- * Test a node to see if it matches the given node test.
- * @param xpath The xpath that is executing.
- * @param context The current source tree context node.
- * @param opPos The current position in the xpath.m_opMap array.
- * @param len The length of the argument.
- * @param len The type of the step.
- * @returns score in an XNumber, one of MATCH_SCORE_NODETEST,
- * MATCH_SCORE_NONE, MATCH_SCORE_OTHER, MATCH_SCORE_QNAME.
+ * Test the current node to see if it matches the given node test.
*
- * NEEDSDOC @param xctxt
+ * @param xctxt XPath runtime context.
*
- * NEEDSDOC ($objectName$) @return
+ * @return [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NODETEST},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NONE},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NSWILD},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_QNAME}, or
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_OTHER}.
*
* @throws javax.xml.transform.TransformerException
*/
- public XObject execute(XPathContext xctxt) throws
javax.xml.transform.TransformerException
+ public XObject execute(XPathContext xctxt)
+ throws javax.xml.transform.TransformerException
{
if (m_whatToShow == NodeFilter.SHOW_ALL)
return m_score;
Node context = xctxt.getCurrentNode();
+
return execute(xctxt, context);
}
}
1.3 +4 -3
xml-xalan/java/src/org/apache/xpath/patterns/NodeTestFilter.java
Index: NodeTestFilter.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/NodeTestFilter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NodeTestFilter.java 2000/10/30 19:00:51 1.2
+++ NodeTestFilter.java 2000/12/17 19:31:25 1.3
@@ -58,17 +58,18 @@
/**
* This interface should be implemented by Nodes and/or iterators,
- * when they need to know what the node test is before get they do
+ * when they need to know what the node test is before they do
* getNextChild, etc.
*/
public interface NodeTestFilter
{
/**
- * NEEDSDOC Method setNodeTest
+ * Set the node test for this filter.
*
*
- * NEEDSDOC @param nodeTest
+ * @param nodeTest Reference to a NodeTest that may be used to
predetermine
+ * what nodes to return.
*/
void setNodeTest(NodeTest nodeTest);
}
1.16 +72 -46
xml-xalan/java/src/org/apache/xpath/patterns/StepPattern.java
Index: StepPattern.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/StepPattern.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- StepPattern.java 2000/11/23 04:59:24 1.15
+++ StepPattern.java 2000/12/17 19:31:25 1.16
@@ -68,19 +68,19 @@
import org.w3c.dom.traversal.NodeIterator;
/**
- * <meta name="usage" content="internal"/>
- * NEEDSDOC Class StepPattern <needs-comment/>
+ * <meta name="usage" content="advanced"/>
+ * This class represents a single pattern match step.
*/
public class StepPattern extends NodeTest implements SubContextList
{
/**
- * Constructor StepPattern
+ * Construct a StepPattern that tests for namespaces and node names.
*
*
- * NEEDSDOC @param whatToShow
- * NEEDSDOC @param namespace
- * NEEDSDOC @param name
+ * @param whatToShow Bit set defined mainly by [EMAIL PROTECTED]
org.w3c.dom.NodeFilter}.
+ * @param namespace The namespace to be tested.
+ * @param name The local name to be tested.
*/
public StepPattern(int whatToShow, String namespace, String name)
{
@@ -88,22 +88,24 @@
}
/**
- * Constructor StepPattern
+ * Construct a StepPattern that doesn't test for node names.
*
*
- * NEEDSDOC @param whatToShow
+ * @param whatToShow Bit set defined mainly by [EMAIL PROTECTED]
org.w3c.dom.NodeFilter}.
*/
public StepPattern(int whatToShow)
{
super(whatToShow);
}
- /** NEEDSDOC Field m_targetString */
+ /** The target local name or psuedo name, for hash table lookup
optimization. */
String m_targetString; // only calculate on head
/**
- * NEEDSDOC Method calcTargetString
+ * Calculate the local name or psuedo name of the node that this pattern
will test,
+ * for hash table lookup optimization.
*
+ * @see [EMAIL PROTECTED] org.apache.xpath.compiler.PsuedoNames}.
*/
public void calcTargetString()
{
@@ -138,10 +140,12 @@
}
/**
- * NEEDSDOC Method getTargetString
+ * Get the local name or psuedo name of the node that this pattern will
test,
+ * for hash table lookup optimization.
*
*
- * NEEDSDOC (getTargetString) @return
+ * @return local name or psuedo name of the node.
+ * @see [EMAIL PROTECTED] org.apache.xpath.compiler.PsuedoNames}.
*/
public String getTargetString()
{
@@ -155,10 +159,11 @@
StepPattern m_relativePathPattern;
/**
- * NEEDSDOC Method setRelativePathPattern
+ * Set the reference to nodetest and predicate for
+ * parent or ancestor.
*
*
- * NEEDSDOC @param expr
+ * @param expr The relative pattern expression.
*/
public void setRelativePathPattern(StepPattern expr)
{
@@ -168,16 +173,16 @@
calcScore();
}
- /** NEEDSDOC Field m_predicates */
+ /** The list of predicate expressions for this pattern step. */
Expression[] m_predicates;
/**
- * NEEDSDOC Method getPredicate
+ * Get a predicate expression.
*
*
- * NEEDSDOC @param i
+ * @param i The index of the predicate.
*
- * NEEDSDOC (getPredicate) @return
+ * @return A predicate expression.
*/
public Expression getPredicate(int i)
{
@@ -185,10 +190,10 @@
}
/**
- * NEEDSDOC Method getPredicateCount
+ * Get the number of predicates for this match pattern step.
*
*
- * NEEDSDOC (getPredicateCount) @return
+ * @return the number of predicates for this match pattern step.
*/
public final int getPredicateCount()
{
@@ -196,10 +201,11 @@
}
/**
- * NEEDSDOC Method setPredicates
+ * Set the predicates for this match pattern step.
*
*
- * NEEDSDOC @param predicates
+ * @param predicates An array of expressions that define predicates
+ * for this step.
*/
public void setPredicates(Expression[] predicates)
{
@@ -225,12 +231,16 @@
}
/**
- * NEEDSDOC Method executeStep
+ * Execute this pattern step, including predicates.
*
*
- * NEEDSDOC @param xctxt
+ * @param xctxt XPath runtime context.
*
- * NEEDSDOC (executeStep) @return
+ * @return [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NODETEST},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NONE},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NSWILD},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_QNAME}, or
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_OTHER}.
*
* @throws javax.xml.transform.TransformerException
*/
@@ -295,12 +305,14 @@
}
/**
- * NEEDSDOC Method getProximityPosition
+ * Get the proximity position index of the current node based on this
+ * node test.
*
*
- * NEEDSDOC @param xctxt
+ * @param xctxt XPath runtime context.
*
- * NEEDSDOC (getProximityPosition) @return
+ * @return the proximity position index of the current node based on the
+ * node test.
*/
public int getProximityPosition(XPathContext xctxt)
{
@@ -357,12 +369,15 @@
}
/**
- * NEEDSDOC Method getLastPos
+ * 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. In XSLT 1-based indexing, this count is the index of the
last
+ * node.
*
*
- * NEEDSDOC @param xctxt
+ * @param xctxt XPath runtime context.
*
- * NEEDSDOC (getLastPos) @return
+ * @return the count of the nodes that match the test.
*/
public int getLastPos(XPathContext xctxt)
{
@@ -409,12 +424,16 @@
}
/**
- * NEEDSDOC Method executeRelativePathPattern
+ * Execute the match pattern step relative to another step.
*
*
- * NEEDSDOC @param xctxt
+ * @param xctxt The XPath runtime context.
*
- * NEEDSDOC (executeRelativePathPattern) @return
+ * @return [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NODETEST},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NONE},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NSWILD},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_QNAME}, or
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_OTHER}.
*
* @throws javax.xml.transform.TransformerException
*/
@@ -449,12 +468,17 @@
}
/**
- * NEEDSDOC Method execute
- *
- *
- * NEEDSDOC @param xctxt
- *
- * NEEDSDOC (execute) @return
+ * Test the current node to see if it matches the given node test, and if
+ * it does, and there is a relative path pattern, execute that to see if
it
+ * matches also.
+ *
+ * @param xctxt XPath runtime context.
+ *
+ * @return [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NODETEST},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NONE},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NSWILD},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_QNAME}, or
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_OTHER}.
*
* @throws javax.xml.transform.TransformerException
*/
@@ -474,18 +498,20 @@
return score;
}
- /** NEEDSDOC Field DEBUG_MATCHES */
+ /** Set to true to send diagnostics about pattern matches to the consol.
*/
private static final boolean DEBUG_MATCHES = false;
/**
* Get the match score of the given node.
*
- * NEEDSDOC @param xctxt
- * @param context The current source tree context node.
- * @returns score, one of MATCH_SCORE_NODETEST,
- * MATCH_SCORE_NONE, MATCH_SCORE_OTHER, MATCH_SCORE_QNAME.
+ * @param xctxt The XPath runtime context.
+ * @param context The node to be tested.
*
- * NEEDSDOC ($objectName$) @return
+ * @return [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NODETEST},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NONE},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NSWILD},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_QNAME}, or
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_OTHER}.
*
* @throws javax.xml.transform.TransformerException
*/
1.5 +15 -17
xml-xalan/java/src/org/apache/xpath/patterns/UnionPattern.java
Index: UnionPattern.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/UnionPattern.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- UnionPattern.java 2000/11/13 16:27:54 1.4
+++ UnionPattern.java 2000/12/17 19:31:25 1.5
@@ -61,20 +61,21 @@
import org.apache.xpath.objects.XObject;
/**
- * <meta name="usage" content="internal"/>
- * NEEDSDOC Class UnionPattern <needs-comment/>
+ * <meta name="usage" content="advanced"/>
+ * This class represents a union pattern, which can have multiple individual
+ * StepPattern patterns.
*/
public class UnionPattern extends Expression
{
- /** NEEDSDOC Field m_patterns */
+ /** Array of the contained step patterns to be tested. */
private StepPattern[] m_patterns;
/**
- * NEEDSDOC Method setPatterns
+ * Set the contained step patterns to be tested.
*
*
- * NEEDSDOC @param patterns
+ * @param patterns the contained step patterns to be tested.
*/
public void setPatterns(StepPattern[] patterns)
{
@@ -82,10 +83,10 @@
}
/**
- * NEEDSDOC Method getPatterns
+ * Get the contained step patterns to be tested.
*
*
- * NEEDSDOC (getPatterns) @return
+ * @return an array of the contained step patterns to be tested.
*/
public StepPattern[] getPatterns()
{
@@ -93,18 +94,15 @@
}
/**
- * Test a node to see if it matches the given node test.
- * @param xpath The xpath that is executing.
- * @param context The current source tree context node.
- * @param opPos The current position in the xpath.m_opMap array.
- * @param len The length of the argument.
- * @param len The type of the step.
- * @returns score in an XNumber, one of MATCH_SCORE_NODETEST,
- * MATCH_SCORE_NONE, MATCH_SCORE_OTHER, MATCH_SCORE_QNAME.
+ * Test a node to see if it matches any of the patterns in the union.
*
- * NEEDSDOC @param xctxt
+ * @param xctxt XPath runtime context.
*
- * NEEDSDOC ($objectName$) @return
+ * @return [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NODETEST},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NONE},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_NSWILD},
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_QNAME}, or
+ * [EMAIL PROTECTED]
org.apache.xpath.patterns.NodeTest.SCORE_OTHER}.
*
* @throws javax.xml.transform.TransformerException
*/