villard 2003/03/27 13:53:25
Modified: java/xpath_rwapi/src2/org/apache/xpath/expression Tag:
xslt20 Visitable.java Visitor.java
FunctionCall.java Variable.java
java/xpath_rwapi/src2/org/apache/xpath/impl Tag: xslt20
CastOrTreatAsExprImpl.java
ForAndQuantifiedExprImpl.java ExprImpl.java
FunctionCallImpl.java LiteralImpl.java
PathExprImpl.java ExpressionFactoryImpl.java
VariableImpl.java CastableAsExprImpl.java
InstanceOfExprImpl.java StepExprImpl.java
OperatorImpl.java ConditionalExprImpl.java
java/xpath_rwapi/src2/org/apache/xpath/impl/parser Tag:
xslt20 SimpleNode.java QNameWrapper.java
Predicates.java
java/xpath_rwapi/src2/org/apache/xpath/test Tag: xslt20
TestSamples.java TestSamples.xml
Log:
- Implementation of removeOperand
- Function name are now QName
- Various bug fixes
Revision Changes Path
No revision
No revision
1.1.2.2 +1 -1
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/Visitable.java
Index: Visitable.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/Visitable.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- Visitable.java 13 Mar 2003 20:28:17 -0000 1.1.2.1
+++ Visitable.java 27 Mar 2003 21:53:24 -0000 1.1.2.2
@@ -60,5 +60,5 @@
*/
public interface Visitable {
- void visit(Visitor visitor);
+ boolean visit(Visitor visitor);
}
1.1.2.5 +1 -1
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/Visitor.java
Index: Visitor.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/Visitor.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- Visitor.java 27 Mar 2003 15:11:27 -0000 1.1.2.4
+++ Visitor.java 27 Mar 2003 21:53:24 -0000 1.1.2.5
@@ -93,7 +93,7 @@
* @param
* @return true to continue visiting the container expression
*/
- boolean visitOperator(OperatorExpr arithmetic);
+ boolean visitOperator(OperatorExpr operator);
/**
* Visit conditional expression
1.1.2.3 +5 -3
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/FunctionCall.java
Index: FunctionCall.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/FunctionCall.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- FunctionCall.java 27 Mar 2003 15:11:27 -0000 1.1.2.2
+++ FunctionCall.java 27 Mar 2003 21:53:24 -0000 1.1.2.3
@@ -55,17 +55,19 @@
*/
package org.apache.xpath.expression;
+import org.apache.xml.QName;
+
/**
- * Represents function call.
- * The operands correspond to the function parameters.
+ * Represents function call XPath expression type.
+ * The operands defined in the <code>OperatorExpr</code> correspond to
function parameters.
*/
public interface FunctionCall extends OperatorExpr {
/**
* Gets the qualified name of the function
*/
- String getFunctionQName();
+ QName getFunctionQName();
}
1.1.2.3 +3 -2
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/Variable.java
Index: Variable.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/Variable.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- Variable.java 27 Mar 2003 15:11:27 -0000 1.1.2.2
+++ Variable.java 27 Mar 2003 21:53:24 -0000 1.1.2.3
@@ -55,6 +55,7 @@
*/
package org.apache.xpath.expression;
+import org.apache.xml.QName;
import org.apache.xpath.XPathException;
/**
@@ -66,13 +67,13 @@
* Gets the name of the variable.
* @return String
*/
- String getVariableName();
+ QName getVariableName();
/**
* Sets the name of the variable.
* @param name New name of the variable
* @throws XPathException whenever the given name is not a valid
variable name
*/
- void setVariableName(String name) throws XPathException;
+ void setVariableName(QName name) throws XPathException;
}
No revision
No revision
1.1.2.2 +40 -23
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/CastOrTreatAsExprImpl.java
Index: CastOrTreatAsExprImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/CastOrTreatAsExprImpl.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- CastOrTreatAsExprImpl.java 26 Mar 2003 03:42:54 -0000 1.1.2.1
+++ CastOrTreatAsExprImpl.java 27 Mar 2003 21:53:24 -0000 1.1.2.2
@@ -65,7 +65,7 @@
/**
- * Default implementation of <code>CastOrTreatAsExpr</code> interface.
+ * Default implementation of <code>CastOrTreatAsExpr</code> interface.
*/
public class CastOrTreatAsExprImpl extends ExprImpl implements
CastOrTreatAsExpr
{
@@ -78,7 +78,7 @@
{
super(i);
- children = new Node[2];
+ m_children = new Node[2];
}
/**
@@ -91,7 +91,7 @@
{
super(p, i);
- children = new Node[2];
+ m_children = new Node[2];
}
/**
@@ -99,12 +99,28 @@
*
* @param expr DOCUMENT ME!
*/
- public CastOrTreatAsExprImpl(CastOrTreatAsExprImpl expr) {
- super(expr.id);
-
- children = new Node[2];
- children[0] = children[0]; // TODO: clone
- children[1] = (Node) ((Expr) children[1]).cloneExpression();
+ protected CastOrTreatAsExprImpl(CastOrTreatAsExprImpl expr)
+ {
+ super(expr.id);
+
+ m_children = new Node[2];
+ m_children[0] = m_children[0]; // TODO: clone
+ m_children[1] = (Node) ((Expr) m_children[1]).cloneExpression();
+ }
+
+ /**
+ * Constructor for factory
+ *
+ * @param type DOCUMENT ME!
+ * @param expr DOCUMENT ME!
+ */
+ public CastOrTreatAsExprImpl(SequenceType type, Expr expr, boolean
isCast)
+ {
+ super( (isCast) ?
XPathTreeConstants.JJTCASTEXPR:XPathTreeConstants.JJTTREATEXPR);
+
+ m_children = new Node[2];
+ m_children[0] = (Node) type;
+ m_children[1] = (Node) expr;
}
/**
@@ -120,16 +136,16 @@
*/
public short getExprType()
{
- return (id == XPathTreeConstants.JJTCASTEXPR) ? CAST_AS_EXPR :
TREAT_AS_EXPR;
+ return (id == XPathTreeConstants.JJTCASTEXPR) ? CAST_AS_EXPR
+ : TREAT_AS_EXPR;
}
-
/**
* @see org.apache.xpath.expression.CastExpr#getParenthesizedExpr()
*/
public Expr getExpr()
{
- return (Expr) children[1];
+ return (Expr) m_children[1];
}
/**
@@ -137,7 +153,7 @@
*/
public SequenceType getSequenceType()
{
- return (SequenceType) children[0];
+ return (SequenceType) m_children[0];
}
/**
@@ -154,15 +170,16 @@
super.jjtAddChild(n, i);
}
}
- /* (non-Javadoc)
- * @see
org.apache.xpath.impl.parser.SimpleNode#getString(java.lang.StringBuffer,
boolean)
- */
- public void getString(StringBuffer expr, boolean abbreviate) {
- expr.append( (getExprType() == CAST_AS_EXPR) ? "cast as " :
"treat as ");
- ((SimpleNode) getSequenceType()).getString(expr, abbreviate);
- expr.append('(');
- ((ExprImpl) getExpr()).getString(expr, abbreviate);
- expr.append(')');
- }
+ /* (non-Javadoc)
+ * @see
org.apache.xpath.impl.parser.SimpleNode#getString(java.lang.StringBuffer,
boolean)
+ */
+ public void getString(StringBuffer expr, boolean abbreviate)
+ {
+ expr.append((getExprType() == CAST_AS_EXPR) ? "cast as " : "treat as
");
+ ((SimpleNode) getSequenceType()).getString(expr, abbreviate);
+ expr.append('(');
+ ((ExprImpl) getExpr()).getString(expr, abbreviate);
+ expr.append(')');
+ }
}
1.1.2.2 +3 -2
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/ForAndQuantifiedExprImpl.java
Index: ForAndQuantifiedExprImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/ForAndQuantifiedExprImpl.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- ForAndQuantifiedExprImpl.java 13 Mar 2003 20:28:14 -0000 1.1.2.1
+++ ForAndQuantifiedExprImpl.java 27 Mar 2003 21:53:24 -0000 1.1.2.2
@@ -204,15 +204,16 @@
*/
public boolean canBeReduced()
{
- return children.length == 1; // means that there is no???
+ return m_children.length == 1; // means that there is no???
}
/**
* @see org.apache.xpath.expression.Visitable#visit(Visitor)
*/
- public void visit(Visitor visitor)
+ public boolean visit(Visitor visitor)
{
// TODO:
+ return true;
}
/* (non-Javadoc)
1.1.2.2 +2 -2
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/ExprImpl.java
Index: ExprImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/ExprImpl.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- ExprImpl.java 13 Mar 2003 20:28:14 -0000 1.1.2.1
+++ ExprImpl.java 27 Mar 2003 21:53:24 -0000 1.1.2.2
@@ -108,8 +108,8 @@
/**
* @see org.apache.xpath.expression.Visitable#visit(Visitor)
*/
- public void visit(Visitor visitor) {
- // by default: nothing
+ public boolean visit(Visitor visitor) {
+ return true;
}
}
1.1.2.4 +4 -11
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/FunctionCallImpl.java
Index: FunctionCallImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/FunctionCallImpl.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- FunctionCallImpl.java 27 Mar 2003 15:11:27 -0000 1.1.2.3
+++ FunctionCallImpl.java 27 Mar 2003 21:53:24 -0000 1.1.2.4
@@ -93,15 +93,8 @@
/**
* @see org.apache.xpath.expression.FunctionCall#getFunctionName()
*/
- public String getFunctionQName() {
- return m_qname.toString();
- }
-
- /**
- * @see org.apache.xpath.expression.FunctionCall#getFunctionPrefix()
- */
- public String getFunctionPrefix() {
- return m_qname.getPrefix();
+ public QName getFunctionQName() {
+ return m_qname;
}
/**
@@ -150,14 +143,14 @@
* @see org.apache.xpath.expression.OperatorExpr#getOperand(int)
*/
public Expr getOperand(int i) {
- return (Expr) children[i];
+ return (Expr) m_children[i];
}
/**
* @see org.apache.xpath.expression.OperatorExpr#getOperandCount()
*/
public int getOperandCount() {
- return (children == null) ? 0 : children.length;
+ return (m_children == null) ? 0 : m_children.length;
}
/**
1.1.2.3 +15 -13
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/LiteralImpl.java
Index: LiteralImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/LiteralImpl.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- LiteralImpl.java 27 Mar 2003 15:11:27 -0000 1.1.2.2
+++ LiteralImpl.java 27 Mar 2003 21:53:24 -0000 1.1.2.3
@@ -105,18 +105,20 @@
{
super(p, i);
}
-
- /**
- * Constructor for cloning.
- *
- */
- public LiteralImpl(LiteralImpl expr)
- {
- super(expr.id);
-
- m_literal = expr.m_literal;
- // no cloning since m_literal reference is immutable
- }
+
+ /**
+ * Constructor for cloning.
+ *
+ * @param expr DOCUMENT ME!
+ */
+ public LiteralImpl(LiteralImpl expr)
+ {
+ super(expr.id);
+
+ m_literal = expr.m_literal;
+
+ // no cloning since m_literal reference is immutable
+ }
/**
* @see org.apache.xpath.expression.Expr#getExprType()
@@ -249,7 +251,7 @@
*/
public void visited(Visitor visitor)
{
- visitor.visitLiteral(this);
+ visitor.visitLiteral(this);
}
/**
1.1.2.2 +10 -8
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/PathExprImpl.java
Index: PathExprImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/PathExprImpl.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- PathExprImpl.java 13 Mar 2003 20:28:14 -0000 1.1.2.1
+++ PathExprImpl.java 27 Mar 2003 21:53:24 -0000 1.1.2.2
@@ -117,17 +117,19 @@
/**
* @see org.apache.xpath.expression.Visitable#visit(Visitor)
*/
- public void visit(Visitor visitor)
+ public boolean visit(Visitor visitor)
{
- visitor.visitPath(this);
+ if (visitor.visitPath(this))
+ {
+ // visit each step (operand)
+ return super.visit(visitor);
+ }
- // visit each step (operand)
- super.visit(visitor);
+ return false;
}
/**
- * @see org.apache.xpath.impl.ExprImpl#getString(StringBuffer,
- * boolean)
+ * @see org.apache.xpath.impl.ExprImpl#getString(StringBuffer, boolean)
*/
public void getString(StringBuffer expr, boolean abbreviate)
{
@@ -180,9 +182,9 @@
public boolean canBeReduced()
{
// Can be reduced whenever there is only one step and this step is a
primary expression
- if ((children != null) && (children.length == 1))
+ if ((m_children != null) && (m_children.length == 1))
{
- Expr step = (Expr) children[0];
+ Expr step = (Expr) m_children[0];
int et = step.getExprType();
return (((et == STEP) && ((StepExpr) step).isPrimaryExpr())
1.1.2.4 +6 -13
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/ExpressionFactoryImpl.java
Index: ExpressionFactoryImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/ExpressionFactoryImpl.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- ExpressionFactoryImpl.java 27 Mar 2003 15:11:27 -0000 1.1.2.3
+++ ExpressionFactoryImpl.java 27 Mar 2003 21:53:24 -0000 1.1.2.4
@@ -116,17 +116,10 @@
}
/**
- * @see
org.apache.xpath.expression.ExpressionFactory#createPredicate(org.apache.xpath.expression.Expr)
- */
- public Expr createPredicate(Expr expr) {
- return null;
- }
-
- /**
* @see
org.apache.xpath.expression.ExpressionFactory#createCombineExpr(short)
*/
public OperatorExpr createCombineExpr(short type) {
- return null;
+ return new OperatorImpl(Expr.COMBINE_EXPR, type);
}
/**
@@ -147,21 +140,21 @@
* @see
org.apache.xpath.expression.ExpressionFactory#createAndExpr(org.apache.xpath.expression.Expr,
org.apache.xpath.expression.Expr)
*/
public OperatorExpr createAndExpr(Expr firstOperand, Expr
secondOperand) {
- return null;
+ return new OperatorImpl(Expr.LOGICAL_EXPR,
OperatorExpr.AND_LOGICAL);
}
/**
* @see
org.apache.xpath.expression.ExpressionFactory#createOrExpr(org.apache.xpath.expression.Expr,
org.apache.xpath.expression.Expr)
*/
public OperatorExpr createOrExpr(Expr firstOperand, Expr secondOperand)
{
- return null;
+ return new OperatorImpl(Expr.LOGICAL_EXPR,
OperatorExpr.OR_LOGICAL);
}
/**
* @see
org.apache.xpath.expression.ExpressionFactory#createIfExpr(org.apache.xpath.expression.Expr,
org.apache.xpath.expression.Expr, org.apache.xpath.expression.Expr)
*/
public ConditionalExpr createIfExpr(Expr test, Expr thenExpr, Expr
elseExpr) {
- return null;
+ return new ConditionalExprImpl(test, thenExpr, elseExpr);
}
/**
@@ -175,7 +168,7 @@
* @see
org.apache.xpath.expression.ExpressionFactory#createCastExpr(org.apache.xpath.datamodel.SequenceType,
org.apache.xpath.expression.OperatorExpr)
*/
public CastOrTreatAsExpr createCastAsExpr(SequenceType seqType,
OperatorExpr parExpr) {
- return null;
+ return new CastOrTreatAsExprImpl(seqType, parExpr, true);
}
/* (non-Javadoc)
@@ -184,7 +177,7 @@
public CastOrTreatAsExpr createTreatAsExpr(
SequenceType seqType,
OperatorExpr parExpr) {
- return null;
+ return new CastOrTreatAsExprImpl(seqType, parExpr,
false);
}
1.1.2.3 +5 -4
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/VariableImpl.java
Index: VariableImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/VariableImpl.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- VariableImpl.java 27 Mar 2003 15:11:27 -0000 1.1.2.2
+++ VariableImpl.java 27 Mar 2003 21:53:24 -0000 1.1.2.3
@@ -55,6 +55,7 @@
*/
package org.apache.xpath.impl;
+import org.apache.xml.QName;
import org.apache.xpath.XPathException;
import org.apache.xpath.expression.Expr;
import org.apache.xpath.expression.Variable;
@@ -71,7 +72,7 @@
/**
* Name of the variable
*/
- String m_varName;
+ QName m_varName;
/**
* Constructor for VariableImpl. Internal use only.
@@ -109,7 +110,7 @@
/**
* @see org.apache.xpath.expression.Variable#getVariableName()
*/
- public String getVariableName()
+ public QName getVariableName()
{
return m_varName;
}
@@ -117,7 +118,7 @@
/* (non-Javadoc)
* @see
org.apache.xpath.expression.Variable#setVariableName(java.lang.String)
*/
- public void setVariableName(String name) throws XPathException {
+ public void setVariableName(QName name) throws XPathException {
// TODO: check the validity of the var name
m_varName = name;
@@ -153,7 +154,7 @@
public void processToken(Token token)
{
super.processToken(token);
- m_varName = token.image.trim();
+ m_varName = QName.valueOf(token.image.trim());
}
/**
1.1.2.2 +120 -88
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/CastableAsExprImpl.java
Index: CastableAsExprImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/CastableAsExprImpl.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- CastableAsExprImpl.java 26 Mar 2003 21:27:22 -0000 1.1.2.1
+++ CastableAsExprImpl.java 27 Mar 2003 21:53:24 -0000 1.1.2.2
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
+ * Copyright (c) 2002-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -9,7 +9,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -17,7 +17,7 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
@@ -25,7 +25,7 @@
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
@@ -63,101 +63,133 @@
import org.apache.xpath.impl.parser.SimpleNode;
import org.apache.xpath.impl.parser.XPath;
+
/**
* Default implementation of 'castable as' expression type.
*/
-public class CastableAsExprImpl extends ExprImpl implements CastableAsExpr {
+public class CastableAsExprImpl extends ExprImpl implements CastableAsExpr
+{
+ /**
+ * Constructor for CastableExprImpl. Internal uses only
+ *
+ * @param i
+ */
+ public CastableAsExprImpl(int i)
+ {
+ super(i);
+
+ m_children = new Node[2];
+ }
+
+ /**
+ * Constructor for CastableExprImpl. Internal uses only
+ *
+ * @param p
+ * @param i
+ */
+ public CastableAsExprImpl(XPath p, int i)
+ {
+ super(p, i);
+
+ m_children = new Node[2];
+ }
+
+ /**
+ * Constructor for cloning
+ *
+ * @param expr DOCUMENT ME!
+ */
+ protected CastableAsExprImpl(CastableAsExprImpl expr)
+ {
+ super(expr.id);
+
+ m_children = new Node[2];
+ m_children[0] = (Node) ((Expr) m_children[0]).cloneExpression();
+ m_children[1] = m_children[1]; // TODO: clone
+ }
+
+ /**
+ * Constructor for factory
+ *
+ * @param expr DOCUMENT ME!
+ * @param type DOCUMENT ME!
+ */
+ protected CastableAsExprImpl(Expr expr, SequenceType type)
+ {
+ super();
+
+ m_children = new Node[2];
+ m_children[0] = (Node) expr;
+ m_children[1] = (Node) type;
+ }
+
+ /**
+ * @see org.apache.xpath.expression.Expr#getExprType()
+ */
+ public short getExprType()
+ {
+ return Expr.CASTABLE_EXPR;
+ }
+
+ /**
+ * @see org.apache.xpath.expression.Expr#cloneExpression()
+ */
+ public Expr cloneExpression()
+ {
+ return new CastableAsExprImpl(this);
+ }
+
+ /**
+ * @see org.apache.xpath.expression.CastableExpr#getCastableExpr()
+ */
+ public Expr getExpr()
+ {
+ return (Expr) m_children[0];
+ }
+
+ /**
+ * @see org.apache.xpath.expression.CastableExpr#getSingleType()
+ */
+ public SequenceType getSingleType()
+ {
+ return (SequenceType) m_children[1];
+ }
- /**
- * Constructor for CastableExprImpl.
- * @param i
- */
- public CastableAsExprImpl(int i) {
- super(i);
-
- children = new Node[2];
- }
-
- /**
- * Constructor for CastableExprImpl.
- * @param p
- * @param i
- */
- public CastableAsExprImpl(XPath p, int i) {
- super(p, i);
-
- children = new Node[2];
- }
-
- /**
- * Constructor for cloning
- */
- public CastableAsExprImpl(CastableAsExprImpl expr)
- {
- super(expr.id);
-
-
- children = new Node[2];
- children[0] = (Node) ((Expr) children[0]).cloneExpression();
- children[1] = children[1]; // TODO: clone
- }
-
- /**
- * @see org.apache.xpath.expression.Expr#getExprType()
- */
- public short getExprType() {
- return Expr.CASTABLE_EXPR;
- }
-
- /**
- * @see org.apache.xpath.expression.Expr#cloneExpression()
- */
- public Expr cloneExpression() {
- return new CastableAsExprImpl(this);
- }
-
- /**
- * @see org.apache.xpath.expression.CastableExpr#getCastableExpr()
- */
- public Expr getExpr() {
- return (Expr) children[0];
- }
-
- /**
- * @see org.apache.xpath.expression.CastableExpr#getSingleType()
- */
- public SequenceType getSingleType() {
- return (SequenceType) children[1];
- }
-
/**
* @see org.apache.xpath.impl.parser.Node#jjtAddChild(Node, int)
*/
- public void jjtAddChild(Node n, int i) {
- if (((SimpleNode) n).canBeReduced()) {
+ public void jjtAddChild(Node n, int i)
+ {
+ if (((SimpleNode) n).canBeReduced())
+ {
super.jjtAddChild(n.jjtGetChild(0), i);
- } else {
- super.jjtAddChild(n, i);
+ }
+ else
+ {
+ super.jjtAddChild(n, i);
}
}
+ /* (non-Javadoc)
+ * @see
org.apache.xpath.impl.parser.SimpleNode#getString(java.lang.StringBuffer,
boolean)
+ */
+ public void getString(StringBuffer expr, boolean abbreviate)
+ {
+ ((ExprImpl) getExpr()).getString(expr, abbreviate);
+ expr.append(" castable as ");
+ ((SimpleNode) getSingleType()).getString(expr, abbreviate);
+ }
- /* (non-Javadoc)
- * @see
org.apache.xpath.impl.parser.SimpleNode#getString(java.lang.StringBuffer,
boolean)
- */
- public void getString(StringBuffer expr, boolean abbreviate) {
- ((ExprImpl) getExpr()).getString(expr, abbreviate);
- expr.append(" castable as ");
- ((SimpleNode) getSingleType()).getString(expr, abbreviate);
- }
-
- /* (non-Javadoc)
- * @see
org.apache.xpath.expression.Visitable#visit(org.apache.xpath.expression.Visitor)
- */
- public void visit(Visitor visitor) {
- visitor.visitCastableAs(this);
-
- getExpr().visit(visitor);
- }
+ /* (non-Javadoc)
+ * @see
org.apache.xpath.expression.Visitable#visit(org.apache.xpath.expression.Visitor)
+ */
+ public boolean visit(Visitor visitor)
+ {
+ if (visitor.visitCastableAs(this))
+ {
+ return getExpr().visit(visitor);
+ }
+ return false;
+ }
}
1.1.2.3 +7 -7
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/InstanceOfExprImpl.java
Index: InstanceOfExprImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/InstanceOfExprImpl.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- InstanceOfExprImpl.java 25 Mar 2003 23:46:09 -0000 1.1.2.2
+++ InstanceOfExprImpl.java 27 Mar 2003 21:53:24 -0000 1.1.2.3
@@ -75,7 +75,7 @@
public InstanceOfExprImpl(int i) {
super(i);
- children = new Node[2];
+ m_children = new Node[2];
}
/**
@@ -86,7 +86,7 @@
public InstanceOfExprImpl(XPath p, int i) {
super(p, i);
- children = new Node[2];
+ m_children = new Node[2];
}
/**
@@ -95,23 +95,23 @@
private InstanceOfExprImpl(InstanceOfExprImpl expr) {
super(expr.id);
- children = new Node[2];
- children[0] = (Node) expr.getTestedExpr().cloneExpression();
- children[1] = (Node) expr.getSequenceType();
+ m_children = new Node[2];
+ m_children[0] = (Node) expr.getTestedExpr().cloneExpression();
+ m_children[1] = (Node) expr.getSequenceType();
}
/**
* @see org.apache.xpath.expression.InstanceOfExpr#getSequenceType()
*/
public SequenceType getSequenceType() {
- return (SequenceType) children[1];
+ return (SequenceType) m_children[1];
}
/**
* @see org.apache.xpath.expression.InstanceOfExpr#getTestedExpr()
*/
public Expr getTestedExpr() {
- return (Expr) children[0];
+ return (Expr) m_children[0];
}
/**
1.1.2.3 +7 -7
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/StepExprImpl.java
Index: StepExprImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/StepExprImpl.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- StepExprImpl.java 27 Mar 2003 15:11:27 -0000 1.1.2.2
+++ StepExprImpl.java 27 Mar 2003 21:53:24 -0000 1.1.2.3
@@ -139,7 +139,7 @@
*/
public Expr getPredicateAt(int i)
{
- return (Expr) children[i + 1];
+ return (Expr) m_children[i + 1];
}
/**
@@ -147,7 +147,7 @@
*/
public int getPredicateCount()
{
- return children.length - 1;
+ return m_children.length - 1;
}
/**
@@ -155,7 +155,7 @@
*/
public void appendPredicate(Expr predicate)
{
- super.jjtAddChild((Node) predicate, children.length);
+ super.jjtAddChild((Node) predicate, m_children.length);
}
/**
@@ -166,9 +166,9 @@
/**
* @see org.apache.xpath.expression.Visitable#visit(Visitor)
*/
- public void visit(Visitor visitor)
+ public boolean visit(Visitor visitor)
{
- visitor.visitStep(this);
+ return visitor.visitStep(this);
}
/**
@@ -244,7 +244,7 @@
throw new XPathException("Invalid call of this method on step
compose of primary expression");
}
- return (NodeTest) children[0];
+ return (NodeTest) m_children[0];
}
/**
@@ -257,7 +257,7 @@
throw new XPathException("Invalid call of this method on step
compose of node test");
}
- return (Expr) children[0];
+ return (Expr) m_children[0];
}
/**
1.1.2.2 +88 -24
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/OperatorImpl.java
Index: OperatorImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/OperatorImpl.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- OperatorImpl.java 13 Mar 2003 20:28:14 -0000 1.1.2.1
+++ OperatorImpl.java 27 Mar 2003 21:53:24 -0000 1.1.2.2
@@ -66,6 +66,8 @@
import org.apache.xpath.impl.parser.XPathConstants;
import org.apache.xpath.impl.parser.XPathTreeConstants;
+import java.security.InvalidParameterException;
+
/**
*
@@ -91,11 +93,19 @@
true, false, false, false, false, false, false, true, true, false,
false,
true, true, false, false, false, false, false, false, true, true,
true
};
+
+ /**
+ * Type of the expression
+ */
short m_exprType;
+
+ /**
+ * Type of the operator
+ */
short m_opType;
/**
- * Constructor for OperatorImpl.
+ * Constructor for OperatorImpl. Internal uses only.
*
* @param i
*/
@@ -150,7 +160,7 @@
case XPathTreeConstants.JJTCOMPARISONEXPR:
m_exprType = COMPARISON_EXPR;
- // opType is not known yet
+ // opType is not known yet
break;
case XPathTreeConstants.JJTRANGEEXPR:
@@ -160,12 +170,15 @@
break;
default:
- System.out.println("OperatorImpl: not implemented yet:" + i);
+
+ // Invalid parameter
+ throw new InvalidParameterException(
+ "The parameter value does not correspond to an operator
identifier"); // I16
}
}
/**
- * Constructor for OperatorImpl.
+ * Constructor for OperatorImpl. Internal uses only.
*
* @param p
* @param i
@@ -176,6 +189,48 @@
}
/**
+ * Constructor for cloning
+ *
+ * @param expr DOCUMENT ME!
+ */
+ protected OperatorImpl(OperatorImpl expr)
+ {
+ super(expr.id);
+
+ m_exprType = expr.m_exprType;
+ m_opType = expr.m_opType;
+
+ // clone operands
+ int count = getOperandCount();
+
+ for (int i = 0; i < count; i++)
+ {
+ try
+ {
+ addOperand(getOperand(i).cloneExpression());
+ }
+ catch (XPathException e)
+ {
+ // never
+ }
+ }
+ }
+
+ /**
+ * Constructor for OperatorImpl.
+ *
+ * @param exprType DOCUMENT ME!
+ * @param opType DOCUMENT ME!
+ */
+ protected OperatorImpl(short exprType, short opType)
+ {
+ super();
+
+ m_exprType = exprType;
+ m_opType = opType;
+ }
+
+ /**
* @see org.apache.xpath.expression.Expr#getExprType()
*/
public short getExprType()
@@ -188,19 +243,31 @@
*/
public Expr cloneExpression()
{
- return null;
+ return new OperatorImpl(this);
}
/**
* @see org.apache.xpath.expression.Visitable#visit(Visitor)
*/
- public void visit(Visitor visitor)
+ public boolean visit(Visitor visitor)
{
- int count = getOperandCount();
+ if (visitor.visitOperator(this))
+ {
+ int count = getOperandCount();
- for (int i = 0; i < count; i++)
+ for (int i = 0; i < count; i++)
+ {
+ if (!getOperand(i).visit(visitor))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ else
{
- getOperand(i).visit(visitor);
+ return false;
}
}
@@ -210,7 +277,7 @@
public void addOperand(Expr operand) throws XPathException
{
super.jjtAddChild((Node) operand,
- (children == null) ? 0 : children.length);
+ (m_children == null) ? 0 : m_children.length);
}
/**
@@ -218,12 +285,12 @@
*/
public Expr getOperand(int i)
{
- if (children == null)
+ if (m_children == null)
{
throw new ArrayIndexOutOfBoundsException();
}
- return (Expr) children[i];
+ return (Expr) m_children[i];
}
/**
@@ -231,7 +298,7 @@
*/
public int getOperandCount()
{
- return (children == null) ? 0 : children.length;
+ return (m_children == null) ? 0 : m_children.length;
}
/**
@@ -247,6 +314,7 @@
*/
public void removeOperand(Expr operand) throws XPathException
{
+ super.jjtRemoveChild((Node) operand);
}
/**
@@ -254,12 +322,6 @@
*/
public void jjtAddChild(Node n, int i)
{
- // Filter operator
- // if (n.getId() == XPathTreeConstants.JJTSLASH)
- // {
- // Filter
- // }
- //else
if (n.getId() == XPathTreeConstants.JJTMINUS)
{
// Minus expression
@@ -299,7 +361,7 @@
{
if (m_exprType == SEQUENCE_EXPR)
{
- return (children == null) || (children.length <= 1);
+ return (m_children == null) || (m_children.length <= 1);
}
return super.canBeReduced();
@@ -336,7 +398,7 @@
int size = getOperandCount();
String oper = getOperatorChar();
ExprImpl op;
-
+
if ((m_opType == MINUS_UNARY) || (m_opType == PLUS_UNARY))
{
expr.append(oper);
@@ -346,14 +408,16 @@
{
op = (ExprImpl) getOperand(i);
- if (op.getExprType() == ARITHMETIC_EXPR || op.getExprType() ==
COMBINE_EXPR)
+ if ((op.getExprType() == ARITHMETIC_EXPR)
+ || (op.getExprType() == COMBINE_EXPR))
{
expr.append('(');
}
op.getString(expr, abbreviate);
- if (op.getExprType() == ARITHMETIC_EXPR || op.getExprType() ==
COMBINE_EXPR)
+ if ((op.getExprType() == ARITHMETIC_EXPR)
+ || (op.getExprType() == COMBINE_EXPR))
{
expr.append(')');
}
@@ -519,7 +583,7 @@
break;
default:
- // Bug.. report
+ // never
}
}
}
1.1.2.4 +47 -24
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/ConditionalExprImpl.java
Index: ConditionalExprImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/ConditionalExprImpl.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- ConditionalExprImpl.java 25 Mar 2003 23:46:09 -0000 1.1.2.3
+++ ConditionalExprImpl.java 27 Mar 2003 21:53:24 -0000 1.1.2.4
@@ -76,7 +76,7 @@
public ConditionalExprImpl(int i)
{
super(i);
- children = new Node[3];
+ m_children = new Node[3];
}
/**
@@ -88,27 +88,43 @@
public ConditionalExprImpl(XPath p, int i)
{
super(p, i);
- children = new Node[3];
+ m_children = new Node[3];
+ }
+
+ /**
+ * Constructor for ConditionalExprImpl.
+ *
+ * @param expr DOCUMENT ME!
+ */
+ protected ConditionalExprImpl(ConditionalExprImpl expr)
+ {
+ super(expr.id);
+ m_children = new Node[3];
+ System.arraycopy(expr.m_children, 0, m_children, 0, 3);
+ }
+
+ /**
+ * Constructor for ConditionalExprImpl.
+ *
+ * @param test
+ * @param thenClause
+ * @param elseClause DOCUMENT ME!
+ */
+ protected ConditionalExprImpl(Expr test, Expr thenClause, Expr
elseClause)
+ {
+ super();
+ m_children = new Node[3];
+ m_children[0] = (Node) test;
+ m_children[1] = (Node) thenClause;
+ m_children[2] = (Node) elseClause;
}
-
- /**
- * Constructor for ConditionalExprImpl.
- *
- * @param i
- */
- private ConditionalExprImpl(ConditionalExprImpl expr)
- {
- super(expr.id);
- children = new Node[3];
- System.arraycopy(expr.children, 0, children, 0, 3);
- }
/**
* @see org.apache.xpath.expression.ConditionalExpr#getElseExpr()
*/
public Expr getElseExpr()
{
- return (Expr) children[2];
+ return (Expr) m_children[2];
}
/**
@@ -116,7 +132,7 @@
*/
public Expr getTestExpr()
{
- return (Expr) children[0];
+ return (Expr) m_children[0];
}
/**
@@ -124,7 +140,7 @@
*/
public Expr getThenExpr()
{
- return (Expr) children[1];
+ return (Expr) m_children[1];
}
/* (non-Javadoc)
@@ -132,7 +148,7 @@
*/
public void setElseExpr(Expr expr)
{
- children[2] = (Node) expr;
+ m_children[2] = (Node) expr;
}
/* (non-Javadoc)
@@ -140,7 +156,7 @@
*/
public void setTestExpr(Expr expr)
{
- children[0] = (Node) expr;
+ m_children[0] = (Node) expr;
}
/* (non-Javadoc)
@@ -148,14 +164,14 @@
*/
public void setThenExpr(Expr expr)
{
- children[1] = (Node) expr;
+ m_children[1] = (Node) expr;
}
/**
* @see org.apache.xpath.expression.Expr#cloneExpression()
*/
public Expr cloneExpression()
- {
+ {
return new ConditionalExprImpl(this);
}
@@ -170,9 +186,16 @@
/**
* @see org.apache.xpath.expression.Visitable#visit(Visitor)
*/
- public void visit(Visitor visitor)
- {
- visitor.visitConditional(this);
+ public boolean visit(Visitor visitor)
+ {
+ if ( visitor.visitConditional(this) ) {
+ if ( getTestExpr().visit(visitor)) {
+ if ( getThenExpr().visit(visitor) ) {
+ return getElseExpr().visit(visitor);
+ }
+ }
+ }
+ return false;
}
/**
No revision
No revision
1.1.2.7 +101 -50
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/SimpleNode.java
Index: SimpleNode.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/SimpleNode.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- SimpleNode.java 27 Mar 2003 15:11:27 -0000 1.1.2.6
+++ SimpleNode.java 27 Mar 2003 21:53:25 -0000 1.1.2.7
@@ -24,11 +24,17 @@
{
public static boolean PRODUCE_RAW_TREE = false;
final static private NodeFactory DEFAULT_NODE_FACTORY = new
DefaultNodeFactory();
- protected Node parent; // to remove
- protected Node[] children; // to remove
+
+ /**
+ * List of child nodes
+ */
+ protected Node[] m_children;
+
protected int id; // to remove
- protected SimpleNode() {}
+ protected SimpleNode()
+ {
+ }
/**
* Creates a new SimpleNode object.
@@ -68,7 +74,7 @@
Node newNode;
NodeFactory nodeFactory = (p.m_nodeFactory == null)
- ? DEFAULT_NODE_FACTORY : p.m_nodeFactory;
+ ? DEFAULT_NODE_FACTORY : p.m_nodeFactory;
switch (id)
{
@@ -118,7 +124,6 @@
break;
-
case XPathTreeConstants.JJTCASTABLEEXPR:
newNode = (CastableAsExprImpl) nodeFactory.createNode(id);
@@ -208,8 +213,8 @@
break;
- case XPathTreeConstants.JJTSEQUENCETYPE:
- case XPathTreeConstants.JJTSINGLETYPE:
+ case XPathTreeConstants.JJTSEQUENCETYPE:
+ case XPathTreeConstants.JJTSINGLETYPE:
newNode = nodeFactory.createSequenceTypeNode(id);
if (newNode == null)
@@ -311,12 +316,12 @@
break;
- case XPathTreeConstants.JJTATTRIBUTETYPE:
+ case XPathTreeConstants.JJTATTRIBUTETYPE:
newNode = Singletons.ATTRIBUTE;
break;
- case XPathTreeConstants.JJTATOMICTYPE:
+ case XPathTreeConstants.JJTATOMICTYPE:
newNode = Singletons.ATOMIC;
break;
@@ -326,7 +331,7 @@
break;
- case XPathTreeConstants.JJTPROCESSINGINSTRUCTION:
+ case XPathTreeConstants.JJTPROCESSINGINSTRUCTION:
newNode = Singletons.PI;
break;
@@ -336,17 +341,17 @@
break;
- case XPathTreeConstants.JJTTEXT:
+ case XPathTreeConstants.JJTTEXT:
newNode = Singletons.TEXT;
break;
- case XPathTreeConstants.JJTDOCUMENT:
+ case XPathTreeConstants.JJTDOCUMENT:
newNode = Singletons.DOCUMENT;
break;
- case XPathTreeConstants.JJTITEM:
+ case XPathTreeConstants.JJTITEM:
newNode = Singletons.ITEM;
break;
@@ -356,7 +361,7 @@
break;
- case XPathTreeConstants.JJTQMARK:
+ case XPathTreeConstants.JJTQMARK:
newNode = Singletons.QMARK;
break;
@@ -441,7 +446,7 @@
break;
- // Below: xpath grammar unit not implemented yet
+ // Below: xpath grammar unit not implemented yet
case XPathTreeConstants.JJTMATCHPATTERN:
case XPathTreeConstants.JJTPATTERN:
case XPathTreeConstants.JJTPATHPATTERN:
@@ -490,12 +495,16 @@
/**
* DOCUMENT ME!
*/
- public void jjtOpen() {}
+ public void jjtOpen()
+ {
+ }
/**
* DOCUMENT ME!
*/
- public void jjtClose() {}
+ public void jjtClose()
+ {
+ }
/**
* DOCUMENT ME!
@@ -504,7 +513,7 @@
*/
public void jjtSetParent(Node n)
{
- parent = n;
+ // nothing
}
/**
@@ -514,7 +523,7 @@
*/
public Node jjtGetParent()
{
- return parent;
+ return null;
}
/**
@@ -525,18 +534,18 @@
*/
public void jjtAddChild(Node n, int i)
{
- if (children == null)
+ if (m_children == null)
{
- children = new Node[i + 1];
+ m_children = new Node[i + 1];
}
- else if (i >= children.length)
+ else if (i >= m_children.length)
{
Node[] c = new Node[i + 1];
- System.arraycopy(children, 0, c, 0, children.length);
- children = c;
+ System.arraycopy(m_children, 0, c, 0, m_children.length);
+ m_children = c;
}
- children[i] = n;
+ m_children[i] = n;
}
/**
@@ -546,18 +555,18 @@
*/
public void jjtInsertChild(Node n)
{
- if (children == null)
+ if (m_children == null)
{
- children = new Node[1];
+ m_children = new Node[1];
}
else
{
- Node[] c = new Node[children.length + 1];
- System.arraycopy(children, 0, c, 1, children.length);
- children = c;
+ Node[] c = new Node[m_children.length + 1];
+ System.arraycopy(m_children, 0, c, 1, m_children.length);
+ m_children = c;
}
- children[0] = n;
+ m_children[0] = n;
}
/**
@@ -567,23 +576,61 @@
*/
public void jjtInsertNodeChildren(Node sn)
{
- Node[] n = ((SimpleNode) sn).children;
+ Node[] n = ((SimpleNode) sn).m_children;
if (n != null)
{
- if (children == null)
+ if (m_children == null)
{
- children = new Node[n.length];
+ m_children = new Node[n.length];
}
else
{
- Node[] c = new Node[children.length + n.length];
- System.arraycopy(children, 0, c, n.length, children.length);
- children = c;
+ Node[] c = new Node[m_children.length + n.length];
+ System.arraycopy(m_children, 0, c, n.length,
m_children.length);
+ m_children = c;
}
- System.arraycopy(n, 0, children, 0, n.length);
+ System.arraycopy(n, 0, m_children, 0, n.length);
+ }
+ }
+
+ /**
+ * Remove the given node form the list of children
+ *
+ * @param child DOCUMENT ME!
+ *
+ * @return The node that has been removed or null whether the given node
+ * doesn't belong to the child list
+ */
+ protected Node jjtRemoveChild(Node child)
+ {
+ if ((m_children == null) || (m_children.length == 0))
+ {
+ return null;
+ }
+
+ for (int i = 0; i < m_children.length; i++)
+ {
+ if (m_children[i] == child)
+ {
+ // remove
+ Node[] c = new Node[m_children.length - 1];
+ if ( i > 0 )
+ {
+ System.arraycopy(m_children, 0, c, 0, i);
+ }
+ if ( i < m_children.length )
+ {
+ System.arraycopy(m_children, i + 1, c, i,
m_children.length - i - 1);
+ }
+ m_children = c;
+
+ return child;
+ }
}
+
+ return null;
}
/**
@@ -595,7 +642,7 @@
*/
public Node jjtGetChild(int i)
{
- return children[i];
+ return m_children[i];
}
/**
@@ -605,7 +652,7 @@
*/
public int jjtGetNumChildren()
{
- return (children == null) ? 0 : children.length;
+ return (m_children == null) ? 0 : m_children.length;
}
/**
@@ -631,11 +678,11 @@
*/
public Object childrenAccept(XPathVisitor visitor, Object data)
{
- if (children != null)
+ if (m_children != null)
{
- for (int i = 0; i < children.length; ++i)
+ for (int i = 0; i < m_children.length; ++i)
{
- children[i].jjtAccept(visitor, data);
+ m_children[i].jjtAccept(visitor, data);
}
}
@@ -655,11 +702,13 @@
*
* @param token
*/
- public void processToken(Token token) {}
+ public void processToken(Token token)
+ {
+ }
/**
- *
- */
+ *
+ */
public boolean canBeReduced()
{
return false;
@@ -703,11 +752,11 @@
{
out.println(toString(prefix));
- if (children != null)
+ if (m_children != null)
{
- for (int i = 0; i < children.length; ++i)
+ for (int i = 0; i < m_children.length; ++i)
{
- SimpleNode n = (SimpleNode) children[i];
+ SimpleNode n = (SimpleNode) m_children[i];
if (n != null)
{
@@ -723,5 +772,7 @@
* @param expr DOCUMENT ME!
* @param abbreviate DOCUMENT ME!
*/
- public void getString(StringBuffer expr, boolean abbreviate) {}
+ public void getString(StringBuffer expr, boolean abbreviate)
+ {
+ }
}
1.1.2.2 +0 -1
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/QNameWrapper.java
Index: QNameWrapper.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/QNameWrapper.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- QNameWrapper.java 26 Mar 2003 21:27:21 -0000 1.1.2.1
+++ QNameWrapper.java 27 Mar 2003 21:53:25 -0000 1.1.2.2
@@ -84,7 +84,6 @@
*/
public QNameWrapper(XPath p, int i) {
super(p, i);
- //m_prefixResolver = p.m_prefixResolver;
}
/**
1.1.2.2 +1 -1
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/Predicates.java
Index: Predicates.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/Predicates.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- Predicates.java 13 Mar 2003 20:28:15 -0000 1.1.2.1
+++ Predicates.java 27 Mar 2003 21:53:25 -0000 1.1.2.2
@@ -87,7 +87,7 @@
*/
public void jjtAddChild(Node n, int i)
{
- int last = (children == null) ? 0 : children.length;
+ int last = (m_children == null) ? 0 : m_children.length;
if (((SimpleNode) n).canBeReduced())
{
No revision
No revision
1.1.2.6 +6 -0
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/test/Attic/TestSamples.java
Index: TestSamples.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/test/Attic/TestSamples.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- TestSamples.java 27 Mar 2003 15:11:27 -0000 1.1.2.5
+++ TestSamples.java 27 Mar 2003 21:53:25 -0000 1.1.2.6
@@ -166,6 +166,12 @@
+ pathExpr.getString(true));
System.out.println("/child::toto[50]/descendant::titi =? "
+ pathExpr.getString(false));
+
+ pathExpr.removeOperand(se);
+ System.out.println("/descendant::titi =? "
+ +
pathExpr.getString(true));
+
System.out.println("/descendant::titi =? "
+ +
pathExpr.getString(false));
// Test visitor - anonymous class used
pathExpr.visit(new Visitor()
1.1.2.7 +4 -4
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/test/Attic/TestSamples.xml
Index: TestSamples.xml
===================================================================
RCS file:
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/test/Attic/TestSamples.xml,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- TestSamples.xml 27 Mar 2003 15:11:27 -0000 1.1.2.6
+++ TestSamples.xml 27 Mar 2003 21:53:25 -0000 1.1.2.7
@@ -918,7 +918,7 @@
<!-- For expr -->
- <expr value="for $a in a return b">
+ <!--expr value="for $a in a return b">
<ast>
<node name="ExprSequence">
<node name="FLWRExpr">
@@ -965,11 +965,11 @@
</node>
</node>
</ast>
- </expr>
+ </expr-->
<!-- Quantified expr -->
- <expr value="some $a in a satisfies b">
+ <!--expr value="some $a in a satisfies b">
<ast>
<node name="ExprSequence">
<node name="QuantifiedExpr">
@@ -987,7 +987,7 @@
</node>
</node>
</ast>
- </expr>
+ </expr-->
<!-- Semantically invalid expression (parser should return an error)
-->
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]