You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2006/01/25 15:37:45 UTC

svn commit: r372228 [2/6] - in /tomcat/jasper/tc6.0.x/src/share: javax/ javax/el/ org/apache/el/ org/apache/el/lang/ org/apache/el/parser/ org/apache/el/util/

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/MethodExpressionLiteral.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/MethodExpressionLiteral.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/MethodExpressionLiteral.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/MethodExpressionLiteral.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.el;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.MethodExpression;
+import javax.el.MethodInfo;
+
+import org.apache.el.lang.ELSupport;
+import org.apache.el.util.ReflectionUtil;
+
+
+public class MethodExpressionLiteral extends MethodExpression implements Externalizable {
+
+    private Class expectedType;
+
+    private String expr;
+    
+    private Class[] paramTypes;
+    
+    public MethodExpressionLiteral() {
+        // do nothing
+    }
+    
+    public MethodExpressionLiteral(String expr, Class expectedType, Class[] paramTypes) {
+        this.expr = expr;
+        this.expectedType = expectedType;
+        this.paramTypes = paramTypes;
+    }
+
+    public MethodInfo getMethodInfo(ELContext context) throws ELException {
+        return new MethodInfo(this.expr, this.expectedType, this.paramTypes);
+    }
+
+    public Object invoke(ELContext context, Object[] params) throws ELException {
+        if (this.expectedType != null) {
+            return ELSupport.coerceToType(this.expr, this.expectedType);
+        } else {
+            return this.expr;
+        }
+    }
+
+    public String getExpressionString() {
+        return this.expr;
+    }
+
+    public boolean equals(Object obj) {
+        return (obj instanceof MethodExpressionLiteral && this.hashCode() == obj.hashCode());
+    }
+
+    public int hashCode() {
+        return this.expr.hashCode();
+    }
+
+    public boolean isLiteralText() {
+        return true;
+    }
+
+    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        this.expr = in.readUTF();
+        String type = in.readUTF();
+        if (!"".equals(type)) {
+            this.expectedType = ReflectionUtil.forName(type);
+        }
+        this.paramTypes = ReflectionUtil.toTypeArray(((String[]) in
+                .readObject()));
+    }
+
+    public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeUTF(this.expr);
+        out.writeUTF((this.expectedType != null) ? this.expectedType.getName()
+                : "");
+        out.writeObject(ReflectionUtil.toTypeNameArray(this.paramTypes));
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/ValueExpressionImpl.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/ValueExpressionImpl.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/ValueExpressionImpl.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/ValueExpressionImpl.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,262 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.el;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.el.Expression;
+import javax.el.ExpressionFactory;
+import javax.el.FunctionMapper;
+import javax.el.PropertyNotFoundException;
+import javax.el.PropertyNotWritableException;
+import javax.el.ValueExpression;
+import javax.el.VariableMapper;
+
+import org.apache.el.lang.ELSupport;
+import org.apache.el.lang.EvaluationContext;
+import org.apache.el.lang.ExpressionBuilder;
+import org.apache.el.parser.AstLiteralExpression;
+import org.apache.el.parser.Node;
+import org.apache.el.util.ReflectionUtil;
+
+
+/**
+ * An <code>Expression</code> that can get or set a value.
+ * 
+ * <p>
+ * In previous incarnations of this API, expressions could only be read.
+ * <code>ValueExpression</code> objects can now be used both to retrieve a
+ * value and to set a value. Expressions that can have a value set on them are
+ * referred to as l-value expressions. Those that cannot are referred to as
+ * r-value expressions. Not all r-value expressions can be used as l-value
+ * expressions (e.g. <code>"${1+1}"</code> or
+ * <code>"${firstName} ${lastName}"</code>). See the EL Specification for
+ * details. Expressions that cannot be used as l-values must always return
+ * <code>true</code> from <code>isReadOnly()</code>.
+ * </p>
+ * 
+ * <p>
+ * <code>The {@link ExpressionFactory#createValueExpression} method
+ * can be used to parse an expression string and return a concrete instance
+ * of <code>ValueExpression</code> that encapsulates the parsed expression.
+ * The {@link FunctionMapper} is used at parse time, not evaluation time, 
+ * so one is not needed to evaluate an expression using this class.  
+ * However, the {@link ELContext} is needed at evaluation time.</p>
+ *
+ * <p>The {@link #getValue}, {@link #setValue}, {@link #isReadOnly} and
+ * {@link #getType} methods will evaluate the expression each time they are
+ * called. The {@link ELResolver} in the <code>ELContext</code> is used to 
+ * resolve the top-level variables and to determine the behavior of the
+ * <code>.</code> and <code>[]</code> operators. For any of the four methods,
+ * the {@link ELResolver#getValue} method is used to resolve all properties 
+ * up to but excluding the last one. This provides the <code>base</code> 
+ * object. At the last resolution, the <code>ValueExpression</code> will 
+ * call the corresponding {@link ELResolver#getValue}, 
+ * {@link ELResolver#setValue}, {@link ELResolver#isReadOnly} or 
+ * {@link ELResolver#getType} method, depending on which was called on 
+ * the <code>ValueExpression</code>.
+ * </p>
+ *
+ * <p>See the notes about comparison, serialization and immutability in 
+ * the {@link Expression} javadocs.
+ *
+ * @see javax.el.ELResolver
+ * @see javax.el.Expression
+ * @see javax.el.ExpressionFactory
+ * @see javax.el.ValueExpression
+ * 
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dpatil $
+ */
+public final class ValueExpressionImpl extends ValueExpression implements
+        Externalizable {
+
+    private Class expectedType;
+
+    private String expr;
+
+    private FunctionMapper fnMapper;
+
+    private VariableMapper varMapper;
+
+    private transient Node node;
+
+    public ValueExpressionImpl() {
+
+    }
+
+    /**
+     * 
+     */
+    public ValueExpressionImpl(String expr, Node node, FunctionMapper fnMapper,
+            VariableMapper varMapper, Class expectedType) {
+        this.expr = expr;
+        this.node = node;
+        this.fnMapper = fnMapper;
+        this.varMapper = varMapper;
+        this.expectedType = expectedType;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals(Object obj) {
+        return (obj instanceof ValueExpressionImpl && obj.hashCode() == this
+                .hashCode());
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.el.ValueExpression#getExpectedType()
+     */
+    public Class getExpectedType() {
+        return this.expectedType;
+    }
+
+    /**
+     * Returns the type the result of the expression will be coerced to after
+     * evaluation.
+     * 
+     * @return the <code>expectedType</code> passed to the
+     *         <code>ExpressionFactory.createValueExpression</code> method
+     *         that created this <code>ValueExpression</code>.
+     * 
+     * @see javax.el.Expression#getExpressionString()
+     */
+    public String getExpressionString() {
+        return this.expr;
+    }
+
+    /**
+     * @return
+     * @throws ELException
+     */
+    private Node getNode() throws ELException {
+        if (this.node == null) {
+            this.node = ExpressionBuilder.createNode(this.expr);
+        }
+        return this.node;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.el.ValueExpression#getType(javax.el.ELContext)
+     */
+    public Class getType(ELContext context) throws PropertyNotFoundException,
+            ELException {
+        EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
+                this.varMapper);
+        return this.getNode().getType(ctx);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.el.ValueExpression#getValue(javax.el.ELContext)
+     */
+    public Object getValue(ELContext context) throws PropertyNotFoundException,
+            ELException {
+        EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
+                this.varMapper);
+        Object value = this.getNode().getValue(ctx);
+        if (this.expectedType != null) {
+            return ELSupport.coerceToType(value, this.expectedType);
+        }
+        return value;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Object#hashCode()
+     */
+    public int hashCode() {
+        return this.expr.hashCode();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.el.ValueExpression#isLiteralText()
+     */
+    public boolean isLiteralText() {
+        try {
+            return this.getNode() instanceof AstLiteralExpression;
+        } catch (ELException ele) {
+            return false;
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.el.ValueExpression#isReadOnly(javax.el.ELContext)
+     */
+    public boolean isReadOnly(ELContext context)
+            throws PropertyNotFoundException, ELException {
+        EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
+                this.varMapper);
+        return this.getNode().isReadOnly(ctx);
+    }
+
+    public void readExternal(ObjectInput in) throws IOException,
+            ClassNotFoundException {
+        this.expr = in.readUTF();
+        String type = in.readUTF();
+        if (!"".equals(type)) {
+            this.expectedType = ReflectionUtil.forName(type);
+        }
+        this.fnMapper = (FunctionMapper) in.readObject();
+        this.varMapper = (VariableMapper) in.readObject();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.el.ValueExpression#setValue(javax.el.ELContext,
+     *      java.lang.Object)
+     */
+    public void setValue(ELContext context, Object value)
+            throws PropertyNotFoundException, PropertyNotWritableException,
+            ELException {
+        EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
+                this.varMapper);
+        this.getNode().setValue(ctx, value);
+    }
+
+    public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeUTF(this.expr);
+        out.writeUTF((this.expectedType != null) ? this.expectedType.getName()
+                : "");
+        out.writeObject(this.fnMapper);
+        out.writeObject(this.varMapper);
+    }
+
+    public String toString() {
+        return "ValueExpression["+this.expr+"]";
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/ValueExpressionLiteral.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/ValueExpressionLiteral.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/ValueExpressionLiteral.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/ValueExpressionLiteral.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.el;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import javax.el.ELContext;
+import javax.el.PropertyNotWritableException;
+
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import javax.el.ValueExpression;
+
+import org.apache.el.lang.ELSupport;
+import org.apache.el.util.MessageFactory;
+import org.apache.el.util.ReflectionUtil;
+
+
+public final class ValueExpressionLiteral extends ValueExpression implements
+        Externalizable {
+
+    private static final long serialVersionUID = 1L;
+
+    private Object value;
+
+    private Class expectedType;
+
+    public ValueExpressionLiteral() {
+        super();
+    }
+    
+    public ValueExpressionLiteral(Object value, Class expectedType) {
+        this.value = value;
+        this.expectedType = expectedType;
+    }
+
+    public Object getValue(ELContext context) {
+        if (this.expectedType != null) {
+            return ELSupport.coerceToType(this.value, this.expectedType);
+        }
+        return this.value;
+    }
+
+    public void setValue(ELContext context, Object value) {
+        throw new PropertyNotWritableException(MessageFactory.get(
+                "error.value.literal.write", this.value));
+    }
+
+    public boolean isReadOnly(ELContext context) {
+        return true;
+    }
+
+    public Class getType(ELContext context) {
+        return (this.value != null) ? this.value.getClass() : null;
+    }
+
+    public Class getExpectedType() {
+        return this.expectedType;
+    }
+
+    public String getExpressionString() {
+        return (this.value != null) ? this.value.toString() : null;
+    }
+
+    public boolean equals(Object obj) {
+        return (obj instanceof ValueExpressionLiteral && this
+                .equals((ValueExpressionLiteral) obj));
+    }
+
+    public boolean equals(ValueExpressionLiteral ve) {
+        return (ve != null && (this.value != null && ve.value != null && (this.value == ve.value || this.value
+                .equals(ve.value))));
+    }
+
+    public int hashCode() {
+        return (this.value != null) ? this.value.hashCode() : 0;
+    }
+
+    public boolean isLiteralText() {
+        return true;
+    }
+
+    public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(this.value);
+        out.writeUTF((this.expectedType != null) ? this.expectedType.getName()
+                : "");
+    }
+
+    public void readExternal(ObjectInput in) throws IOException,
+            ClassNotFoundException {
+        this.value = in.readObject();
+        String type = in.readUTF();
+        if (!"".equals(type)) {
+            this.expectedType = ReflectionUtil.forName(type);
+        }
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/ELArithmetic.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/ELArithmetic.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/ELArithmetic.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/ELArithmetic.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,376 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.el.lang;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import org.apache.el.util.MessageFactory;
+
+
+/**
+ * A helper class of Arithmetic defined by the EL Specification
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dpatil $
+ */
+public abstract class ELArithmetic {
+
+    public final static class BigDecimalDelegate extends ELArithmetic {
+
+        protected Number add(Number num0, Number num1) {
+            return ((BigDecimal) num0).add((BigDecimal) num1);
+        }
+
+        protected Number coerce(Number num) {
+            if (num instanceof BigDecimal)
+                return num;
+            if (num instanceof BigInteger)
+                return new BigDecimal((BigInteger) num);
+            return new BigDecimal(num.doubleValue());
+        }
+
+        protected Number coerce(String str) {
+            return new BigDecimal(str);
+        }
+
+        protected Number divide(Number num0, Number num1) {
+            return ((BigDecimal) num0).divide((BigDecimal) num1,
+                    BigDecimal.ROUND_HALF_UP);
+        }
+
+        protected Number subtract(Number num0, Number num1) {
+            return ((BigDecimal) num0).subtract((BigDecimal) num1);
+        }
+
+        protected Number mod(Number num0, Number num1) {
+            return new Double(num0.doubleValue() % num1.doubleValue());
+        }
+
+        protected Number multiply(Number num0, Number num1) {
+            return ((BigDecimal) num0).multiply((BigDecimal) num1);
+        }
+
+        public boolean matches(Object obj0, Object obj1) {
+            return (obj0 instanceof BigDecimal || obj1 instanceof BigDecimal);
+        }
+    }
+
+    public final static class BigIntegerDelegate extends ELArithmetic {
+
+        protected Number add(Number num0, Number num1) {
+            return ((BigInteger) num0).add((BigInteger) num1);
+        }
+
+        protected Number coerce(Number num) {
+            if (num instanceof BigInteger)
+                return num;
+            return new BigInteger(num.toString());
+        }
+
+        protected Number coerce(String str) {
+            return new BigInteger(str);
+        }
+
+        protected Number divide(Number num0, Number num1) {
+            return (new BigDecimal((BigInteger) num0)).divide(new BigDecimal((BigInteger) num1), BigDecimal.ROUND_HALF_UP);
+        }
+
+        protected Number multiply(Number num0, Number num1) {
+            return ((BigInteger) num0).multiply((BigInteger) num1);
+        }
+
+        protected Number mod(Number num0, Number num1) {
+            return ((BigInteger) num0).mod((BigInteger) num1);
+        }
+
+        protected Number subtract(Number num0, Number num1) {
+            return ((BigInteger) num0).subtract((BigInteger) num1);
+        }
+
+        public boolean matches(Object obj0, Object obj1) {
+            return (obj0 instanceof BigInteger || obj1 instanceof BigInteger);
+        }
+    }
+
+    public final static class DoubleDelegate extends ELArithmetic {
+
+        protected Number add(Number num0, Number num1) {
+        	// could only be one of these
+        	if (num0 instanceof BigDecimal) {
+        		return ((BigDecimal) num0).add(new BigDecimal(num1.doubleValue()));
+        	} else if (num1 instanceof BigDecimal) {
+        		return ((new BigDecimal(num0.doubleValue()).add((BigDecimal) num1)));
+        	}
+            return new Double(num0.doubleValue() + num1.doubleValue());
+        }
+
+        protected Number coerce(Number num) {
+            if (num instanceof Double)
+                return num;
+            if (num instanceof BigInteger)
+            	return new BigDecimal((BigInteger) num);
+            return new Double(num.doubleValue());
+        }
+
+        protected Number coerce(String str) {
+            return new Double(str);
+        }
+
+        protected Number divide(Number num0, Number num1) {
+            return new Double(num0.doubleValue() / num1.doubleValue());
+        }
+
+        protected Number mod(Number num0, Number num1) {
+            return new Double(num0.doubleValue() % num1.doubleValue());
+        }
+
+        protected Number subtract(Number num0, Number num1) {
+        	// could only be one of these
+        	if (num0 instanceof BigDecimal) {
+        		return ((BigDecimal) num0).subtract(new BigDecimal(num1.doubleValue()));
+        	} else if (num1 instanceof BigDecimal) {
+        		return ((new BigDecimal(num0.doubleValue()).subtract((BigDecimal) num1)));
+        	}
+            return new Double(num0.doubleValue() - num1.doubleValue());
+        }
+
+        protected Number multiply(Number num0, Number num1) {
+        	// could only be one of these
+        	if (num0 instanceof BigDecimal) {
+        		return ((BigDecimal) num0).multiply(new BigDecimal(num1.doubleValue()));
+        	} else if (num1 instanceof BigDecimal) {
+        		return ((new BigDecimal(num0.doubleValue()).multiply((BigDecimal) num1)));
+        	}
+            return new Double(num0.doubleValue() * num1.doubleValue());
+        }
+
+        public boolean matches(Object obj0, Object obj1) {
+            return (obj0 instanceof Double
+                    || obj1 instanceof Double
+                    || obj0 instanceof Float
+                    || obj1 instanceof Float
+                    || (obj0 != null && (Double.TYPE == obj0.getClass() || Float.TYPE == obj0.getClass()))
+                    || (obj1 != null && (Double.TYPE == obj1.getClass() || Float.TYPE == obj1.getClass()))
+                    || (obj0 instanceof String && ELSupport
+                            .isStringFloat((String) obj0)) || (obj1 instanceof String && ELSupport
+                    .isStringFloat((String) obj1)));
+        }
+    }
+
+    public final static class LongDelegate extends ELArithmetic {
+
+        protected Number add(Number num0, Number num1) {
+            return new Long(num0.longValue() + num1.longValue());
+        }
+
+        protected Number coerce(Number num) {
+            if (num instanceof Long)
+                return num;
+            return new Long(num.longValue());
+        }
+
+        protected Number coerce(String str) {
+            return new Long(str);
+        }
+
+        protected Number divide(Number num0, Number num1) {
+            return new Long(num0.longValue() / num1.longValue());
+        }
+
+        protected Number mod(Number num0, Number num1) {
+            return new Long(num0.longValue() % num1.longValue());
+        }
+
+        protected Number subtract(Number num0, Number num1) {
+            return new Long(num0.longValue() - num1.longValue());
+        }
+
+        protected Number multiply(Number num0, Number num1) {
+            return new Long(num0.longValue() * num1.longValue());
+        }
+
+        public boolean matches(Object obj0, Object obj1) {
+            return (obj0 instanceof Long || obj1 instanceof Long);
+        }
+    }
+
+    public final static BigDecimalDelegate BIGDECIMAL = new BigDecimalDelegate();
+
+    public final static BigIntegerDelegate BIGINTEGER = new BigIntegerDelegate();
+
+    public final static DoubleDelegate DOUBLE = new DoubleDelegate();
+
+    public final static LongDelegate LONG = new LongDelegate();
+
+    private final static Long ZERO = new Long(0);
+
+    public final static Number add(final Object obj0, final Object obj1) {
+        if (obj0 == null && obj1 == null) {
+            return new Long(0);
+        }
+
+        final ELArithmetic delegate;
+        if (BIGDECIMAL.matches(obj0, obj1))
+            delegate = BIGDECIMAL;
+        else if (DOUBLE.matches(obj0, obj1))
+            delegate = DOUBLE;
+        else if (BIGINTEGER.matches(obj0, obj1))
+            delegate = BIGINTEGER;
+        else
+            delegate = LONG;
+
+        Number num0 = delegate.coerce(obj0);
+        Number num1 = delegate.coerce(obj1);
+
+        return delegate.add(num0, num1);
+    }
+
+    public final static Number mod(final Object obj0, final Object obj1) {
+        if (obj0 == null && obj1 == null) {
+            return new Long(0);
+        }
+
+        final ELArithmetic delegate;
+        if (BIGDECIMAL.matches(obj0, obj1))
+            delegate = BIGDECIMAL;
+        else if (DOUBLE.matches(obj0, obj1))
+            delegate = DOUBLE;
+        else if (BIGINTEGER.matches(obj0, obj1))
+            delegate = BIGINTEGER;
+        else
+            delegate = LONG;
+
+        Number num0 = delegate.coerce(obj0);
+        Number num1 = delegate.coerce(obj1);
+
+        return delegate.mod(num0, num1);
+    }
+
+    public final static Number subtract(final Object obj0, final Object obj1) {
+        if (obj0 == null && obj1 == null) {
+            return new Long(0);
+        }
+
+        final ELArithmetic delegate;
+        if (BIGDECIMAL.matches(obj0, obj1))
+            delegate = BIGDECIMAL;
+        else if (DOUBLE.matches(obj0, obj1))
+            delegate = DOUBLE;
+        else if (BIGINTEGER.matches(obj0, obj1))
+            delegate = BIGINTEGER;   
+        else
+            delegate = LONG;
+
+        Number num0 = delegate.coerce(obj0);
+        Number num1 = delegate.coerce(obj1);
+
+        return delegate.subtract(num0, num1);
+    }
+
+    public final static Number divide(final Object obj0, final Object obj1) {
+        if (obj0 == null && obj1 == null) {
+            return ZERO;
+        }
+
+        final ELArithmetic delegate;
+        if (BIGDECIMAL.matches(obj0, obj1))
+            delegate = BIGDECIMAL;
+        else if (BIGINTEGER.matches(obj0, obj1))
+            delegate = BIGDECIMAL;
+        else
+            delegate = DOUBLE;
+
+        Number num0 = delegate.coerce(obj0);
+        Number num1 = delegate.coerce(obj1);
+
+        return delegate.divide(num0, num1);
+    }
+
+    public final static Number multiply(final Object obj0, final Object obj1) {
+        if (obj0 == null && obj1 == null) {
+            return new Long(0);
+        }
+
+        final ELArithmetic delegate;
+        if (BIGDECIMAL.matches(obj0, obj1))
+            delegate = BIGDECIMAL;
+        else if (DOUBLE.matches(obj0, obj1))
+            delegate = DOUBLE;
+        else if (BIGINTEGER.matches(obj0, obj1))
+            delegate = BIGINTEGER;
+        else
+            delegate = LONG;
+
+        Number num0 = delegate.coerce(obj0);
+        Number num1 = delegate.coerce(obj1);
+
+        return delegate.multiply(num0, num1);
+    }
+
+    public final static boolean isNumber(final Object obj) {
+        return (obj != null && isNumberType(obj.getClass()));
+    }
+
+    public final static boolean isNumberType(final Class type) {
+        return type == (java.lang.Long.class) || type == Long.TYPE || type == (java.lang.Double.class) || type == Double.TYPE || type == (java.lang.Byte.class) || type == Byte.TYPE || type == (java.lang.Short.class) || type == Short.TYPE || type == (java.lang.Integer.class) || type == Integer.TYPE || type == (java.lang.Float.class) || type == Float.TYPE || type == (java.math.BigInteger.class) || type == (java.math.BigDecimal.class);
+    }
+
+    /**
+     * 
+     */
+    protected ELArithmetic() {
+        super();
+    }
+
+    protected abstract Number add(final Number num0, final Number num1);
+
+    protected abstract Number multiply(final Number num0, final Number num1);
+
+    protected abstract Number subtract(final Number num0, final Number num1);
+
+    protected abstract Number mod(final Number num0, final Number num1);
+
+    protected abstract Number coerce(final Number num);
+
+    protected final Number coerce(final Object obj) {
+        
+        if (isNumber(obj)) {
+            return coerce((Number) obj);
+        }
+        if (obj instanceof String) {
+            return coerce((String) obj);
+        }
+        if (obj == null || "".equals(obj)) {
+            return coerce(ZERO);
+        }
+
+        Class objType = obj.getClass();
+        if (Character.class.equals(objType) || Character.TYPE == objType) {
+            return coerce(new Short((short) ((Character) obj).charValue()));
+        }
+
+        throw new IllegalArgumentException(MessageFactory.get("el.convert", obj,
+                objType));
+    }
+
+    protected abstract Number coerce(final String str);
+
+    protected abstract Number divide(final Number num0, final Number num1);
+
+    protected abstract boolean matches(final Object obj0, final Object obj1);
+
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/ELSupport.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/ELSupport.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/ELSupport.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/ELSupport.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,442 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.el.lang;
+
+import java.beans.PropertyEditor;
+import java.beans.PropertyEditorManager;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import javax.el.ELException;
+import javax.el.PropertyNotFoundException;
+
+import org.apache.el.util.MessageFactory;
+
+
+/**
+ * A helper class that implements the EL Specification
+ * 
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $
+ */
+public class ELSupport {
+
+    private final static ELSupport REF = new ELSupport();
+
+    private final static Long ZERO = new Long(0L);
+
+    public final static void throwUnhandled(Object base, Object property)
+            throws ELException {
+        if (base == null) {
+            throw new PropertyNotFoundException(MessageFactory.get(
+                    "error.resolver.unhandled.null", property));
+        } else {
+            throw new PropertyNotFoundException(MessageFactory.get(
+                    "error.resolver.unhandled", base.getClass(), property));
+        }
+    }
+
+    /**
+     * @param obj0
+     * @param obj1
+     * @return
+     * @throws EvaluationException
+     */
+    public final static int compare(final Object obj0, final Object obj1)
+            throws ELException {
+        if (obj0 == obj1 || equals(obj0, obj1)) {
+            return 0;
+        }
+        if (isBigDecimalOp(obj0, obj1)) {
+            BigDecimal bd0 = (BigDecimal) coerceToNumber(obj0, BigDecimal.class);
+            BigDecimal bd1 = (BigDecimal) coerceToNumber(obj1, BigDecimal.class);
+            return bd0.compareTo(bd1);
+        }
+        if (isDoubleOp(obj0, obj1)) {
+            Double d0 = (Double) coerceToNumber(obj0, Double.class);
+            Double d1 = (Double) coerceToNumber(obj1, Double.class);
+            return d0.compareTo(d1);
+        }
+        if (isBigIntegerOp(obj0, obj1)) {
+            BigInteger bi0 = (BigInteger) coerceToNumber(obj0, BigInteger.class);
+            BigInteger bi1 = (BigInteger) coerceToNumber(obj1, BigInteger.class);
+            return bi0.compareTo(bi1);
+        }
+        if (isLongOp(obj0, obj1)) {
+            Long l0 = (Long) coerceToNumber(obj0, Long.class);
+            Long l1 = (Long) coerceToNumber(obj1, Long.class);
+            return l0.compareTo(l1);
+        }
+        if (obj0 instanceof String || obj1 instanceof String) {
+            return coerceToString(obj0).compareTo(coerceToString(obj1));
+        }
+        if (obj0 instanceof Comparable) {
+            return (obj1 != null) ? ((Comparable) obj0).compareTo(obj1) : 1;
+        }
+        if (obj1 instanceof Comparable) {
+            return (obj0 != null) ? -((Comparable) obj1).compareTo(obj0) : -1;
+        }
+        throw new ELException(MessageFactory.get("error.compare", obj0, obj1));
+    }
+
+    /**
+     * @param obj0
+     * @param obj1
+     * @return
+     * @throws EvaluationException
+     */
+    public final static boolean equals(final Object obj0, final Object obj1)
+            throws ELException {
+        if (obj0 == obj1) {
+            return true;
+        } else if (obj0 == null || obj1 == null) {
+            return false;
+        } else if (obj0 instanceof Boolean || obj1 instanceof Boolean) {
+            return coerceToBoolean(obj0).equals(coerceToBoolean(obj1));
+        }
+        if (isBigDecimalOp(obj0, obj1)) {
+            BigDecimal bd0 = (BigDecimal) coerceToNumber(obj0, BigDecimal.class);
+            BigDecimal bd1 = (BigDecimal) coerceToNumber(obj1, BigDecimal.class);
+            return bd0.equals(bd1);
+        }
+        if (isDoubleOp(obj0, obj1)) {
+            Double d0 = (Double) coerceToNumber(obj0, Double.class);
+            Double d1 = (Double) coerceToNumber(obj1, Double.class);
+            return d0.equals(d1);
+        }
+        if (isBigIntegerOp(obj0, obj1)) {
+            BigInteger bi0 = (BigInteger) coerceToNumber(obj0, BigInteger.class);
+            BigInteger bi1 = (BigInteger) coerceToNumber(obj1, BigInteger.class);
+            return bi0.equals(bi1);
+        }
+        if (isLongOp(obj0, obj1)) {
+            Long l0 = (Long) coerceToNumber(obj0, Long.class);
+            Long l1 = (Long) coerceToNumber(obj1, Long.class);
+            return l0.equals(l1);
+        } else {
+            return obj0.equals(obj1);
+        }
+    }
+
+    /**
+     * @param obj
+     * @return
+     */
+    public final static Boolean coerceToBoolean(final Object obj)
+            throws IllegalArgumentException {
+        if (obj == null || "".equals(obj)) {
+            return Boolean.FALSE;
+        }
+        if (obj instanceof Boolean || obj.getClass() == Boolean.TYPE) {
+            return (Boolean) obj;
+        }
+        if (obj instanceof String) {
+            return Boolean.valueOf((String) obj);
+        }
+
+        throw new IllegalArgumentException(MessageFactory.get("error.convert",
+                obj, obj.getClass(), Boolean.class));
+    }
+
+    public final static Character coerceToCharacter(final Object obj)
+            throws IllegalArgumentException {
+        if (obj == null || "".equals(obj)) {
+            return new Character((char) 0);
+        }
+        if (obj instanceof String) {
+            return new Character(((String) obj).charAt(0));
+        }
+        if (ELArithmetic.isNumber(obj)) {
+            return new Character((char) ((Number) obj).shortValue());
+        }
+        Class objType = obj.getClass();
+        if (obj instanceof Character || objType == Character.TYPE) {
+            return (Character) obj;
+        }
+
+        throw new IllegalArgumentException(MessageFactory.get("error.convert",
+                obj, objType, Character.class));
+    }
+
+    public final static Number coerceToNumber(final Object obj) {
+        if (obj == null) {
+            return ZERO;
+        } else if (obj instanceof Number) {
+            return (Number) obj;
+        } else {
+            String str = coerceToString(obj);
+            if (isStringFloat(str)) {
+                return toFloat(str);
+            } else {
+                return toNumber(str);
+            }
+        }
+    }
+
+    protected final static Number coerceToNumber(final Number number,
+            final Class type) throws IllegalArgumentException {
+        if (Long.TYPE == type || Long.class.equals(type)) {
+            return new Long(number.longValue());
+        }
+        if (Double.TYPE == type || Double.class.equals(type)) {
+            return new Double(number.doubleValue());
+        }
+        if (Integer.TYPE == type || Integer.class.equals(type)) {
+            return new Integer(number.intValue());
+        }
+        if (BigInteger.class.equals(type)) {
+            if (number instanceof BigDecimal) {
+                return ((BigDecimal) number).toBigInteger();
+            }
+            return BigInteger.valueOf(number.longValue());
+        }
+        if (BigDecimal.class.equals(type)) {
+            if (number instanceof BigInteger) {
+                return new BigDecimal((BigInteger) number);
+            }
+            return new BigDecimal(number.doubleValue());
+        }
+        if (Byte.TYPE == type || Byte.class.equals(type)) {
+            return new Byte(number.byteValue());
+        }
+        if (Short.TYPE == type || Short.class.equals(type)) {
+            return new Short(number.shortValue());
+        }
+        if (Float.TYPE == type || Float.class.equals(type)) {
+            return new Float(number.floatValue());
+        }
+
+        throw new IllegalArgumentException(MessageFactory.get("error.convert",
+                number, number.getClass(), type));
+    }
+
+    public final static Number coerceToNumber(final Object obj, final Class type)
+            throws IllegalArgumentException {
+        if (obj == null || "".equals(obj)) {
+            return coerceToNumber(ZERO, type);
+        }
+        if (obj instanceof String) {
+            return coerceToNumber((String) obj, type);
+        }
+        if (ELArithmetic.isNumber(obj)) {
+            return coerceToNumber((Number) obj, type);
+        }
+
+        Class objType = obj.getClass();
+        if (Character.class.equals(objType) || Character.TYPE == objType) {
+            return coerceToNumber(new Short((short) ((Character) obj)
+                    .charValue()), type);
+        }
+
+        throw new IllegalArgumentException(MessageFactory.get("error.convert",
+                obj, objType, type));
+    }
+
+    protected final static Number coerceToNumber(final String val,
+            final Class type) throws IllegalArgumentException {
+        if (Long.TYPE == type || Long.class.equals(type)) {
+            return Long.valueOf(val);
+        }
+        if (Integer.TYPE == type || Integer.class.equals(type)) {
+            return Integer.valueOf(val);
+        }
+        if (Double.TYPE == type || Double.class.equals(type)) {
+            return Double.valueOf(val);
+        }
+        if (BigInteger.class.equals(type)) {
+            return new BigInteger(val);
+        }
+        if (BigDecimal.class.equals(type)) {
+            return new BigDecimal(val);
+        }
+        if (Byte.TYPE == type || Byte.class.equals(type)) {
+            return Byte.valueOf(val);
+        }
+        if (Short.TYPE == type || Short.class.equals(type)) {
+            return Short.valueOf(val);
+        }
+        if (Float.TYPE == type || Float.class.equals(type)) {
+            return Float.valueOf(val);
+        }
+
+        throw new IllegalArgumentException(MessageFactory.get("error.convert",
+                val, String.class, type));
+    }
+
+    /**
+     * @param obj
+     * @return
+     */
+    public final static String coerceToString(final Object obj) {
+        if (obj == null) {
+            return "";
+        } else if (obj instanceof String) {
+            return (String) obj;
+        } else {
+            return obj.toString();
+        }
+    }
+
+    public final static Object coerceToType(final Object obj, final Class type)
+            throws IllegalArgumentException {
+        if (type == null || Object.class.equals(type)) {
+            return obj;
+        }
+        if (String.class.equals(type)) {
+            return coerceToString(obj);
+        }
+        if (ELArithmetic.isNumberType(type)) {
+            return coerceToNumber(obj, type);
+        }
+        if (Character.class.equals(type) || Character.TYPE == type) {
+            return coerceToCharacter(obj);
+        }
+        if (Boolean.class.equals(type) || Boolean.TYPE == type) {
+            return coerceToBoolean(obj);
+        }
+        if (obj != null && type.isAssignableFrom(obj.getClass())) {
+            return obj;
+        }
+
+        // new to spec
+        if (obj == null)
+            return null;
+        if (obj instanceof String) {
+            if ("".equals(obj))
+                return null;
+            PropertyEditor editor = PropertyEditorManager.findEditor(type);
+            if (editor != null) {
+                editor.setAsText((String) obj);
+                return editor.getValue();
+            }
+        }
+        throw new IllegalArgumentException(MessageFactory.get("error.convert",
+                obj, obj.getClass(), type));
+    }
+
+    /**
+     * @param obj
+     * @return
+     */
+    public final static boolean containsNulls(final Object[] obj) {
+        for (int i = 0; i < obj.length; i++) {
+            if (obj[0] == null) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public final static boolean isBigDecimalOp(final Object obj0,
+            final Object obj1) {
+        return (obj0 instanceof BigDecimal || obj1 instanceof BigDecimal);
+    }
+
+    public final static boolean isBigIntegerOp(final Object obj0,
+            final Object obj1) {
+        return (obj0 instanceof BigInteger || obj1 instanceof BigInteger);
+    }
+
+    public final static boolean isDoubleOp(final Object obj0, final Object obj1) {
+        return (obj0 instanceof Double
+                || obj1 instanceof Double
+                || obj0 instanceof Float
+                || obj1 instanceof Float
+                || (obj0 != null && (Double.TYPE == obj0.getClass() || Float.TYPE == obj0
+                        .getClass())) || (obj1 != null && (Double.TYPE == obj1
+                .getClass() || Float.TYPE == obj1.getClass())));
+    }
+
+    public final static boolean isDoubleStringOp(final Object obj0,
+            final Object obj1) {
+        return (isDoubleOp(obj0, obj1)
+                || (obj0 instanceof String && isStringFloat((String) obj0)) || (obj1 instanceof String && isStringFloat((String) obj1)));
+    }
+
+    public final static boolean isLongOp(final Object obj0, final Object obj1) {
+        return (obj0 instanceof Long
+                || obj1 instanceof Long
+                || obj0 instanceof Integer
+                || obj1 instanceof Integer
+                || obj0 instanceof Character
+                || obj1 instanceof Character
+                || obj0 instanceof Short
+                || obj1 instanceof Short
+                || obj0 instanceof Byte
+                || obj1 instanceof Byte
+                || (obj0 != null && (Long.TYPE == obj0.getClass()
+                        || Integer.TYPE == obj0.getClass()
+                        || Character.TYPE == obj0.getClass()
+                        || Short.TYPE == obj0.getClass() || Byte.TYPE == obj0
+                        .getClass())) || (obj0 != null && (Long.TYPE == obj0
+                .getClass()
+                || Integer.TYPE == obj0.getClass()
+                || Character.TYPE == obj0.getClass()
+                || Short.TYPE == obj0.getClass() || Byte.TYPE == obj0
+                .getClass())));
+    }
+
+    public final static boolean isStringFloat(final String str) {
+        int len = str.length();
+        if (len > 1) {
+            char c = 0;
+            for (int i = 0; i < len; i++) {
+                switch (c = str.charAt(i)) {
+                case 'E':
+                    return true;
+                case 'e':
+                    return true;
+                case '.':
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    public final static Number toFloat(final String value) {
+        try {
+            if (Double.parseDouble(value) > Double.MAX_VALUE) {
+                return new BigDecimal(value);
+            } else {
+                return new Double(value);
+            }
+        } catch (NumberFormatException e0) {
+            return new BigDecimal(value);
+        }
+    }
+
+    public final static Number toNumber(final String value) {
+        try {
+            return new Integer(Integer.parseInt(value));
+        } catch (NumberFormatException e0) {
+            try {
+                return new Long(Long.parseLong(value));
+            } catch (NumberFormatException e1) {
+                return new BigInteger(value);
+            }
+        }
+    }
+
+    /**
+     * 
+     */
+    public ELSupport() {
+        super();
+    }
+
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/EvaluationContext.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/EvaluationContext.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/EvaluationContext.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/EvaluationContext.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.el.lang;
+
+import javax.el.ELContext;
+import javax.el.ELResolver;
+import javax.el.FunctionMapper;
+import javax.el.VariableMapper;
+
+public final class EvaluationContext extends ELContext {
+
+    private final ELContext elContext;
+
+    private final FunctionMapper fnMapper;
+
+    private final VariableMapper varMapper;
+
+    public EvaluationContext(ELContext elContext, FunctionMapper fnMapper,
+            VariableMapper varMapper) {
+        this.elContext = elContext;
+        this.fnMapper = fnMapper;
+        this.varMapper = varMapper;
+    }
+
+    public ELContext getELContext() {
+        return this.elContext;
+    }
+
+    public FunctionMapper getFunctionMapper() {
+        return this.fnMapper;
+    }
+
+    public VariableMapper getVariableMapper() {
+        return this.varMapper;
+    }
+
+    public Object getContext(Class key) {
+        return this.elContext.getContext(key);
+    }
+
+    public ELResolver getELResolver() {
+        return this.elContext.getELResolver();
+    }
+
+    public boolean isPropertyResolved() {
+        return this.elContext.isPropertyResolved();
+    }
+
+    public void putContext(Class key, Object contextObject) {
+        this.elContext.putContext(key, contextObject);
+    }
+
+    public void setPropertyResolved(boolean resolved) {
+        this.elContext.setPropertyResolved(resolved);
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/ExpressionBuilder.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/ExpressionBuilder.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/ExpressionBuilder.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/ExpressionBuilder.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.el.lang;
+
+import java.io.StringReader;
+import java.lang.ref.SoftReference;
+import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.WeakHashMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.FunctionMapper;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+import javax.el.VariableMapper;
+
+import org.apache.el.MethodExpressionImpl;
+import org.apache.el.MethodExpressionLiteral;
+import org.apache.el.ValueExpressionImpl;
+import org.apache.el.parser.AstCompositeExpression;
+import org.apache.el.parser.AstDeferredExpression;
+import org.apache.el.parser.AstDynamicExpression;
+import org.apache.el.parser.AstFunction;
+import org.apache.el.parser.AstIdentifier;
+import org.apache.el.parser.AstLiteralExpression;
+import org.apache.el.parser.AstValue;
+import org.apache.el.parser.ELParser;
+import org.apache.el.parser.Node;
+import org.apache.el.parser.NodeVisitor;
+import org.apache.el.parser.ParseException;
+import org.apache.el.util.ConcurrentCache;
+import org.apache.el.util.MessageFactory;
+
+/**
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: jhook $
+ */
+public final class ExpressionBuilder implements NodeVisitor {
+
+	private static final ConcurrentCache cache = new ConcurrentCache(5000);
+
+	private FunctionMapper fnMapper;
+
+	private VariableMapper varMapper;
+
+	private String expression;
+
+	/**
+	 * 
+	 */
+	public ExpressionBuilder(String expression, ELContext ctx)
+			throws ELException {
+		this.expression = expression;
+
+		FunctionMapper ctxFn = ctx.getFunctionMapper();
+		VariableMapper ctxVar = ctx.getVariableMapper();
+
+		if (ctxFn != null) {
+			this.fnMapper = new FunctionMapperFactory(ctxFn);
+		}
+		if (ctxVar != null) {
+			this.varMapper = new VariableMapperFactory(ctxVar);
+		}
+	}
+
+	public final static Node createNode(String expr) throws ELException {
+		Node n = createNodeInternal(expr);
+		return n;
+	}
+
+	private final static Node createNodeInternal(String expr)
+			throws ELException {
+		if (expr == null) {
+			throw new ELException(MessageFactory.get("error.null"));
+		}
+
+		Node n = (Node) cache.get(expr);
+		if (n == null) {
+			try {
+				n = (new ELParser(new StringReader(expr)))
+						.CompositeExpression();
+
+				// validate composite expression
+				if (n instanceof AstCompositeExpression) {
+					int numChildren = n.jjtGetNumChildren();
+					if (numChildren == 1) {
+						n = n.jjtGetChild(0);
+					} else {
+						Class type = null;
+						Node child = null;
+						for (int i = 0; i < numChildren; i++) {
+							child = n.jjtGetChild(i);
+							if (child instanceof AstLiteralExpression)
+								continue;
+							if (type == null)
+								type = child.getClass();
+							else {
+								if (!type.equals(child.getClass())) {
+									throw new ELException(MessageFactory.get(
+											"error.mixed", expr));
+								}
+							}
+						}
+					}
+				}
+				if (n instanceof AstDeferredExpression
+						|| n instanceof AstDynamicExpression) {
+					n = n.jjtGetChild(0);
+				}
+				cache.put(expr, n);
+			} catch (ParseException pe) {
+				throw new ELException("Error Parsing: " + expr, pe);
+			}
+		}
+		return n;
+	}
+
+	private void prepare(Node node) throws ELException {
+		node.accept(this);
+		if (this.fnMapper instanceof FunctionMapperFactory) {
+			this.fnMapper = ((FunctionMapperFactory) this.fnMapper).create();
+		}
+		if (this.varMapper instanceof VariableMapperFactory) {
+			this.varMapper = ((VariableMapperFactory) this.varMapper).create();
+		}
+	}
+
+	private Node build() throws ELException {
+		Node n = createNodeInternal(this.expression);
+		this.prepare(n);
+		if (n instanceof AstDeferredExpression
+				|| n instanceof AstDynamicExpression) {
+			n = n.jjtGetChild(0);
+		}
+		return n;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.sun.el.parser.NodeVisitor#visit(com.sun.el.parser.Node)
+	 */
+	public void visit(Node node) throws ELException {
+		if (node instanceof AstFunction) {
+
+			AstFunction funcNode = (AstFunction) node;
+
+			if (this.fnMapper == null) {
+				throw new ELException(MessageFactory.get("error.fnMapper.null"));
+			}
+			Method m = fnMapper.resolveFunction(funcNode.getPrefix(), funcNode
+					.getLocalName());
+			if (m == null) {
+				throw new ELException(MessageFactory.get(
+						"error.fnMapper.method", funcNode.getOutputName()));
+			}
+			int pcnt = m.getParameterTypes().length;
+			if (node.jjtGetNumChildren() != pcnt) {
+				throw new ELException(MessageFactory.get(
+						"error.fnMapper.paramcount", funcNode.getOutputName(),
+						"" + pcnt, "" + node.jjtGetNumChildren()));
+			}
+		} else if (node instanceof AstIdentifier && this.varMapper != null) {
+			String variable = ((AstIdentifier) node).getImage();
+
+			// simply capture it
+			this.varMapper.resolveVariable(variable);
+		}
+	}
+
+	public ValueExpression createValueExpression(Class expectedType)
+			throws ELException {
+		Node n = this.build();
+		return new ValueExpressionImpl(this.expression, n, this.fnMapper,
+				this.varMapper, expectedType);
+	}
+
+	public MethodExpression createMethodExpression(Class expectedReturnType,
+			Class[] expectedParamTypes) throws ELException {
+		Node n = this.build();
+		if (n instanceof AstValue || n instanceof AstIdentifier) {
+			return new MethodExpressionImpl(expression, n, this.fnMapper,
+					this.varMapper, expectedReturnType, expectedParamTypes);
+		} else if (n instanceof AstLiteralExpression) {
+			return new MethodExpressionLiteral(expression, expectedReturnType,
+					expectedParamTypes);
+		} else {
+			throw new ELException("Not a Valid Method Expression: "
+					+ expression);
+		}
+	}
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/FunctionMapperFactory.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/FunctionMapperFactory.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/FunctionMapperFactory.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/FunctionMapperFactory.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.el.lang;
+
+import java.lang.reflect.Method;
+
+import javax.el.FunctionMapper;
+
+/**
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dpatil $
+ */
+public class FunctionMapperFactory extends FunctionMapper {
+
+    protected FunctionMapperImpl memento = null;
+    protected FunctionMapper target;
+    
+    public FunctionMapperFactory(FunctionMapper mapper) {
+        if (mapper == null) {
+            throw new NullPointerException("FunctionMapper target cannot be null");
+        }
+        this.target = mapper;
+    }
+   
+    
+    /* (non-Javadoc)
+     * @see javax.el.FunctionMapper#resolveFunction(java.lang.String, java.lang.String)
+     */
+    public Method resolveFunction(String prefix, String localName) {
+        if (this.memento == null) {
+            this.memento = new FunctionMapperImpl();
+        }
+        Method m = this.target.resolveFunction(prefix, localName);
+        if (m != null) {
+            this.memento.addFunction(prefix, localName, m);
+        }
+        return m;
+    }
+    
+    public FunctionMapper create() {
+        return this.memento;
+    }
+
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/FunctionMapperImpl.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/FunctionMapperImpl.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/FunctionMapperImpl.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/FunctionMapperImpl.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.el.lang;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.el.FunctionMapper;
+
+import org.apache.el.util.ReflectionUtil;
+
+
+/**
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dpatil $
+ */
+public class FunctionMapperImpl extends FunctionMapper implements
+        Externalizable {
+
+    private static final long serialVersionUID = 1L;
+    
+    protected Map functions = null;
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.el.FunctionMapper#resolveFunction(java.lang.String,
+     *      java.lang.String)
+     */
+    public Method resolveFunction(String prefix, String localName) {
+        if (this.functions != null) {
+            Function f = (Function) this.functions.get(prefix + ":" + localName);
+            return f.getMethod();
+        }
+        return null;
+    }
+
+    public void addFunction(String prefix, String localName, Method m) {
+        if (this.functions == null) {
+            this.functions = new HashMap();
+        }
+        Function f = new Function(prefix, localName, m);
+        synchronized (this) {
+            this.functions.put(prefix+":"+localName, f);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
+     */
+    public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(this.functions);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
+     */
+    public void readExternal(ObjectInput in) throws IOException,
+            ClassNotFoundException {
+        this.functions = (Map) in.readObject();
+    }
+    
+    public static class Function implements Externalizable {
+    
+        protected transient Method m;
+        protected String owner;
+        protected String name;
+        protected String[] types;
+        protected String prefix;
+        protected String localName;
+    
+        /**
+         * 
+         */
+        public Function(String prefix, String localName, Method m) {
+            if (localName == null) {
+                throw new NullPointerException("LocalName cannot be null");
+            }
+            if (m == null) {
+                throw new NullPointerException("Method cannot be null");
+            }
+            this.prefix = prefix;
+            this.localName = localName;
+            this.m = m;
+        }
+        
+        public Function() {
+            // for serialization
+        }
+    
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
+         */
+        public void writeExternal(ObjectOutput out) throws IOException {
+            out.writeUTF((this.prefix != null) ? this.prefix : "");
+            out.writeUTF(this.localName);
+            out.writeUTF(this.m.getDeclaringClass().getName());
+            out.writeUTF(this.m.getName());
+            out.writeObject(ReflectionUtil.toTypeNameArray(this.m.getParameterTypes()));
+        }
+    
+        /*
+         * (non-Javadoc)
+         * 
+         * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
+         */
+        public void readExternal(ObjectInput in) throws IOException,
+                ClassNotFoundException {
+            
+            this.prefix = in.readUTF();
+            if ("".equals(this.prefix)) this.prefix = null;
+            this.localName = in.readUTF();
+            this.owner = in.readUTF();
+            this.name = in.readUTF();
+            this.types = (String[]) in.readObject();
+        }
+    
+        public Method getMethod() {
+            if (this.m == null) {
+                try {
+                    Class t = Class.forName(this.owner);
+                    Class[] p = ReflectionUtil.toTypeArray(this.types);
+                    this.m = t.getMethod(this.name, p);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+            return this.m;
+        }
+        
+        public boolean matches(String prefix, String localName) {
+            if (this.prefix != null) {
+                if (prefix == null) return false;
+                if (!this.prefix.equals(prefix)) return false;
+            }
+            return this.localName.equals(localName);
+        }
+    
+        /* (non-Javadoc)
+         * @see java.lang.Object#equals(java.lang.Object)
+         */
+        public boolean equals(Object obj) {
+            if (obj instanceof Function) {
+                return this.hashCode() == obj.hashCode();
+            }
+            return false;
+        }
+        
+        /* (non-Javadoc)
+         * @see java.lang.Object#hashCode()
+         */
+        public int hashCode() {
+            return (this.prefix + this.localName).hashCode();
+        }
+    }
+
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/VariableMapperFactory.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/VariableMapperFactory.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/VariableMapperFactory.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/VariableMapperFactory.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.el.lang;
+
+import javax.el.ValueExpression;
+import javax.el.VariableMapper;
+
+public class VariableMapperFactory extends VariableMapper {
+
+    private final VariableMapper target;
+    private VariableMapper momento;
+    
+    public VariableMapperFactory(VariableMapper target) {
+        if (target == null) {
+            throw new NullPointerException("Target VariableMapper cannot be null");
+        }
+        this.target = target;
+    }
+    
+    public VariableMapper create() {
+        return this.momento;
+    }
+
+    public ValueExpression resolveVariable(String variable) {
+        ValueExpression expr = this.target.resolveVariable(variable);
+        if (expr != null) {
+            if (this.momento == null) {
+                this.momento = new VariableMapperImpl();
+            }
+            this.momento.setVariable(variable, expr);
+        }
+        return expr;
+    }
+
+    public ValueExpression setVariable(String variable, ValueExpression expression) {
+        throw new UnsupportedOperationException("Cannot Set Variables on Factory");
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/VariableMapperImpl.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/VariableMapperImpl.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/VariableMapperImpl.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/VariableMapperImpl.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.el.lang;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.el.ValueExpression;
+import javax.el.VariableMapper;
+
+public class VariableMapperImpl extends VariableMapper implements Externalizable {
+
+    private static final long serialVersionUID = 1L;
+    
+    private Map vars = new HashMap();
+    
+    public VariableMapperImpl() {
+        super();
+    }
+
+    public ValueExpression resolveVariable(String variable) {
+        return (ValueExpression) this.vars.get(variable);
+    }
+
+    public ValueExpression setVariable(String variable,
+            ValueExpression expression) {
+        return (ValueExpression) this.vars.put(variable, expression);
+    }
+
+    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        this.vars = (Map) in.readObject();
+    }
+
+    public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(this.vars);
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/ArithmeticNode.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/ArithmeticNode.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/ArithmeticNode.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/ArithmeticNode.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.el.parser;
+
+import javax.el.ELException;
+
+import org.apache.el.lang.EvaluationContext;
+
+
+/**
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dpatil $
+ */
+public class ArithmeticNode extends SimpleNode {
+
+    /**
+     * @param i
+     */
+    public ArithmeticNode(int i) {
+        super(i);
+    }
+
+    public Class getType(EvaluationContext ctx)
+            throws ELException {
+        return Number.class;
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstAnd.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstAnd.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstAnd.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstAnd.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,30 @@
+/* Generated By:JJTree: Do not edit this line. AstAnd.java */
+
+package org.apache.el.parser;
+
+import javax.el.ELException;
+
+import org.apache.el.lang.EvaluationContext;
+
+
+/**
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dpatil $
+ */
+public final class AstAnd extends BooleanNode {
+    public AstAnd(int id) {
+        super(id);
+    }
+
+    public Object getValue(EvaluationContext ctx)
+            throws ELException {
+        Object obj = children[0].getValue(ctx);
+        Boolean b = coerceToBoolean(obj);
+        if (!b.booleanValue()) {
+            return b;
+        }
+        obj = children[1].getValue(ctx);
+        b = coerceToBoolean(obj);
+        return b;
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstBracketSuffix.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstBracketSuffix.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstBracketSuffix.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstBracketSuffix.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,23 @@
+/* Generated By:JJTree: Do not edit this line. AstBracketSuffix.java */
+
+package org.apache.el.parser;
+
+import javax.el.ELException;
+
+import org.apache.el.lang.EvaluationContext;
+
+
+/**
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dpatil $
+ */
+public final class AstBracketSuffix extends SimpleNode {
+    public AstBracketSuffix(int id) {
+        super(id);
+    }
+
+    public Object getValue(EvaluationContext ctx)
+            throws ELException {
+        return this.children[0].getValue(ctx);
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstChoice.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstChoice.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstChoice.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstChoice.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,31 @@
+/* Generated By:JJTree: Do not edit this line. AstChoice.java */
+
+package org.apache.el.parser;
+
+import javax.el.ELException;
+
+import org.apache.el.lang.EvaluationContext;
+
+
+/**
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dpatil $
+ */
+public final class AstChoice extends SimpleNode {
+    public AstChoice(int id) {
+        super(id);
+    }
+
+    public Class getType(EvaluationContext ctx)
+            throws ELException {
+        Object val = this.getValue(ctx);
+        return (val != null) ? val.getClass() : null;
+    }
+
+    public Object getValue(EvaluationContext ctx)
+            throws ELException {
+        Object obj0 = this.children[0].getValue(ctx);
+        Boolean b0 = coerceToBoolean(obj0);
+        return this.children[((b0.booleanValue() ? 1 : 2))].getValue(ctx);
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstCompositeExpression.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstCompositeExpression.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstCompositeExpression.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstCompositeExpression.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,39 @@
+/* Generated By:JJTree: Do not edit this line. AstCompositeExpression.java */
+
+package org.apache.el.parser;
+
+import javax.el.ELException;
+
+import org.apache.el.lang.EvaluationContext;
+
+
+/**
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dpatil $
+ */
+public final class AstCompositeExpression extends SimpleNode {
+
+    public AstCompositeExpression(int id) {
+        super(id);
+    }
+
+    public Class getType(EvaluationContext ctx)
+            throws ELException {
+        return String.class;
+    }
+
+    public Object getValue(EvaluationContext ctx)
+            throws ELException {
+        StringBuffer sb = new StringBuffer(16);
+        Object obj = null;
+        if (this.children != null) {
+            for (int i = 0; i < this.children.length; i++) {
+                obj = this.children[i].getValue(ctx);
+                if (obj != null) {
+                    sb.append(obj);
+                }
+            }
+        }
+        return sb.toString();
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstDeferredExpression.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstDeferredExpression.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstDeferredExpression.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstDeferredExpression.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,38 @@
+/* Generated By:JJTree: Do not edit this line. AstDeferredExpression.java */
+
+package org.apache.el.parser;
+
+import javax.el.ELException;
+
+import org.apache.el.lang.EvaluationContext;
+
+
+/**
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dpatil $
+ */
+public final class AstDeferredExpression extends SimpleNode {
+    public AstDeferredExpression(int id) {
+        super(id);
+    }
+
+    public Class getType(EvaluationContext ctx)
+            throws ELException {
+        return this.children[0].getType(ctx);
+    }
+
+    public Object getValue(EvaluationContext ctx)
+            throws ELException {
+        return this.children[0].getValue(ctx);
+    }
+
+    public boolean isReadOnly(EvaluationContext ctx)
+            throws ELException {
+        return this.children[0].isReadOnly(ctx);
+    }
+
+    public void setValue(EvaluationContext ctx, Object value)
+            throws ELException {
+        this.children[0].setValue(ctx, value);
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstDiv.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstDiv.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstDiv.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstDiv.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,26 @@
+/* Generated By:JJTree: Do not edit this line. AstDiv.java */
+
+package org.apache.el.parser;
+
+import javax.el.ELException;
+
+import org.apache.el.lang.ELArithmetic;
+import org.apache.el.lang.EvaluationContext;
+
+
+/**
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dpatil $
+ */
+public final class AstDiv extends ArithmeticNode {
+    public AstDiv(int id) {
+        super(id);
+    }
+
+    public Object getValue(EvaluationContext ctx)
+            throws ELException {
+        Object obj0 = this.children[0].getValue(ctx);
+        Object obj1 = this.children[1].getValue(ctx);
+        return ELArithmetic.divide(obj0, obj1);
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstDotSuffix.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstDotSuffix.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstDotSuffix.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstDotSuffix.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,23 @@
+/* Generated By:JJTree: Do not edit this line. AstDotSuffix.java */
+
+package org.apache.el.parser;
+
+import javax.el.ELException;
+
+import org.apache.el.lang.EvaluationContext;
+
+
+/**
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dpatil $
+ */
+public final class AstDotSuffix extends SimpleNode {
+    public AstDotSuffix(int id) {
+        super(id);
+    }
+
+    public Object getValue(EvaluationContext ctx)
+            throws ELException {
+        return this.image;
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstDynamicExpression.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstDynamicExpression.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstDynamicExpression.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstDynamicExpression.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,38 @@
+/* Generated By:JJTree: Do not edit this line. AstDynamicExpression.java */
+
+package org.apache.el.parser;
+
+import javax.el.ELException;
+
+import org.apache.el.lang.EvaluationContext;
+
+
+/**
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dpatil $
+ */
+public final class AstDynamicExpression extends SimpleNode {
+    public AstDynamicExpression(int id) {
+        super(id);
+    }
+
+    public Class getType(EvaluationContext ctx)
+            throws ELException {
+        return this.children[0].getType(ctx);
+    }
+
+    public Object getValue(EvaluationContext ctx)
+            throws ELException {
+        return this.children[0].getValue(ctx);
+    }
+
+    public boolean isReadOnly(EvaluationContext ctx)
+            throws ELException {
+        return this.children[0].isReadOnly(ctx);
+    }
+
+    public void setValue(EvaluationContext ctx, Object value)
+            throws ELException {
+        this.children[0].setValue(ctx, value);
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstEmpty.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstEmpty.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstEmpty.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstEmpty.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,43 @@
+/* Generated By:JJTree: Do not edit this line. AstEmpty.java */
+
+package org.apache.el.parser;
+
+import java.util.Collection;
+import java.util.Map;
+
+import javax.el.ELException;
+
+import org.apache.el.lang.EvaluationContext;
+
+
+/**
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dpatil $
+ */
+public final class AstEmpty extends SimpleNode {
+    public AstEmpty(int id) {
+        super(id);
+    }
+
+    public Class getType(EvaluationContext ctx)
+            throws ELException {
+        return Boolean.class;
+    }
+
+    public Object getValue(EvaluationContext ctx)
+            throws ELException {
+        Object obj = this.children[0].getValue(ctx);
+        if (obj == null) {
+            return Boolean.TRUE;
+        } else if (obj instanceof String) {
+            return Boolean.valueOf(((String) obj).length() == 0);
+        } else if (obj instanceof Object[]) {
+            return Boolean.valueOf(((Object[]) obj).length == 0);
+        } else if (obj instanceof Collection) {
+            return Boolean.valueOf(((Collection) obj).isEmpty());
+        } else if (obj instanceof Map) {
+            return Boolean.valueOf(((Map) obj).isEmpty());
+        }
+        return Boolean.FALSE;
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstEqual.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstEqual.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstEqual.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstEqual.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,25 @@
+/* Generated By:JJTree: Do not edit this line. AstEqual.java */
+
+package org.apache.el.parser;
+
+import javax.el.ELException;
+
+import org.apache.el.lang.EvaluationContext;
+
+
+/**
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dpatil $
+ */
+public final class AstEqual extends BooleanNode {
+    public AstEqual(int id) {
+        super(id);
+    }
+
+    public Object getValue(EvaluationContext ctx)
+            throws ELException {
+        Object obj0 = this.children[0].getValue(ctx);
+        Object obj1 = this.children[1].getValue(ctx);
+        return Boolean.valueOf(equals(obj0, obj1));
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstFalse.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstFalse.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstFalse.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstFalse.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,23 @@
+/* Generated By:JJTree: Do not edit this line. AstFalse.java */
+
+package org.apache.el.parser;
+
+import javax.el.ELException;
+
+import org.apache.el.lang.EvaluationContext;
+
+
+/**
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dpatil $
+ */
+public final class AstFalse extends BooleanNode {
+    public AstFalse(int id) {
+        super(id);
+    }
+
+    public Object getValue(EvaluationContext ctx)
+            throws ELException {
+        return Boolean.FALSE;
+    }
+}

Added: tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstFloatingPoint.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstFloatingPoint.java?rev=372228&view=auto
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstFloatingPoint.java (added)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/AstFloatingPoint.java Wed Jan 25 06:37:16 2006
@@ -0,0 +1,43 @@
+/* Generated By:JJTree: Do not edit this line. AstFloatingPoint.java */
+
+package org.apache.el.parser;
+
+import java.math.BigDecimal;
+
+import javax.el.ELException;
+
+import org.apache.el.lang.EvaluationContext;
+
+
+/**
+ * @author Jacob Hookom [jacob@hookom.net]
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dpatil $
+ */
+public final class AstFloatingPoint extends SimpleNode {
+    public AstFloatingPoint(int id) {
+        super(id);
+    }
+
+    private Number number;
+
+    public Number getFloatingPoint() {
+        if (this.number == null) {
+            try {
+                this.number = new Double(this.image);
+            } catch (ArithmeticException e0) {
+                this.number = new BigDecimal(this.image);
+            }
+        }
+        return this.number;
+    }
+
+    public Object getValue(EvaluationContext ctx)
+            throws ELException {
+        return this.getFloatingPoint();
+    }
+
+    public Class getType(EvaluationContext ctx)
+            throws ELException {
+        return this.getFloatingPoint().getClass();
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org