villard     2003/07/29 14:12:31

  Modified:    java/xpath_rwapi/src2/org/apache/xpath Tag: xslt20
                        XPathUtilities.java
               java/xpath_rwapi/src2/org/apache/xpath/expression Tag:
                        xslt20 OperatorExpr.java package.html Expr.java
                        ExpressionFactory.java
               java/xpath_rwapi/src2/org/apache/xpath/impl Tag: xslt20
                        ExpressionFactoryImpl.java
               java/xpath_rwapi/src2/org/apache/xpath/impl/parser Tag:
                        xslt20 SimpleNode.java
  Added:       java/xpath_rwapi/src2/org/apache/xpath/expression Tag:
                        xslt20 LetExpr.java
               java/xpath_rwapi/src2/org/apache/xpath/impl Tag: xslt20
                        LetExprImpl.java
  Log:
  Append Let expression in the interface. Provide a basic implementation. No 
parsing.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +59 -51    
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/Attic/XPathUtilities.java
  
  Index: XPathUtilities.java
  ===================================================================
  RCS file: 
/home/cvs//xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/Attic/XPathUtilities.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- XPathUtilities.java       14 Jul 2003 18:28:38 -0000      1.1.2.3
  +++ XPathUtilities.java       29 Jul 2003 21:12:31 -0000      1.1.2.4
  @@ -85,62 +85,70 @@
                // TODO: patterns are not supported by the XPath API yet
                // it means that pattern may be embedded in sequence
                boolean result;
  -             switch (expr.getExprType())
  +             try
                {
  -                     case Expr.SEQUENCE_EXPR :
  -                             OperatorExpr op = (OperatorExpr) expr;
  -                             switch (op.getOperatorType())
  -                             {
  -                                     case OperatorExpr.COMMA :
  -
  -                                             if (op.getOperandCount() == 1)
  -                                             {
  -                                                     result = 
isMatchDocumentNode(op.getOperand(0));
  -                                             } else
  -                                             {
  +                     switch (expr.getExprType())
  +                     {
  +                             case Expr.SEQUENCE_EXPR :
  +                                     OperatorExpr op = (OperatorExpr) expr;
  +                                     switch (op.getOperatorType())
  +                                     {
  +                                             case OperatorExpr.COMMA :
  +                     
  +                                                     if 
(op.getOperandCount() == 1)
  +                                                     {
  +                                                             result = 
isMatchDocumentNode(op.getOperand(0));
  +                                                     } else
  +                                                     {
  +                                                             result = false;
  +                                                     }
  +                                                     break;
  +                                             case OperatorExpr.UNION_COMBINE 
:
                                                        result = false;
  -                                             }
  -                                             break;
  -                                     case OperatorExpr.UNION_COMBINE :
  -                                             result = false;
  -                                             for (int i = 
op.getOperandCount() - 1; i >= 0; i--)
  -                                             {
  -                                                     if 
(isMatchDocumentNode(op.getOperand(i)))
  +                                                     for (int i = 
op.getOperandCount() - 1; i >= 0; i--)
                                                        {
  -                                                             result = true;
  -                                                             break;
  +                                                             if 
(isMatchDocumentNode(op.getOperand(i)))
  +                                                             {
  +                                                                     result 
= true;
  +                                                                     break;
  +                                                             }
                                                        }
  -                                             }
  -                                             break;
  -                                     default :
  +                                                     break;
  +                                             default :
  +                                                     result = false;
  +                                     }
  +                                     break;
  +                             case Expr.PATH_EXPR :
  +                                     PathExpr p = (PathExpr) expr;
  +                                     // TODO: revisit after implementation 
of fn:root(...)=> operandCount == 1
  +                                             result =
  +                                                     (p.isAbsolute() && 
p.getOperandCount() == 0) // '/'
  +                     || (p.getOperandCount() == 1 && 
isMatchDocumentNode(p.getOperand(0)));
  +                     
  +                                     break;
  +                             case Expr.STEP :
  +                                     StepExpr s = (StepExpr) expr;
  +                                     try
  +                                     {
  +                                             result =
  +                                                     
s.getNodeTest().isKindTest()
  +                                                             && 
s.getNodeTest().getKindTest()
  +                                                                     == 
NodeTest.ANY_KIND_TEST;
  +                                     } catch (XPathException e)
  +                                     {
  +                                             // impossible
                                                result = false;
  -                             }
  -                             break;
  -                     case Expr.PATH_EXPR :
  -                             PathExpr p = (PathExpr) expr;
  -                             // TODO: revisit after implementation of 
fn:root(...)=> operandCount == 1
  -                                     result =
  -                                             (p.isAbsolute() && 
p.getOperandCount() == 0) // '/'
  -     || (p.getOperandCount() == 1 && isMatchDocumentNode(p.getOperand(0)));
  -
  -                             break;
  -                     case Expr.STEP :
  -                             StepExpr s = (StepExpr) expr;
  -                             try
  -                             {
  -                                     result =
  -                                             s.getNodeTest().isKindTest()
  -                                                     && 
s.getNodeTest().getKindTest()
  -                                                             == 
NodeTest.ANY_KIND_TEST;
  -                             } catch (XPathException e)
  -                             {
  -                                     // impossible
  +                                     }
  +                                     break;
  +                     
  +                             default :
                                        result = false;
  -                             }
  -                             break;
  -
  -                     default :
  -                             result = false;
  +                     }
  +             } catch (XPathException e)
  +             {
  +                     // Bug
  +                     e.printStackTrace();
  +                     result = false;
                }
                return result;
        }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.6   +4 -3      
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/OperatorExpr.java
  
  Index: OperatorExpr.java
  ===================================================================
  RCS file: 
