villard     2003/03/24 09:35:06

  Modified:    java/xpath_rwapi/src2/org/apache/xpath/impl/parser Tag:
                        xslt20 xpath-grammar.jj XPathVisitor.java
                        xpath-grammar.jjt XPath.java
                        XPathTreeConstants.java SimpleNode.java
               java/xpath_rwapi/src2/org/apache/xpath/expression Tag:
                        xslt20 ConditionalExpr.java Literal.java
               java/xpath_rwapi/src2/org/apache/xpath/test Tag: xslt20
                        TestSamples.xml TestSamples.java
               java/xpath_rwapi/src2/org/apache/xpath/impl Tag: xslt20
                        ConditionalExprImpl.java
  Log:
  - Add setter methods in ConditionalExpr class
  - Implementation of conditional expression
  - Add samples
  - Add xalan.jar in the classpath within build2.xml
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +2 -56     
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/xpath-grammar.jj
  
  Index: xpath-grammar.jj
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/xpath-grammar.jj,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- xpath-grammar.jj  13 Mar 2003 20:28:16 -0000      1.1.2.1
  +++ xpath-grammar.jj  24 Mar 2003 17:35:04 -0000      1.1.2.2
  @@ -1,4 +1,4 @@
  -/[EMAIL PROTECTED](jjtree) Generated By:JJTree: Do not edit this line. 
E:/ast/xpath_rwapi/src2/org/apache/xpath/impl/parser\xpath-grammar.jj */
  +/[EMAIL PROTECTED](jjtree) Generated By:JJTree: Do not edit this line. 
