xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vill...@apache.org
Subject cvs commit: xml-xalan/java/xpath_rwapi/src2/org/apache/xpath XPathException.java
Date Tue, 24 Jun 2003 21:09:08 GMT
villard     2003/06/24 14:09:08

  Modified:    java/xpath_rwapi/src2/org/apache/xpath/impl Tag: xslt20
                        StepExprImpl.java OperatorImpl.java
                        ExpressionFactoryImpl.java PathExprImpl.java
                        ExprImpl.java
               java/xpath_rwapi/src2/org/apache/xpath/expression Tag:
                        xslt20 ExpressionFactory.java OperatorExpr.java
               java/xpath_rwapi/src2/org/apache/xpath/impl/parser Tag:
                        xslt20 SimpleNode.java
               java/xpath_rwapi/src2/org/apache/xpath Tag: xslt20
                        XPathException.java
  Log:
  Add a new method in the OperatorExpr interface: append(Expr). It allows to concat two operators
of the same type
  Add the method createSequence in ExpressionFactory
  Several bugs fixes, especially for the cloneExpression feature
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +1 -0      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.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- StepExprImpl.java	28 Mar 2003 22:47:40 -0000	1.1.2.4
  +++ StepExprImpl.java	24 Jun 2003 21:09:07 -0000	1.1.2.5
  @@ -133,6 +133,7 @@
       {
       	super(XPathTreeConstants.JJTSTEPEXPR);
       	
  +    	m_axisType = step.m_axisType;    	    	
       	m_children = step.cloneChildren();
       }
   
  
  
  
  1.1.2.5   +23 -7     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.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- OperatorImpl.java	31 Mar 2003 23:05:52 -0000	1.1.2.4
  +++ OperatorImpl.java	24 Jun 2003 21:09:07 -0000	1.1.2.5
  @@ -104,6 +104,13 @@
        */
       short m_opType;
   
  +	/**
  +	 * Internal use only
  +	 */
  +	protected OperatorImpl() 
  +	{
  +	}
  +
       /**
        * Constructor for OperatorImpl. Internal uses only.
        *
  @@ -126,13 +133,6 @@
   
                   break;
   
  -            case XPathTreeConstants.JJTPATHEXPR:
  -            case XPathTreeConstants.JJTPATHPATTERN:
  -                m_exprType = PATH_EXPR;
  -                m_opType = SLASH_STEP;
  -
  -                break;
  -
               case XPathTreeConstants.JJTUNIONEXPR:
   			case XPathTreeConstants.JJTINTERSECTEXCEPTEXPR:
               case XPathTreeConstants.JJTPATTERN:
  @@ -210,6 +210,7 @@
       /**
        * Constructor for OperatorImpl.
        *
  +     * @param id
        * @param exprType DOCUMENT ME!
        * @param opType DOCUMENT ME!
        */
  @@ -267,9 +268,24 @@
        */
       public void addOperand(Expr operand) throws XPathException
       {
  +    	// do not performed the reduction during edition
           super.jjtAddChild((Node) operand,
               (m_children == null) ? 0 : m_children.length);
       }
  +
  +	/* (non-Javadoc)
  +	 * @see org.apache.xpath.expression.OperatorExpr#append(org.apache.xpath.expression.OperatorExpr)
  +	 */
  +	public void append(OperatorExpr expr) throws XPathException {
  +		if (expr.getExprType() == m_exprType && expr.getOperatorType() == m_opType )
{
  +			int size = expr.getOperandCount();
  +			for (int i = 0; i < size ; i ++ ) {
  +				addOperand(expr.getOperand(i));			
  +			}
  +		} else {
  +			throw new XPathException("Mismatched operator expressions"); // I16 + better msg
  +		}
  +	}
   
       /**
        * @see org.apache.xpath.expression.OperatorExpr#getOperand(int)
  
  
  
  1.1.2.6   +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.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- ExpressionFactoryImpl.java	10 Jun 2003 19:17:24 -0000	1.1.2.5
  +++ ExpressionFactoryImpl.java	24 Jun 2003 21:09:07 -0000	1.1.2.6
  @@ -74,6 +74,7 @@
   import org.apache.xpath.impl.parser.NodeFactory;
   import org.apache.xpath.impl.parser.ParseException;
   import org.apache.xpath.impl.parser.XPath;
  +import org.apache.xpath.impl.parser.XPathTreeConstants;
   
   /**
    * Default implementation expression factory to create XPath AST nodes.
  @@ -247,6 +248,13 @@
   		LiteralImpl lit = new LiteralImpl();
   		lit.setDoubleValue(value);
   		return lit;
  +	}
  +
  +	/* (non-Javadoc)
  +	 * @see org.apache.xpath.expression.ExpressionFactory#createSequence()
  +	 */
  +	public OperatorExpr createSequence() {
  +		return new OperatorImpl(XPathTreeConstants.JJTEXPRSEQUENCE);
   	}
   
   
  
  
  
  1.1.2.3   +18 -2     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.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- PathExprImpl.java	27 Mar 2003 21:53:24 -0000	1.1.2.2
  +++ PathExprImpl.java	24 Jun 2003 21:09:07 -0000	1.1.2.3
  @@ -88,8 +88,9 @@
        */
       public PathExprImpl(int i)
       {
  -        super(i);
  -
  +		id = i;
  +        m_exprType = PATH_EXPR;
  +		m_opType = SLASH_STEP;
           m_isAbsolute = false;
       }
   
  @@ -106,6 +107,14 @@
           m_isAbsolute = false;
       }
   
  +	/**
  +	 * @param expr
  +	 */
  +	protected PathExprImpl(PathExprImpl expr) {
  +		super(expr);
  +		m_isAbsolute = expr.m_isAbsolute;
  +	}
  +
       /**
        * @see org.apache.xpath.expression.PathExpr#isAbsolute()
        */
  @@ -140,6 +149,13 @@
   
           super.getString(expr, abbreviate);
       }
  +
  +	/* (non-Javadoc)
  +	 * @see org.apache.xpath.expression.Expr#cloneExpression()
  +	 */
  +	public Expr cloneExpression() {
  +		return new PathExprImpl(this);
  +	}
   
       /**
        * @see org.apache.xpath.impl.parser.Node#jjtAddChild(Node, int)
  
  
  
  1.1.2.4   +7 -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.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- ExprImpl.java	28 Mar 2003 22:47:40 -0000	1.1.2.3
  +++ ExprImpl.java	24 Jun 2003 21:09:07 -0000	1.1.2.4
  @@ -55,7 +55,6 @@
    */
   package org.apache.xpath.impl;
   
  -import org.apache.xpath.XPathException;
   import org.apache.xpath.expression.Expr;
   import org.apache.xpath.expression.Visitor;
   import org.apache.xpath.impl.parser.Node;
  @@ -137,7 +136,13 @@
   
           for (int i = 0; i < m_children.length; i++)
           {
  -            clone[i] = (Node) ((Expr) m_children[i]).cloneExpression();
  +        	Node child = m_children[i];
  +        	if (child instanceof Expr) {
  +            	clone[i] = (Node) ((Expr) child).cloneExpression();
  +        	} else {
  +        		// immutable object, just copy reference
  +        		clone[i] = child;
  +        	}
           }
   
           return clone;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +6 -0      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.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- ExpressionFactory.java	10 Jun 2003 19:17:24 -0000	1.1.2.4
  +++ ExpressionFactory.java	24 Jun 2003 21:09:08 -0000	1.1.2.5
  @@ -79,6 +79,12 @@
        */
       public Expr createExpr(String expr) throws XPathException;
   
  +	/**
  +	 * Creates a new XPath sequence
  +	 * @return A sequence
  +	 */
  +	public OperatorExpr createSequence();
  +
       /**
        * Create a new relative or absolute path expression
        *
  
  
  
  1.1.2.2   +9 -0      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.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- OperatorExpr.java	13 Mar 2003 20:28:17 -0000	1.1.2.1
  +++ OperatorExpr.java	24 Jun 2003 21:09:08 -0000	1.1.2.2
  @@ -281,4 +281,13 @@
        * Remove an operand
        */
       void removeOperand(Expr operand) throws XPathException;
  +    
  +    /**
  +     * Append the specified expr to the end of this expression. <br>
  +     * The specified expression has to be of the same type of this expression,
  +     * otherwise an exception will be raised
  +     * @param expr The expression to append
  +     */    
  +    void append(OperatorExpr expr) throws XPathException;
  +    
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.10  +1 -0      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.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- SimpleNode.java	7 May 2003 18:58:42 -0000	1.1.2.9
  +++ SimpleNode.java	24 Jun 2003 21:09:08 -0000	1.1.2.10
  @@ -771,4 +771,5 @@
       public void getString(StringBuffer expr, boolean abbreviate)
       {
       }
  +    
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +2 -2      xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/Attic/XPathException.java
  
  Index: XPathException.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/xpath_rwapi/src2/org/apache/xpath/Attic/XPathException.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- XPathException.java	13 Mar 2003 20:28:18 -0000	1.1.2.1
  +++ XPathException.java	24 Jun 2003 21:09:08 -0000	1.1.2.2
  @@ -97,7 +97,7 @@
        */
       public String getLocalizedMessage()
       {
  -        return m_e.getLocalizedMessage();
  +        return (m_e == null) ? super.getLocalizedMessage() : getLocalizedMessage();
       }
   
       /**
  @@ -105,7 +105,7 @@
        */
       public String getMessage()
       {
  -        return m_e.getMessage();
  +        return (m_e == null) ? super.getMessage() : m_e.getMessage();
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message