/home/cvs//xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/OperatorExpr.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- OperatorExpr.java 25 Jul 2003 15:23:48 -0000      1.1.2.5
  +++ OperatorExpr.java 29 Jul 2003 21:12:31 -0000      1.1.2.6
  @@ -302,9 +302,8 @@
   
       /**
        * Gets the operand at the ith position.
  -     * @throws IndexOutOfBoundsException
        */
  -    Expr getOperand(int i);
  +    Expr getOperand(int i) throws XPathException;
   
       /**
        * Gets the operand count
  @@ -313,6 +312,8 @@
   
       /**
        * Append an operand at the end of this expression.
  +     * @throws XPathException when the specified operand do not match
  +     * the operator type
        */
       void addOperand(Expr operand) throws XPathException;
   
  @@ -323,7 +324,7 @@
   
        // TODO
        // void setOperand(Expr operand)
  -     // void insertOperand(Expr operant, int i)      
  +     // void insertOperand(int i, Expr operant)      
       
       /**
        * Append the specified expr at the end of this expression. 
  
  
  
  1.1.2.3   +5 -2      
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/package.html
  
  Index: package.html
  ===================================================================
  RCS file: 
/home/cvs//xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/package.html,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- package.html      25 Jul 2003 15:46:09 -0000      1.1.2.2
  +++ package.html      29 Jul 2003 21:12:31 -0000      1.1.2.3
  @@ -17,8 +17,11 @@
   performed by using either the visitor pattern or the get-like methods.
   Similarly, the</span><span style="font-weight: normal;"> expression 
</span><span
    style="font-weight: normal;">writing is done through a bunch of
  -set-like methods.</span><br>
  -  </li>
  +set-like methods.</span></li>
  +  <li style="font-weight: bold;"><span style="font-weight: normal;"><span
  + style="font-weight: bold;">Round-trip: </span>capability of getting
  +string representation of expressions from its internal encoding.<br>
  +    </span></li>
     <li><span style="font-weight: bold;">Application-independent</span>:
   it should be suitable to be used by a variety of applications
   efficiently.<span style="font-weight: bold;"> </span>It should provide
  
  
  
  1.1.2.6   +8 -2      
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/Expr.java
  
  Index: Expr.java
  ===================================================================
  RCS file: 
/home/cvs//xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/Expr.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- Expr.java 14 Jul 2003 18:28:38 -0000      1.1.2.5
  +++ Expr.java 29 Jul 2003 21:12:31 -0000      1.1.2.6
  @@ -174,7 +174,7 @@
    * The number of steps is 3 (and not 2). 
    * </p> 
    * <p>
  - * An [EMAIL PROTECTED] Expr} object may be not a valid XPath expression but 
a only a fragment.
  + * An [EMAIL PROTECTED] Expr} object may be not a valid XPath expression but 
only a fragment.
    * For example a [EMAIL PROTECTED] StepExpr} expression is a fragment but 
can't be executed by
    * itself. To be valid, the top level expression must be an expression 
sequence.
    * </p>
  @@ -283,6 +283,12 @@
         * The expression is a treat as expression
         */
        static final short TREAT_AS_EXPR = 22;
  +
  +     /**
  +      * The expression is a let expression
  +      */
  +     static final short LET_EXPR = 23;
  +
   
        /**
         * Gets the expression type. 
  
  
  
  1.1.2.10  +11 -3     
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.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- ExpressionFactory.java    25 Jul 2003 20:16:26 -0000      1.1.2.9
  +++ ExpressionFactory.java    29 Jul 2003 21:12:31 -0000      1.1.2.10
  @@ -248,9 +248,17 @@
         * @param ns or null
         * @param localPart
         * @param prefix or null
  -      * @return
  +      * @return A new QName or an existing one with the same namespace and 
localpart
         */
        public QName createQName(String ns, String localPart, String prefix);
       
  -
  +     /**
  +      * Creates a [EMAIL PROTECTED] LetExpr} with one initial clause
  +      * @param varname of the initial clause
  +      * @param type of the variable (can be null)
  +      * @param expr of the initial clause
  +      * @return
  +      */
  +     public LetExpr createLetExpr(QName varname, SequenceType type, Expr 
expr);
  +     
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +135 -0    
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/LetExpr.java
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.10  +6 -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.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- ExpressionFactoryImpl.java        25 Jul 2003 20:16:25 -0000      1.1.2.9
  +++ ExpressionFactoryImpl.java        29 Jul 2003 21:12:31 -0000      1.1.2.10
  @@ -68,6 +68,7 @@
   import org.apache.xpath.expression.ExpressionFactory;
   import org.apache.xpath.expression.ForAndQuantifiedExpr;
   import org.apache.xpath.expression.FunctionCall;
  +import org.apache.xpath.expression.LetExpr;
   import org.apache.xpath.expression.Literal;
   import org.apache.xpath.expression.NodeTest;
   import org.apache.xpath.expression.OperatorExpr;
  @@ -251,6 +252,11 @@
        public QName createQName(String ns, String localPart, String prefix)
        {
                return new QName(ns, localPart, prefix);
  +     }
  +
  +     public LetExpr createLetExpr(QName varname, SequenceType type, Expr 
expr)
  +     {
  +             return new LetExprImpl(varname, type, expr);
        }
   
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +177 -0    
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/Attic/LetExprImpl.java
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.12  +1 -1      
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.11
  retrieving revision 1.1.2.12
  diff -u -r1.1.2.11 -r1.1.2.12
  --- SimpleNode.java   25 Jul 2003 20:16:26 -0000      1.1.2.11
  +++ SimpleNode.java   29 Jul 2003 21:12:31 -0000      1.1.2.12
  @@ -20,7 +20,7 @@
   /**
    * Representation of an XPath AST node.
    */
  -public class SimpleNode implements Node
  +public class SimpleNode implements Node, Cloneable
   {
       public static boolean PRODUCE_RAW_TREE = false;
       
  
  
  

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

Reply via email to