C:/data/projects/xml-xalan-xslt20/java/xpath_rwapi/src2/org/apache/xpath/impl/parser\xpath-grammar.jj
 */
   /[EMAIL PROTECTED]/options {
   
          
  @@ -1816,61 +1816,7 @@
   {/[EMAIL PROTECTED](jjtree) #IfExpr(> 1) */
     try {
   /[EMAIL PROTECTED]/
  -  (<IfLpar>/[EMAIL PROTECTED](jjtree) #IfLpar( true) */
  -           {
  -             SimpleNode jjtn001 = (SimpleNode)SimpleNode.jjtCreate(this, JJTIFLPAR);
  -             boolean jjtc001 = true;
  -             jjtree.openNodeScope(jjtn001);
  -           }
  -           try {
  -/[EMAIL PROTECTED]//[EMAIL PROTECTED](jjtree)*/
  -           {
  -             jjtree.closeNodeScope(jjtn001,  true);
  -             jjtc001 = false;
  -           }
  -/[EMAIL PROTECTED]/{jjtn001.processToken(token);}/[EMAIL PROTECTED](jjtree)*/
  -           } finally {
  -             if (jjtc001) {
  -               jjtree.closeNodeScope(jjtn001,  true);
  -             }
  -           }
  -/[EMAIL PROTECTED]/ Expr() <Rpar> <Then>/[EMAIL PROTECTED](jjtree) #Then( true) */
  -                                                                            {
  -                                                                              
SimpleNode jjtn002 = (SimpleNode)SimpleNode.jjtCreate(this, JJTTHEN);
  -                                                                              
boolean jjtc002 = true;
  -                                                                              
jjtree.openNodeScope(jjtn002);
  -                                                                            }
  -                                                                            try {
  -/[EMAIL PROTECTED]//[EMAIL PROTECTED](jjtree)*/
  -                                                                            {
  -                                                                              
jjtree.closeNodeScope(jjtn002,  true);
  -                                                                              
jjtc002 = false;
  -                                                                            }
  -/[EMAIL PROTECTED]/{jjtn002.processToken(token);}/[EMAIL PROTECTED](jjtree)*/
  -                                                                            } 
finally {
  -                                                                              if 
(jjtc002) {
  -                                                                                
jjtree.closeNodeScope(jjtn002,  true);
  -                                                                              }
  -                                                                            }
  -/[EMAIL PROTECTED]/ Expr() <Else>/[EMAIL PROTECTED](jjtree) #Else( true) */
  -                                                                                    
                                                {
  -                                                                                    
                                                  SimpleNode jjtn003 = 
(SimpleNode)SimpleNode.jjtCreate(this, JJTELSE);
  -                                                                                    
                                                  boolean jjtc003 = true;
  -                                                                                    
                                                  jjtree.openNodeScope(jjtn003);
  -                                                                                    
                                                }
  -                                                                                    
                                                try {
  -/[EMAIL PROTECTED]//[EMAIL PROTECTED](jjtree)*/
  -                                                                                    
                                                {
  -                                                                                    
                                                  jjtree.closeNodeScope(jjtn003,  
true);
  -                                                                                    
                                                  jjtc003 = false;
  -                                                                                    
                                                }
  -/[EMAIL PROTECTED]/{jjtn003.processToken(token);}/[EMAIL PROTECTED](jjtree)*/
  -                                                                                    
                                                } finally {
  -                                                                                    
                                                  if (jjtc003) {
  -                                                                                    
                                                    jjtree.closeNodeScope(jjtn003,  
true);
  -                                                                                    
                                                  }
  -                                                                                    
                                                }
  -/[EMAIL PROTECTED]/)* InstanceofExpr()/[EMAIL PROTECTED](jjtree)*/
  +  (<IfLpar> Expr() <Rpar> <Then> Expr() <Else>)* InstanceofExpr()/[EMAIL 
PROTECTED](jjtree)*/
     } catch (Throwable jjte000) {
       if (jjtc000) {
         jjtree.clearNodeScope(jjtn000);
  
  
  
  1.1.2.2   +1 -1      
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/XPathVisitor.java
  
  Index: XPathVisitor.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/XPathVisitor.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- XPathVisitor.java 13 Mar 2003 20:28:16 -0000      1.1.2.1
  +++ XPathVisitor.java 24 Mar 2003 17:35:05 -0000      1.1.2.2
  @@ -1,4 +1,4 @@
  -/* Generated By:JJTree: Do not edit this line. 
E:/ast/xpath_rwapi/src2/org/apache/xpath/impl/parser\XPathVisitor.java */
  +/* Generated By:JJTree: Do not edit this line. 
C:/data/projects/xml-xalan-xslt20/java/xpath_rwapi/src2/org/apache/xpath/impl/parser\XPathVisitor.java
 */
   
   package org.apache.xpath.impl.parser;
   
  
  
  
  1.1.2.2   +1 -1      
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/xpath-grammar.jjt
  
  Index: xpath-grammar.jjt
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/xpath-grammar.jjt,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- xpath-grammar.jjt 13 Mar 2003 20:28:15 -0000      1.1.2.1
  +++ xpath-grammar.jjt 24 Mar 2003 17:35:05 -0000      1.1.2.2
  @@ -1133,7 +1133,7 @@
   void IfExpr() #IfExpr(> 1) :
   {}
   {
  -  (<IfLpar>{jjtThis.processToken(token);} #IfLpar(true) Expr() <Rpar> 
<Then>{jjtThis.processToken(token);} #Then(true) Expr() 
<Else>{jjtThis.processToken(token);} #Else(true))* InstanceofExpr()
  +  (<IfLpar> Expr() <Rpar> <Then> Expr() <Else>)* InstanceofExpr()
   }
   
   void InstanceofExpr() #InstanceofExpr(> 1) :
  
  
  
  1.1.2.2   +0 -36     
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.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- XPath.java        13 Mar 2003 20:28:15 -0000      1.1.2.1
  +++ XPath.java        24 Mar 2003 17:35:05 -0000      1.1.2.2
  @@ -1088,47 +1088,11 @@
             break label_7;
           }
           jj_consume_token(IfLpar);
  -             SimpleNode jjtn001 = (SimpleNode)SimpleNode.jjtCreate(this, JJTIFLPAR);
  -             boolean jjtc001 = true;
  -             jjtree.openNodeScope(jjtn001);
  -        try {
  -             jjtree.closeNodeScope(jjtn001,  true);
  -             jjtc001 = false;
  -            jjtn001.processToken(token);
  -        } finally {
  -             if (jjtc001) {
  -               jjtree.closeNodeScope(jjtn001,  true);
  -             }
  -        }
           Expr();
           jj_consume_token(Rpar);
           jj_consume_token(Then);
  -                                                                              
SimpleNode jjtn002 = (SimpleNode)SimpleNode.jjtCreate(this, JJTTHEN);
  -                                                                              
boolean jjtc002 = true;
  -                                                                              
jjtree.openNodeScope(jjtn002);
  -        try {
  -                                                                              
jjtree.closeNodeScope(jjtn002,  true);
  -                                                                              
jjtc002 = false;
  -                                                               
jjtn002.processToken(token);
  -        } finally {
  -                                                                              if 
(jjtc002) {
  -                                                                                
jjtree.closeNodeScope(jjtn002,  true);
  -                                                                              }
  -        }
           Expr();
           jj_consume_token(Else);
  -                                                                                    
                                                  SimpleNode jjtn003 = 
(SimpleNode)SimpleNode.jjtCreate(this, JJTELSE);
  -                                                                                    
                                                  boolean jjtc003 = true;
  -                                                                                    
                                                  jjtree.openNodeScope(jjtn003);
  -        try {
  -                                                                                    
                                                  jjtree.closeNodeScope(jjtn003,  
true);
  -                                                                                    
                                                  jjtc003 = false;
  -                                                                                    
                       jjtn003.processToken(token);
  -        } finally {
  -                                                                                    
                                                  if (jjtc003) {
  -                                                                                    
                                                    jjtree.closeNodeScope(jjtn003,  
true);
  -                                                                                    
                                                  }
  -        }
         }
         InstanceofExpr();
       } catch (Throwable jjte000) {
  
  
  
  1.1.2.2   +80 -86    
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/XPathTreeConstants.java
  
  Index: XPathTreeConstants.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/impl/parser/Attic/XPathTreeConstants.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- XPathTreeConstants.java   13 Mar 2003 20:28:15 -0000      1.1.2.1
  +++ XPathTreeConstants.java   24 Mar 2003 17:35:05 -0000      1.1.2.2
  @@ -1,4 +1,4 @@
  -/* Generated By:JJTree: Do not edit this line. 
E:/ast/xpath_rwapi/src2/org/apache/xpath/impl/parser\XPathTreeConstants.java */
  +/* Generated By:JJTree: Do not edit this line. 
C:/data/projects/xml-xalan-xslt20/java/xpath_rwapi/src2/org/apache/xpath/impl/parser\XPathTreeConstants.java
 */
   
   package org.apache.xpath.impl.parser;
   
  @@ -32,88 +32,85 @@
     public int JJTIN = 25;
     public int JJTSATISFIES = 26;
     public int JJTIFEXPR = 27;
  -  public int JJTIFLPAR = 28;
  -  public int JJTTHEN = 29;
  -  public int JJTELSE = 30;
  -  public int JJTINSTANCEOFEXPR = 31;
  -  public int JJTINSTANCEOF = 32;
  -  public int JJTCASTABLEEXPR = 33;
  -  public int JJTCASTABLE = 34;
  -  public int JJTCOMPARISONEXPR = 35;
  -  public int JJTRANGEEXPR = 36;
  -  public int JJTADDITIVEEXPR = 37;
  -  public int JJTMULTIPLICATIVEEXPR = 38;
  -  public int JJTUNARYEXPR = 39;
  -  public int JJTMINUS = 40;
  -  public int JJTPLUS = 41;
  -  public int JJTUNIONEXPR = 42;
  -  public int JJTINTERSECTEXCEPTEXPR = 43;
  -  public int JJTPATHEXPR = 44;
  -  public int JJTSTEPEXPR = 45;
  -  public int JJTVALIDATEEXPR = 46;
  -  public int JJTVALIDATELBRACE = 47;
  -  public int JJTVALIDATECONTEXT = 48;
  -  public int JJTSLASH = 49;
  -  public int JJTLBRACEEXPRENCLOSURE = 50;
  -  public int JJTRBRACE = 51;
  -  public int JJTCASTEXPR = 52;
  -  public int JJTCASTAS = 53;
  -  public int JJTTREATEXPR = 54;
  -  public int JJTTREATAS = 55;
  -  public int JJTAXISDESCENDANT = 56;
  -  public int JJTAXISSELF = 57;
  -  public int JJTAXISDESCENDANTORSELF = 58;
  -  public int JJTAXISFOLLOWINGSIBLING = 59;
  -  public int JJTAXISFOLLOWING = 60;
  -  public int JJTAXISNAMESPACE = 61;
  -  public int JJTAXISPARENT = 62;
  -  public int JJTAXISANCESTOR = 63;
  -  public int JJTAXISPRECEDINGSIBLING = 64;
  -  public int JJTAXISPRECEDING = 65;
  -  public int JJTAXISANCESTORORSELF = 66;
  -  public int JJTNODETEST = 67;
  -  public int JJTNAMETEST = 68;
  -  public int JJTQNAME = 69;
  -  public int JJTSTAR = 70;
  -  public int JJTNCNAMECOLONSTAR = 71;
  -  public int JJTSTARCOLONNCNAME = 72;
  -  public int JJTPROCESSINGINSTRUCTIONTEST = 73;
  -  public int JJTCOMMENTTEST = 74;
  -  public int JJTTEXTTEST = 75;
  -  public int JJTANYKINDTEST = 76;
  -  public int JJTDOT = 77;
  -  public int JJTDOTDOT = 78;
  -  public int JJTPREDICATES = 79;
  -  public int JJTINTEGERLITERAL = 80;
  -  public int JJTDECIMALLITERAL = 81;
  -  public int JJTDOUBLELITERAL = 82;
  -  public int JJTFUNCTIONCALL = 83;
  -  public int JJTSCHEMACONTEXT = 84;
  -  public int JJTINCONTEXT = 85;
  -  public int JJTSCHEMAGLOBALCONTEXT = 86;
  -  public int JJTTYPEQNAME = 87;
  -  public int JJTSCHEMACONTEXTSTEP = 88;
  -  public int JJTSINGLETYPE = 89;
  -  public int JJTQMARK = 90;
  -  public int JJTSEQUENCETYPE = 91;
  -  public int JJTEMPTY = 92;
  -  public int JJTITEMTYPE = 93;
  -  public int JJTELEMENTTYPE = 94;
  -  public int JJTATTRIBUTETYPE = 95;
  -  public int JJTNODE = 96;
  -  public int JJTPROCESSINGINSTRUCTION = 97;
  -  public int JJTCOMMENT = 98;
  -  public int JJTTEXT = 99;
  -  public int JJTDOCUMENT = 100;
  -  public int JJTITEM = 101;
  -  public int JJTUNTYPED = 102;
  -  public int JJTATOMICVALUE = 103;
  -  public int JJTELEMORATTRTYPE = 104;
  -  public int JJTSCHEMATYPE = 105;
  -  public int JJTOFTYPE = 106;
  -  public int JJTATOMICTYPE = 107;
  -  public int JJTOCCURRENCEINDICATOR = 108;
  -  public int JJTMULTIPLY = 109;
  +  public int JJTINSTANCEOFEXPR = 28;
  +  public int JJTINSTANCEOF = 29;
  +  public int JJTCASTABLEEXPR = 30;
  +  public int JJTCASTABLE = 31;
  +  public int JJTCOMPARISONEXPR = 32;
  +  public int JJTRANGEEXPR = 33;
  +  public int JJTADDITIVEEXPR = 34;
  +  public int JJTMULTIPLICATIVEEXPR = 35;
  +  public int JJTUNARYEXPR = 36;
  +  public int JJTMINUS = 37;
  +  public int JJTPLUS = 38;
  +  public int JJTUNIONEXPR = 39;
  +  public int JJTINTERSECTEXCEPTEXPR = 40;
  +  public int JJTPATHEXPR = 41;
  +  public int JJTSTEPEXPR = 42;
  +  public int JJTVALIDATEEXPR = 43;
  +  public int JJTVALIDATELBRACE = 44;
  +  public int JJTVALIDATECONTEXT = 45;
  +  public int JJTSLASH = 46;
  +  public int JJTLBRACEEXPRENCLOSURE = 47;
  +  public int JJTRBRACE = 48;
  +  public int JJTCASTEXPR = 49;
  +  public int JJTCASTAS = 50;
  +  public int JJTTREATEXPR = 51;
  +  public int JJTTREATAS = 52;
  +  public int JJTAXISDESCENDANT = 53;
  +  public int JJTAXISSELF = 54;
  +  public int JJTAXISDESCENDANTORSELF = 55;
  +  public int JJTAXISFOLLOWINGSIBLING = 56;
  +  public int JJTAXISFOLLOWING = 57;
  +  public int JJTAXISNAMESPACE = 58;
  +  public int JJTAXISPARENT = 59;
  +  public int JJTAXISANCESTOR = 60;
  +  public int JJTAXISPRECEDINGSIBLING = 61;
  +  public int JJTAXISPRECEDING = 62;
  +  public int JJTAXISANCESTORORSELF = 63;
  +  public int JJTNODETEST = 64;
  +  public int JJTNAMETEST = 65;
  +  public int JJTQNAME = 66;
  +  public int JJTSTAR = 67;
  +  public int JJTNCNAMECOLONSTAR = 68;
  +  public int JJTSTARCOLONNCNAME = 69;
  +  public int JJTPROCESSINGINSTRUCTIONTEST = 70;
  +  public int JJTCOMMENTTEST = 71;
  +  public int JJTTEXTTEST = 72;
  +  public int JJTANYKINDTEST = 73;
  +  public int JJTDOT = 74;
  +  public int JJTDOTDOT = 75;
  +  public int JJTPREDICATES = 76;
  +  public int JJTINTEGERLITERAL = 77;
  +  public int JJTDECIMALLITERAL = 78;
  +  public int JJTDOUBLELITERAL = 79;
  +  public int JJTFUNCTIONCALL = 80;
  +  public int JJTSCHEMACONTEXT = 81;
  +  public int JJTINCONTEXT = 82;
  +  public int JJTSCHEMAGLOBALCONTEXT = 83;
  +  public int JJTTYPEQNAME = 84;
  +  public int JJTSCHEMACONTEXTSTEP = 85;
  +  public int JJTSINGLETYPE = 86;
  +  public int JJTQMARK = 87;
  +  public int JJTSEQUENCETYPE = 88;
  +  public int JJTEMPTY = 89;
  +  public int JJTITEMTYPE = 90;
  +  public int JJTELEMENTTYPE = 91;
  +  public int JJTATTRIBUTETYPE = 92;
  +  public int JJTNODE = 93;
  +  public int JJTPROCESSINGINSTRUCTION = 94;
  +  public int JJTCOMMENT = 95;
  +  public int JJTTEXT = 96;
  +  public int JJTDOCUMENT = 97;
  +  public int JJTITEM = 98;
  +  public int JJTUNTYPED = 99;
  +  public int JJTATOMICVALUE = 100;
  +  public int JJTELEMORATTRTYPE = 101;
  +  public int JJTSCHEMATYPE = 102;
  +  public int JJTOFTYPE = 103;
  +  public int JJTATOMICTYPE = 104;
  +  public int JJTOCCURRENCEINDICATOR = 105;
  +  public int JJTMULTIPLY = 106;
   
   
     public String[] jjtNodeName = {
  @@ -145,9 +142,6 @@
       "In",
       "Satisfies",
       "IfExpr",
  -    "IfLpar",
  -    "Then",
  -    "Else",
       "InstanceofExpr",
       "Instanceof",
       "CastableExpr",
  
  
  
  1.1.2.2   +0 -3      
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.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- SimpleNode.java   13 Mar 2003 20:28:16 -0000      1.1.2.1
  +++ SimpleNode.java   24 Mar 2003 17:35:05 -0000      1.1.2.2
  @@ -355,9 +355,6 @@
               case XPathTreeConstants.JJTEVERY:
               case XPathTreeConstants.JJTIN:
               case XPathTreeConstants.JJTSATISFIES:
  -            case XPathTreeConstants.JJTIFLPAR:
  -            case XPathTreeConstants.JJTTHEN:
  -            case XPathTreeConstants.JJTELSE:
               case XPathTreeConstants.JJTINSTANCEOF: //31;
               case XPathTreeConstants.JJTINTERSECTEXCEPTEXPR: //37;           
               case XPathTreeConstants.JJTVALIDATEEXPR: //44;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +41 -11    
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/ConditionalExpr.java
  
  Index: ConditionalExpr.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/ConditionalExpr.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- ConditionalExpr.java      13 Mar 2003 20:28:17 -0000      1.1.2.1
  +++ ConditionalExpr.java      24 Mar 2003 17:35:06 -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",
  @@ -56,21 +56,51 @@
   package org.apache.xpath.expression;
   
   /**
  + * Represents conditional expressions.
  + *
  + * @see XPath 2.0 specification
    */
  -public interface ConditionalExpr extends Expr {
  -    
  +public interface ConditionalExpr extends Expr
  +{
       /**
  -     * 
  +     * Gets the test expression.
  +     *
  +     * @return The test expression
        */
       Expr getTestExpr();
  -    
  +
       /**
  -     * 
  +     * Gets the then-expression
  +     *
  +     * @return The then-expression
        */
       Expr getThenExpr();
  -    
  +
       /**
  -     * 
  +     * Gets the else-expression
  +     *
  +     * @return The else-expression
        */
       Expr getElseExpr();
  +
  +    /**
  +     * Sets the test expression.
  +     *
  +     * @param expr The test expression
  +     */
  +    void setTestExpr(Expr expr);
  +
  +    /**
  +     * Gets the then-expression
  +     *
  +     * @param expr The then-expression
  +     */
  +    void setThenExpr(Expr expr);
  +
  +    /**
  +     * Gets the else-expression
  +     *
  +     * @param expr The else-expression
  +     */
  +    void setElseExpr(Expr expr);
   }
  
  
  
  1.1.2.2   +1 -1      
xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/Literal.java
  
  Index: Literal.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/expression/Attic/Literal.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- Literal.java      13 Mar 2003 20:28:17 -0000      1.1.2.1
  +++ Literal.java      24 Mar 2003 17:35:06 -0000      1.1.2.2
  @@ -95,7 +95,7 @@
       short DOUBLE_LITERAL = 3;
   
       /**
  -     * Gets the literal
  +     * Gets the literal type
        * @return short One of the four following literal type: 
<code>INTEGER_LITERAL</code>,
        * <code>DECIMAL_LITERAL</code>, <code>STRING_LITERAL</code>, 
<code>DOUBLE_LITERAL</code>.
        */
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +29 -1     
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.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- TestSamples.xml   13 Mar 2003 20:28:18 -0000      1.1.2.1
  +++ TestSamples.xml   24 Mar 2003 17:35:06 -0000      1.1.2.2
  @@ -796,6 +796,32 @@
                </ast>
        </expr>
        
  +     <!-- Conditionnal expr -->
  +     
  +     <expr value="if (a) then b else c">
  +             <ast>
  +                     <node name="ExprSequence">
  +                             <node name="IfExpr">
  +                                     <node name="PathExpr">
  +                                             <node name="StepExpr">
  +                                                     <node name="NameTest"/> 
  +                                             </node>
  +                                     </node>
  +                                     <node name="PathExpr">
  +                                             <node name="StepExpr">
  +                                                     <node name="NameTest"/> 
  +                                             </node>
  +                                     </node>                                 
  +                                     <node name="PathExpr">
  +                                             <node name="StepExpr">
  +                                                     <node name="NameTest"/> 
  +                                             </node>
  +                                     </node>                                 
  +                             </node>
  +                     </node>                 
  +             </ast>
  +     </expr>
  +     
        
        <!-- For expr -->
        
  @@ -870,11 +896,13 @@
                </ast>
        </expr>
   
  -     <!-- Semantically invalid expression (parser should return an error) -->
  +     <!-- Semantically invalid expression (parser should return an error) -->       
 
        <expr value="9876543210" valid="false"/>
        
        <expr value="toto/(45+23)" valid="false"/>
        <expr value="a/(b,c)/d" valid="false"/>
  +     
  +     <expr value="if (a) then b" valid="false"/>
        
        <!-- Expressions for which no common AST has been decided yet -->
        
  
  
  
  1.1.2.2   +210 -169  
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.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- TestSamples.java  13 Mar 2003 20:28:18 -0000      1.1.2.1
  +++ TestSamples.java  24 Mar 2003 17:35:06 -0000      1.1.2.2
  @@ -69,135 +69,42 @@
   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 javax.xml.parsers.DocumentBuilder;
   import javax.xml.parsers.DocumentBuilderFactory;
   
  +
   /**
    * Simple unit test for various samples; adhoc.
    */
  -public class TestSamples {
  -
  +public class TestSamples
  +{
       public static String TEST_SAMPLES_XML = 
"src2/org/apache/xpath/test/TestSamples.xml";
  -    
  -    public static boolean testNode(Node node, int testid) 
  -            throws Exception {
  -        boolean testOK = true;
  -        String xpathString = ((Element) node).getAttribute("value");
  -        System.out.println(
  -            "TestSamples[" + testid + "]: " + xpathString);
  -
  -        SimpleNode tree;
  -        XPath parser;
  -        try {
  -            parser = new XPath(new StringReader(xpathString));
  -            tree = parser.XPath2();
  -
  -            if (SimpleNode.PRODUCE_RAW_TREE) {
  -                //  if (dumpTree)
  -                //{
  -                tree.dump("|");
  -
  -                //   }
  -            }
  -            else {
  -                Expr expr = (Expr) tree.jjtGetChild(0);
  -
  -                // Gets the reference AST to compare with
  -                NodeList astNodes =
  -                    ((Element) node).getElementsByTagName("ast");
  -
  -                if ((astNodes != null)
  -                    && (astNodes.getLength() >= 1)) {
  -                    Node astNode = astNodes.item(0);
  -
  -                    if (!checkAST((SimpleNode) expr,
  -                        (Element)
  -                            (
  -                                (
  -                                    Element) astNode)
  -                                        .getElementsByTagName(
  -                            "node").item(
  -                            0))) {
  -                        System.err.println(
  -                            "Generated AST doesn't match the reference one");
  -
  -                        tree.dump("|");
  -
  -                        // Produce the raw tree
  -                        System.err.println("Raw tree is");
  -
  -                        SimpleNode.PRODUCE_RAW_TREE = true;
  -
  -                        parser =
  -                            new XPath(
  -                                new StringReader(xpathString));
  -                        tree = parser.XPath2();
  -                        tree.dump("|");
  -
  -                        SimpleNode.PRODUCE_RAW_TREE = false;
  -                    }
  -                }
  -                else {
  -                    System.err.println("No reference AST provided");
  -                }
  -
  -                String ab = expr.getString(true);
  -
  -                String norm =
  -                    ((Element) node).getAttribute(
  -                        "normalized-round-trip");
  -
  -                if ("".equals(norm)) {
  -                    norm = xpathString;
  -                }
  -
  -                if (!ab.equals(norm)) {
  -                    System.err.print(
  -                        "Bad external or internal representation: ");
  -                    System.err.println(ab + "  !=  " + xpathString);
  -                    testOK = false;
  -                }
  -            }
  -        }
  -        catch (RuntimeException e) {
  -            e.printStackTrace(System.err);
   
  -            System.err.println("Raw tree is");
  -            SimpleNode.PRODUCE_RAW_TREE = true;
  -
  -            parser = new XPath(new StringReader(xpathString));
  -            tree = parser.XPath2();
  -            tree.dump("|");
  -
  -            SimpleNode.PRODUCE_RAW_TREE = false;
  -            testOK = false;
  -        }
  -        return testOK;
  -    }
  -    
  -    
  -    public TestSamples(String[] args) {
  -        try {
  -            final boolean dumpTree =
  -                ((args.length == 1) && args[0].equals("-dump")) ? true : false;
  +    public TestSamples(String[] args)
  +    {
  +        try
  +        {
  +            final boolean dumpTree = ((args.length == 1)
  +                && args[0].equals("-dump")) ? true : false;
   
               DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
               DocumentBuilder db = dbf.newDocumentBuilder();
  -            Document doc =
  -                db.parse(new InputSource(TEST_SAMPLES_XML));
  +            Document doc = db.parse(new InputSource(TEST_SAMPLES_XML));
               doc.normalize();
   
               Element tests = doc.getDocumentElement();
  @@ -206,25 +113,29 @@
               int testid = 0;
               boolean testSuccess = true;
   
  -            for (int i = 0; i < nChildren; i++) {
  +            for (int i = 0; i < nChildren; i++)
  +            {
                   org.w3c.dom.Node node = testElems.item(i);
   
  -                if (org.w3c.dom.Node.ELEMENT_NODE == node.getNodeType()) {
  +                if (org.w3c.dom.Node.ELEMENT_NODE == node.getNodeType())
  +                {
                       testid++;
                       testSuccess &= testNode(node, testid);
                   }
               }
   
  -            if (testSuccess) {
  -                System.out.println("Parsing Test successful!!!");
  +            if (testSuccess)
  +            {
  +                System.out.println("Parsing Test successful.");
               }
  -            else {
  -                System.out.println("Parsing Test fails!!!!!!!!!");
  +            else
  +            {
  +                System.out.println("Parsing Test fails!");
               }
   
               // Test adhoc manual creation
  -            ExpressionFactory exprFct =
  -                XPathFactory.newInstance().newExpressionFactory();
  +            ExpressionFactory exprFct = XPathFactory.newInstance()
  +                                                    .newExpressionFactory();
   
               Expr expr = exprFct.createExpr("child::tutu[10]");
               System.out.println("tutu[10] =? " + expr.getString(true));
  @@ -233,65 +144,79 @@
               System.out.println("/ =? " + pathExpr.getString(true));
   
               NodeTest nt = exprFct.createNameTest(null, "toto");
  -            pathExpr.addOperand(
  -                exprFct.createStepExpr(StepExpr.AXIS_CHILD, nt));
  +            pathExpr.addOperand(exprFct.createStepExpr(StepExpr.AXIS_CHILD, nt));
               System.out.println("/toto =? " + pathExpr.getString(true));
               System.out.println("/child::toto =? " + pathExpr.getString(false));
   
               nt = exprFct.createNameTest(null, "titi");
  -            pathExpr.addOperand(
  -                exprFct.createStepExpr(StepExpr.AXIS_DESCENDANT, nt));
  +            pathExpr.addOperand(exprFct.createStepExpr(
  +                    StepExpr.AXIS_DESCENDANT, nt));
   
  -            System.out.println(
  -                "/toto/descendant::titi =? " + pathExpr.getString(true));
  -            System.out.println(
  -                "/child::toto/descendant::titi =? "
  -                    + pathExpr.getString(false));
  +            System.out.println("/toto/descendant::titi =? "
  +                + pathExpr.getString(true));
  +            System.out.println("/child::toto/descendant::titi =? "
  +                + pathExpr.getString(false));
   
               StepExpr se = (StepExpr) pathExpr.getOperand(0); // first step
               se.appendPredicate(exprFct.createIntegerLiteralExpr(50));
  -            System.out.println(
  -                "/toto[50]/descendant::titi =? " + pathExpr.getString(true));
  -            System.out.println(
  -                "/child::toto[50]/descendant::titi =? "
  -                    + pathExpr.getString(false));
  +            System.out.println("/toto[50]/descendant::titi =? "
  +                + pathExpr.getString(true));
  +            System.out.println("/child::toto[50]/descendant::titi =? "
  +                + pathExpr.getString(false));
   
               // Test visitor - anonymous class used
  -            pathExpr.visit(new Visitor() {
  -                public boolean visitPath(PathExpr path) {
  -                    System.out.println("visit path " + path.getString(false));
  -                    return true;
  -                }
  +            pathExpr.visit(new Visitor()
  +                {
  +                    public boolean visitPath(PathExpr path)
  +                    {
  +                        System.out.println("visit path "
  +                            + path.getString(false));
   
  -                public boolean visitStep(StepExpr step) {
  -                    System.out.println("visit step " + step.getString(false));
  -                    return true;
  -                }
  +                        return true;
  +                    }
   
  -                public boolean visitLiteral(Literal primary) {
  -                    System.out.println(primary.getString(false));
  -                    return true;
  -                }
  +                    public boolean visitStep(StepExpr step)
  +                    {
  +                        System.out.println("visit step "
  +                            + step.getString(false));
   
  -                public boolean visitOperator(OperatorExpr arithmetic) {
  -                    System.out.println(arithmetic.getString(false));
  -                    return true;
  -                }
  +                        return true;
  +                    }
   
  -                public boolean visitConditional(ConditionalExpr condition) {
  -                    System.out.println(condition.getString(false));
  -                    return true;
  -                }
  +                    public boolean visitLiteral(Literal primary)
  +                    {
  +                        System.out.println(primary.getString(false));
   
  -                public boolean visitForOrQuantifiedExpr(ForAndQuantifiedExpr expr) {
  -                    System.out.println(expr.getString(false));
  -                    return true;
  -                }
  +                        return true;
  +                    }
   
  -                public boolean visitVariable(Variable var) {
  -                    return false;
  -                }
  -            });
  +                    public boolean visitOperator(OperatorExpr arithmetic)
  +                    {
  +                        System.out.println(arithmetic.getString(false));
  +
  +                        return true;
  +                    }
  +
  +                    public boolean visitConditional(ConditionalExpr condition)
  +                    {
  +                        System.out.println(condition.getString(false));
  +
  +                        return true;
  +                    }
  +
  +                    public boolean visitForOrQuantifiedExpr(
  +                        ForAndQuantifiedExpr expr)
  +                    {
  +                        System.out.println(expr.getString(false));
  +
  +                        return true;
  +                    }
  +
  +                    public boolean visitVariable(Variable var)
  +                    {
  +                        return false;
  +                    }
  +                });
   
               // Simple Evaluation check
               //Evaluator eval = XPathFactory.newInstance().newEvaluatorFactory()
  @@ -299,6 +224,7 @@
               XalanEvaluator eval = new XalanEvaluator();
   
               ExprContextImpl ctx = eval.createExprContext();
  +
               //ctx.getDynamicContext().setContextItem(doc.getDocumentElement());
               ctx.setContextItem(doc.getDocumentElement());
   
  @@ -308,32 +234,145 @@
   
               System.out.println("-5 ?= " + ((XObject) res).str());
           }
  -        catch (Exception e) {
  +        catch (Exception e)
  +        {
               System.out.println(e.getMessage());
               e.printStackTrace();
           }
       }
   
  +    public static boolean testNode(Node node, int testid)
  +        throws Exception
  +    {
  +        boolean testOK = true;
  +        String xpathString = ((Element) node).getAttribute("value");
  +        System.out.println("TestSamples[" + testid + "]: " + xpathString);
  +
  +        SimpleNode tree;
  +        XPath parser;
  +
  +        try
  +        {
  +            parser = new XPath(new StringReader(xpathString));
  +
  +            try
  +            {
  +                tree = parser.XPath2();
  +
  +                if (SimpleNode.PRODUCE_RAW_TREE)
  +                {
  +                    //  if (dumpTree)
  +                    //{
  +                    tree.dump("|");
  +
  +                    //   }
  +                }
  +                else
  +                {
  +                    Expr expr = (Expr) tree.jjtGetChild(0);
  +
  +                    // Gets the reference AST to compare with
  +                    NodeList astNodes = ((Element) node).getElementsByTagName(
  +                            "ast");
  +
  +                    if ((astNodes != null) && (astNodes.getLength() >= 1))
  +                    {
  +                        Node astNode = astNodes.item(0);
  +
  +                        if (!checkAST((SimpleNode) expr,
  +                                    (Element) ((Element) 
astNode).getElementsByTagName(
  +                                        "node").item(0)))
  +                        {
  +                            System.err.println(
  +                                "Generated AST doesn't match the reference one");
  +
  +                            tree.dump("|");
  +
  +                            // Produce the raw tree
  +                            System.err.println("Raw tree is");
  +
  +                            SimpleNode.PRODUCE_RAW_TREE = true;
  +
  +                            parser = new XPath(new StringReader(xpathString));
  +                            tree = parser.XPath2();
  +                            tree.dump("|");
  +
  +                            SimpleNode.PRODUCE_RAW_TREE = false;
  +                        }
  +                    }
  +                    else
  +                    {
  +                        System.err.println("No reference AST provided");
  +                    }
  +
  +                    String ab = expr.getString(true);
  +
  +                    String norm = ((Element) node).getAttribute(
  +                            "normalized-round-trip");
  +
  +                    if ("".equals(norm))
  +                    {
  +                        norm = xpathString;
  +                    }
  +
  +                    if (!ab.equals(norm))
  +                    {
  +                        System.err.print(
  +                            "Bad external or internal representation: ");
  +                        System.err.println(ab + "  !=  " + xpathString);
  +                        testOK = false;
  +                    }
  +                }
  +            }
  +            catch (ParseException e)
  +            {
  +                System.err.println("Parsing error occurs: " + e.getMessage());
  +            }
  +        }
  +        catch (RuntimeException e)
  +        {
  +            e.printStackTrace(System.err);
  +
  +            System.err.println("Raw tree is");
  +            SimpleNode.PRODUCE_RAW_TREE = true;
  +
  +            parser = new XPath(new StringReader(xpathString));
  +            tree = parser.XPath2();
  +            tree.dump("|");
  +
  +            SimpleNode.PRODUCE_RAW_TREE = false;
  +            testOK = false;
  +        }
  +
  +        return testOK;
  +    }
  +
       /**
        * Check that the given internal representation of expr match the reference
        * AST
  +     *
        * @param expr
        * @param refAST
  +     *
        * @return boolean
        */
  -    public static boolean checkAST(SimpleNode expr, Element refAST) {
  -        String nodeName =
  -            refAST.getAttributes().getNamedItem("name").getNodeValue();
  +    public static boolean checkAST(SimpleNode expr, Element refAST)
  +    {
  +        String nodeName = refAST.getAttributes().getNamedItem("name")
  +                                .getNodeValue();
   
  -        if (XPathTreeConstants.jjtNodeName[expr.getId()].equals(nodeName)) {
  +        if (XPathTreeConstants.jjtNodeName[expr.getId()].equals(nodeName))
  +        {
               int i = 0;
   
  -            for (Node rac = refAST.getFirstChild();
  -                rac != null;
  -                rac = rac.getNextSibling()) {
  -                if ("node".equals(rac.getNodeName())) {
  +            for (Node rac = refAST.getFirstChild(); rac != null;
  +                    rac = rac.getNextSibling())
  +            {
  +                if ("node".equals(rac.getNodeName()))
  +                {
                       if (!checkAST((SimpleNode) expr.jjtGetChild(i),
  -                        (Element) rac)) {
  +                                (Element) rac))
  +                    {
                           return false;
                       }
   
  @@ -341,7 +380,8 @@
                   }
               }
   
  -            if (i < expr.jjtGetNumChildren()) {
  +            if (i < expr.jjtGetNumChildren())
  +            {
                   return false;
               }
   
  @@ -351,7 +391,8 @@
           return false;
       }
   
  -    public static void main(String[] args) {
  +    public static void main(String[] args)
  +    {
           new TestSamples(args);
       }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +116 -66   
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.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- ConditionalExprImpl.java  13 Mar 2003 20:28:14 -0000      1.1.2.1
  +++ ConditionalExprImpl.java  24 Mar 2003 17:35:06 -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",
  @@ -62,94 +62,144 @@
   import org.apache.xpath.impl.parser.SimpleNode;
   import org.apache.xpath.impl.parser.XPath;
   
  +
   /**
  - *
  + * Implementation of if-then-else expression.
    */
  -public class ConditionalExprImpl extends SimpleNode implements ConditionalExpr {
  +public class ConditionalExprImpl extends ExprImpl implements ConditionalExpr
  +{
  +    /**
  +     * Constructor for ConditionalExprImpl.
  +     *
  +     * @param i
  +     */
  +    public ConditionalExprImpl(int i)
  +    {
  +        super(i);
  +        children = new Node[3];
  +    }
   
  +    /**
  +     * Constructor for ConditionalExprImpl.
  +     *
  +     * @param p
  +     * @param i
  +     */
  +    public ConditionalExprImpl(XPath p, int i)
  +    {
  +        super(p, i);
  +        children = new Node[3];
  +    }
  +    
        /**
         * Constructor for ConditionalExprImpl.
  +      *
         * @param i
         */
  -     public ConditionalExprImpl(int i) {
  -             super(i);
  +     private ConditionalExprImpl(ConditionalExprImpl expr)
  +     {
  +             super(expr.id);
  +             children = new Node[3];
  +             System.arraycopy(expr.children, 0, children, 0, 3);
        }
   
  -     /**
  -      * Constructor for ConditionalExprImpl.
  -      * @param p
  -      * @param i
  -      */
  -     public ConditionalExprImpl(XPath p, int i) {
  -             super(p, i);
  -     }
  +    /**
  +     * @see org.apache.xpath.expression.ConditionalExpr#getElseExpr()
  +     */
  +    public Expr getElseExpr()
  +    {
  +        return (Expr) children[2];
  +    }
   
  -     /**
  -      * @see org.apache.xpath.expression.ConditionalExpr#getElseExpr()
  -      */
  -     public Expr getElseExpr() {
  -             return null;
  -     }
  +    /**
  +     * @see org.apache.xpath.expression.ConditionalExpr#getTestExpr()
  +     */
  +    public Expr getTestExpr()
  +    {
  +        return (Expr) children[0];
  +    }
   
  -     /**
  -      * @see org.apache.xpath.expression.ConditionalExpr#getTestExpr()
  -      */
  -     public Expr getTestExpr() {
  -             return null;
  -     }
  +    /**
  +     * @see org.apache.xpath.expression.ConditionalExpr#getThenExpr()
  +     */
  +    public Expr getThenExpr()
  +    {
  +        return (Expr) children[1];
  +    }
   
  -     /**
  -      * @see org.apache.xpath.expression.ConditionalExpr#getThenExpr()
  -      */
  -     public Expr getThenExpr() {
  -             return null;
  -     }
  +    /* (non-Javadoc)
  +     * @see 
org.apache.xpath.expression.ConditionalExpr#setElseExpr(org.apache.xpath.expression.Expr)
  +     */
  +    public void setElseExpr(Expr expr)
  +    {
  +        children[2] = (Node) expr;
  +    }
   
  -     /**
  -      * @see org.apache.xpath.expression.Expr#cloneExpression()
  -      */
  -     public Expr cloneExpression() {
  -             return null;
  -     }
  +    /* (non-Javadoc)
  +     * @see 
org.apache.xpath.expression.ConditionalExpr#setTestExpr(org.apache.xpath.expression.Expr)
  +     */
  +    public void setTestExpr(Expr expr)
  +    {
  +        children[0] = (Node) expr;
  +    }
   
  -     /**
  -      * @see org.apache.xpath.expression.Expr#getExprType()
  -      */
  -     public short getExprType() {
  -             return CONDITIONAL_EXPR;
  -     }
  +    /* (non-Javadoc)
  +     * @see 
org.apache.xpath.expression.ConditionalExpr#setThenExpr(org.apache.xpath.expression.Expr)
  +     */
  +    public void setThenExpr(Expr expr)
  +    {
  +        children[1] = (Node) expr;
  +    }
   
  -     /**
  -      * @see org.apache.xpath.expression.Expr#getString(boolean)
  -      */
  -     public String getString(boolean abbreviate) {
  -             return null;
  -     }
  -    
       /**
  -     * @see org.apache.xpath.expression.Visitable#visit(Visitor)
  +     * @see org.apache.xpath.expression.Expr#cloneExpression()
        */
  -    public void visit(Visitor visitor) {
  -        // TODO:
  +    public Expr cloneExpression()
  +    {        
  +        return new ConditionalExprImpl(this);
       }
   
  +    /**
  +     * @see org.apache.xpath.expression.Expr#getExprType()
  +     */
  +    public short getExprType()
  +    {
  +        return CONDITIONAL_EXPR;
  +    }
  +
  +    /**
  +     * @see org.apache.xpath.expression.Visitable#visit(Visitor)
  +     */
  +    public void visit(Visitor visitor)
  +    {
  +       visitor.visitConditional(this);
  +    }
   
       /**
        * @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);
           }
       }
  -    
  -    /**
  -     * @see org.apache.xpath.impl.parser.SimpleNode#canBeReduced()
  +
  +    /* (non-Javadoc)
  +     * @see 
org.apache.xpath.impl.parser.SimpleNode#getString(java.lang.StringBuffer, boolean)
        */
  -    public boolean canBeReduced() {
  -        return children.length == 1; // means that there is no (at least) then expr 
(pos=1)
  +    public void getString(StringBuffer expr, boolean abbreviate)
  +    {
  +        expr.append("if (");
  +        ((ExprImpl) getTestExpr()).getString(expr, abbreviate);
  +        expr.append(") then ");
  +        ((ExprImpl) getThenExpr()).getString(expr, abbreviate);
  +        expr.append(" else ");
  +        ((ExprImpl) getElseExpr()).getString(expr, abbreviate);
       }
  -
   }
  
  
  

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

Reply via email to