villard     2003/07/11 12:09:26

  Modified:    java/xpath_rwapi/src2/org/apache/xpath/test Tag: xslt20
                        TestAST.java TestSamples.java
               java/xpath_rwapi/src2/org/apache/xpath/impl Tag: xslt20
                        ExpressionFactoryImpl.java FunctionCallImpl.java
               java/xpath_rwapi/src2/org/apache/xpath/expression Tag:
                        xslt20 ForAndQuantifiedExpr.java
                        ExpressionFactory.java
               java/xpath_rwapi/src2/org/apache/xpath/impl/parser Tag:
                        xslt20 XPath.java
  Log:
  Add createFunctionCall(QName) in ExpressionFactory interface and implement it 
in ExpressionFactoryImpl
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +1 -4      
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/test/Attic/TestAST.java
  
  Index: TestAST.java
  ===================================================================
  RCS file: 
/home/cvs//xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/test/Attic/TestAST.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- TestAST.java      13 Mar 2003 20:28:18 -0000      1.1.2.1
  +++ TestAST.java      11 Jul 2003 19:09:26 -0000      1.1.2.2
  @@ -56,13 +56,10 @@
   
   package org.apache.xpath.test;
   
  -import java.io.StringReader;
   import java.io.BufferedReader;
   import java.io.File;
   import java.io.FileReader;
  -import java.io.IOException;
  -import java.util.Properties;
  -import java.util.Vector;
  +import java.io.StringReader;
   
   import org.apache.xpath.expression.Expr;
   import org.apache.xpath.impl.parser.ParseException;
  
  
  
  1.1.2.9   +6 -28     
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.8
  retrieving revision 1.1.2.9
  diff -u -r1.1.2.8 -r1.1.2.9
  --- TestSamples.java  10 Jun 2003 19:17:23 -0000      1.1.2.8
  +++ TestSamples.java  11 Jul 2003 19:09:26 -0000      1.1.2.9
  @@ -55,11 +55,16 @@
    */
   package org.apache.xpath.test;
   
  +import java.io.StringReader;
  +import java.math.BigInteger;
  +
  +import javax.xml.parsers.DocumentBuilder;
  +import javax.xml.parsers.DocumentBuilderFactory;
  +
   import org.apache.xpath.XPathFactory;
   import org.apache.xpath.expression.CastableAsExpr;
   import org.apache.xpath.expression.ConditionalExpr;
   import org.apache.xpath.expression.Expr;
  -import org.apache.xpath.expression.ExprContext;
   import org.apache.xpath.expression.ExpressionFactory;
   import org.apache.xpath.expression.ForAndQuantifiedExpr;
   import org.apache.xpath.expression.InstanceOfExpr;
  @@ -70,27 +75,16 @@
   import org.apache.xpath.expression.StepExpr;
   import org.apache.xpath.expression.Variable;
   import org.apache.xpath.expression.Visitor;
  -import org.apache.xpath.impl.ExprContextImpl;
   import org.apache.xpath.impl.parser.ParseException;
   import org.apache.xpath.impl.parser.SimpleNode;
   import org.apache.xpath.impl.parser.XPath;
   import org.apache.xpath.impl.parser.XPathTreeConstants;
  -import org.apache.xpath.objects.XObject;
  -
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
  -
   import org.xml.sax.InputSource;
   
  -import java.io.StringReader;
  -
  -import java.math.BigInteger;
  -
  -import javax.xml.parsers.DocumentBuilder;
  -import javax.xml.parsers.DocumentBuilderFactory;
  -
   
   /**
    * Simple unit test for various samples; adhoc.
  @@ -181,22 +175,6 @@
               
               Expr var = exprFct.createExpr("$var");
               var.visit(new TestVisitor());
  -
  -            // Simple Evaluation check
  -            //Evaluator eval = 
XPathFactory.newInstance().newEvaluatorFactory()
  -            //                             .createEvaluator();
  -            XalanEvaluator eval = new XalanEvaluator();
  -
  -            ExprContextImpl ctx = eval.createExprContext();
  -
  -            
//ctx.getDynamicContext().setContextItem(doc.getDocumentElement());
  -            ctx.setContextItem(doc.getDocumentElement());
  -
  -            // exprs
  -            Expr e = exprFct.createExpr("expr[2]/@value");
  -            Object res = eval.evaluate(ctx, e);
  -
  -            System.out.println("-5 ?= " + ((XObject) res).str());
           }
           catch (Exception e)
           {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.7   +8 -0      
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.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- ExpressionFactoryImpl.java        24 Jun 2003 21:09:07 -0000      1.1.2.6
  +++ ExpressionFactoryImpl.java        11 Jul 2003 19:09:26 -0000      1.1.2.7
  @@ -59,6 +59,7 @@
   import java.math.BigDecimal;
   import java.math.BigInteger;
   
  +import org.apache.xml.QName;
   import org.apache.xpath.XPathException;
   import org.apache.xpath.datamodel.SequenceType;
   import org.apache.xpath.expression.CastOrTreatAsExpr;
  @@ -66,6 +67,7 @@
   import org.apache.xpath.expression.Expr;
   import org.apache.xpath.expression.ExpressionFactory;
   import org.apache.xpath.expression.ForAndQuantifiedExpr;
  +import org.apache.xpath.expression.FunctionCall;
   import org.apache.xpath.expression.Literal;
   import org.apache.xpath.expression.NodeTest;
   import org.apache.xpath.expression.OperatorExpr;
  @@ -255,6 +257,12 @@
         */
        public OperatorExpr createSequence() {
                return new OperatorImpl(XPathTreeConstants.JJTEXPRSEQUENCE);
  +     }
  +
  +     
  +     public FunctionCall createFunctionCall(QName name)
  +     {
  +             return new FunctionCallImpl(name);
        }
   
   
  
  
  
  1.1.2.7   +11 -0     
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.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- FunctionCallImpl.java     2 Jul 2003 01:58:24 -0000       1.1.2.6
  +++ FunctionCallImpl.java     11 Jul 2003 19:09:26 -0000      1.1.2.7
  @@ -93,6 +93,17 @@
        public FunctionCallImpl(XPath p, int i) {
                super(p, i);
        }
  +     
  +     /**
  +      * Constructor for FunctionCallImpl with specified name
  +      */
  +     protected FunctionCallImpl(QName name)
  +     {
  +             super(XPathTreeConstants.JJTFUNCTIONCALL);
  +             
  +             m_qname = name;
  +     }
  +     
   
        /**
         * Clone FunctionCall
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +0 -1      
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/ForAndQuantifiedExpr.java
  
  Index: ForAndQuantifiedExpr.java
  ===================================================================
  RCS file: 
/home/cvs//xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/ForAndQuantifiedExpr.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- ForAndQuantifiedExpr.java 13 Mar 2003 20:28:17 -0000      1.1.2.1
  +++ ForAndQuantifiedExpr.java 11 Jul 2003 19:09:26 -0000      1.1.2.2
  @@ -55,7 +55,6 @@
    */
   package org.apache.xpath.expression;
   
  -import org.apache.xpath.XPathException;
   
   /**
    * Represents for and quantified expressions.
  
  
  
  1.1.2.6   +29 -23    
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/ExpressionFactory.java
  
  Index: ExpressionFactory.java
  ===================================================================
  RCS file: 
/home/cvs//xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/ExpressionFactory.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- ExpressionFactory.java    24 Jun 2003 21:09:08 -0000      1.1.2.5
  +++ ExpressionFactory.java    11 Jul 2003 19:09:26 -0000      1.1.2.6
  @@ -55,6 +55,7 @@
    */
   package org.apache.xpath.expression;
   
  +import org.apache.xml.QName;
   import org.apache.xpath.XPathException;
   import org.apache.xpath.datamodel.SequenceType;
   import org.apache.xpath.impl.parser.NodeFactory;
  @@ -70,10 +71,9 @@
   public interface ExpressionFactory
   {
       /**
  -     * Create a new XPath expression from a string representation
  +     * Creates a new XPath expression from a string representation
        *
        * @return A XPath expression
  -     *
        * @throws XPathException whenever the given expression isn't a valid 
XPath
        *         expression
        */
  @@ -86,28 +86,27 @@
        public OperatorExpr createSequence();
   
       /**
  -     * Create a new relative or absolute path expression
  -     *
  +     * Creates a new relative or absolute path expression
        * @return An XPath expression of type 'path'
        */
       public PathExpr createPathExpr(boolean isAbsolute);
   
       /**
  -     * Create a new step. This step contains no qualifier.
  +     * Creates a new step. This step contains no qualifier.
        *
        * @return A step
        */
       public StepExpr createStepExpr(short axisType, NodeTest nodeTest);
   
       /**
  -     * Create a name test.
  +     * Creates a name test.
        *
        * @return A name test
        */
       public NodeTest createNameTest(String namespace, String name);
   
       /**
  -     * Create a new combining expression of the given type
  +     * Creates a new combining expression of the given type
        *
        * @param type The type of the combining expression to create.
        *
  @@ -120,23 +119,22 @@
       public OperatorExpr createCombineExpr(short type);
   
       /**
  -     * Create a new quantifier expression of type 'some' with one clause
  +     * Creates a new quantifier expression of type 'some' with one clause
        *
        * @param clause First clause of the new quantifier expression
  -     *
        * @return An XPath expression of type 'some'
        */
       public ForAndQuantifiedExpr createSomeExpr(Expr clause);
   
       /**
  -     * Create a quantifier expression of type 'every'  with one clause
  +     * Creates a quantifier expression of type 'every'  with one clause
        *
        * @return An XPath expression of type 'every'
        */
       public ForAndQuantifiedExpr createEveryExpr(Expr clause);
   
       /**
  -     * Create a logical expression of type 'and' with at least two operands
  +     * Creates a logical expression of type 'and' with at least two operands
        *
        * @param operand1 XPath expression to compose
        * @param operand2 XPath expression to compose
  @@ -146,7 +144,7 @@
       public OperatorExpr createAndExpr(Expr operand1, Expr operand2);
   
       /**
  -     * Create a new logical expression of type 'or' with at least two 
operands
  +     * Creates a new logical expression of type 'or' with at least two 
operands
        *
        * @param operand1 XPath expression to compose
        * @param operand2 XPath expression to compose
  @@ -156,7 +154,7 @@
       public OperatorExpr createOrExpr(Expr operand1, Expr operand2);
   
       /**
  -     * Create a new conditional expression
  +     * Creates a new conditional expression
        *
        * @param test The boolean XPath expression
        * @param thenExpr The XPath expression uses in the then clause
  @@ -167,7 +165,7 @@
       public ConditionalExpr createIfExpr(Expr test, Expr thenExpr, Expr 
elseExpr);
   
       /**
  -     * Create a new for expression
  +     * Creates a new 'for' expression
        *
        * @param varName The name of the binding variable
        * @param clauseExpr The for clause expression
  @@ -179,7 +177,7 @@
           Expr quantifiedExpr);
   
       /**
  -     * Create a new cast as expression
  +     * Creates a new cast as expression
        *
        * @param seqType The cast as type
        * @param parExpr The XPath expression to cast as
  @@ -190,7 +188,7 @@
           OperatorExpr parExpr);
   
       /**
  -     * Create a new treat as expression
  +     * Creates a new treat as expression
        *
        * @param seqType The treat as type
        * @param parExpr The XPath expression to treat as
  @@ -201,14 +199,14 @@
           OperatorExpr parExpr);
   
       /**
  -     * Create a new integer literal
  +     * Creates a new integer literal
        *
        * @return A literal of type integer
        */
       public Literal createIntegerLiteralExpr(int value);
   
       /**
  -     * Create a new 'big' integer literal
  +     * Creates a new 'big' integer literal
        *
        * @param value The big integer
        *
  @@ -217,35 +215,43 @@
       public Literal createIntegerLiteralExpr(BigInteger value);
   
       /**
  -     * Create a new decimal literal
  +     * Creates a new decimal literal
        *
        * @return A literal of type decimal
        */
       public Literal createDecimalLiteralExpr(double value);
   
       /**
  -     * Create a new 'big' decimal literal
  +     * Creates a new 'big' decimal literal
        *
        * @return A literal of type decimal
        */
       public Literal createDecimalLiteralExpr(BigDecimal value);
   
       /**
  -     * Create a new string literal
  +     * Creates a new string literal
        *
        * @return A literal of type string
        */
       public Literal createStringLiteralExpr(String value);
   
       /**
  -     * Create a new double literal
  +     * Creates a new double literal
        *
        * @return A literal of type double
        */
       public Literal createDoubleLiteralExpr(double value);
       
       /**
  -     * Sets the node factory for creating AST nodes
  +     * Creates new function call expression with the specified name
  +     * and no parameter. 
  +     * @param name Qualified name of the function to create 
  +     * @return
  +     */
  +    public FunctionCall createFunctionCall(QName name);
  +    
  +    /**
  +     * Sets the node factory to use for creating AST nodes
        */
       void setNodeFactory(NodeFactory factory);
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.6   +1 -2      
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/XPath.java
  
  Index: XPath.java
  ===================================================================
  RCS file: 
/home/cvs//xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/XPath.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- XPath.java        26 Mar 2003 21:27:21 -0000      1.1.2.5
  +++ XPath.java        11 Jul 2003 19:09:26 -0000      1.1.2.6
  @@ -7,8 +7,7 @@
   public class XPath/[EMAIL PROTECTED](jjtree)*/implements XPathTreeConstants, 
XPathConstants {/[EMAIL PROTECTED](jjtree)*/
     protected JJTXPathState jjtree = new JJTXPathState();
       // Begin generated by etree.xsl:extra-parser-code 
  -    org.apache.xpath.patterns.FunctionPattern m_matchFunc = null; // short 
lived.
  -
  +  
       int m_predLevel = 0;
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to