You are viewing a plain text version of this content. The canonical link for it is here.
Posted to imperius-commits@incubator.apache.org by ke...@apache.org on 2008/01/11 18:57:14 UTC

svn commit: r611261 [26/43] - in /incubator/imperius/trunk: ./ imperius-javaspl/ imperius-javaspl/src/main/java/org/apache/imperius/javaspl/ imperius-splcore/ imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/ imperius-splcore/src...

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/StringConstant.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/StringConstant.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/StringConstant.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/StringConstant.java Fri Jan 11 10:56:30 2008
@@ -1,109 +1,109 @@
-/*
- * 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.
- */
-//
-
-/**
- * @author Prashant Baliga <pr...@in.ibm.com>
- *
- */
-package org.apache.imperius.spl.parser.expressions.impl;
-
-import java.util.logging.Logger;
-
-import org.apache.imperius.spl.external.TypeConstants;
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.expressions.ConstantExpression;
-import org.apache.imperius.spl.parser.util.TypeInfo;
-import org.apache.imperius.util.SPLLogger;
-
-
-public class StringConstant extends ConstantExpression
-{
-    
-    private String stringValue;
-    
-    public TypeInfo _dataType = new TypeInfo();
-    
-    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-    private static final String sourceClass="StringConstant";
-    
-    
-    
-    public boolean isArray()
-    {
-
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "isArray");
-
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "isArray");
-     
-        return false;
-    }
-    
-    public StringConstant(String s)
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "StringConstant");
-
-        
-        s = s.substring(1, s.length() - 1);
-        this.stringValue = s;
-        _dataType.setType(TypeConstants.stringType);
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "StringConstant");
-        
-        
-    }
-    
-    public Object evaluate() throws SPLException
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
-        try
-        {
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-            
-            return new String(stringValue);
-        }
-        catch (Exception e)
-        {
-            logger.severe(Thread.currentThread().getName()+" "+"evaluation error: " + e.toString());
-            
-            throw new SPLException("evaluation error: " + e.toString());
-        }
-    }
-    
-    public TypeInfo getType()
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getType");
-
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getType");
-     
-        return _dataType;
-    }
-    
-    
-    public String toString()
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
-        
-        String str=this.stringValue;
-        
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
-       
-        return str;
-    }
-
-	public String getReferenceTypeName() throws SPLException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-}
+/*
+ * 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.
+ */
+//
+
+/**
+ * @author Prashant Baliga <pr...@in.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.expressions.impl;
+
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.TypeConstants;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.expressions.ConstantExpression;
+import org.apache.imperius.spl.parser.util.TypeInfo;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class StringConstant extends ConstantExpression
+{
+    
+    private String stringValue;
+    
+    public TypeInfo _dataType = new TypeInfo();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="StringConstant";
+    
+    
+    
+    public boolean isArray()
+    {
+
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "isArray");
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "isArray");
+     
+        return false;
+    }
+    
+    public StringConstant(String s)
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "StringConstant");
+
+        
+        s = s.substring(1, s.length() - 1);
+        this.stringValue = s;
+        _dataType.setType(TypeConstants.stringType);
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "StringConstant");
+        
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        try
+        {
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+            
+            return new String(stringValue);
+        }
+        catch (Exception e)
+        {
+            logger.severe(Thread.currentThread().getName()+" "+"evaluation error: " + e.toString());
+            
+            throw new SPLException("evaluation error: " + e.toString());
+        }
+    }
+    
+    public TypeInfo getType()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getType");
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getType");
+     
+        return _dataType;
+    }
+    
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+        
+        String str=this.stringValue;
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+
+	public String getReferenceTypeName() throws SPLException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+}

Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/StringConstant.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/StringLength.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/StringLength.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/StringLength.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/StringLength.java Fri Jan 11 10:56:30 2008
@@ -1,114 +1,114 @@
-/*
- * 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.
- */
-//
-
-/**
- * @author Prashant Baliga <pr...@in.ibm.com>
- *
- */
-package org.apache.imperius.spl.parser.expressions.impl;
-
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.imperius.spl.external.TypeConstants;
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.expressions.NumericExpression;
-import org.apache.imperius.spl.parser.expressions.SingleArgumentExpression;
-import org.apache.imperius.spl.parser.util.TypeInfo;
-import org.apache.imperius.spl.parser.util.TypeResolver;
-import org.apache.imperius.util.SPLLogger;
-
-
-public class StringLength extends SingleArgumentExpression implements
-        NumericExpression
-{
-    
-    public static final String className = StringLength.class.getName();
-    
-    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-    private static final String sourceClass="StringLength";
-    
-    
-    
-    public StringLength(List exprList, boolean validateExpression)
-            throws SPLException
-    {
-        super(exprList);
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "StringLength");
-
-        if (validateExpression)
-        {
-            if (!validate())
-            {
-                logger.severe(Thread.currentThread().getName()+" "+"validation error: " + className
-                        + " has wrong data type passed in.");
-                
-                throw new SPLException("validation error: " + className
-                        + " has wrong data type passed in.");
-            }
-        }
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "StringLength");
-        
-    }
-    
-    public Object evaluate() throws SPLException
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
-        try
-        {
-        	Number result = new Integer(((String) _exp.evaluate()).length()); 
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
-            
-            return result;
-        }
-        catch (Exception e)
-        {
-            logger.severe(Thread.currentThread().getName()+" "+"evaluation error: " + e.toString());
-            
-            throw new SPLException("evaluation error: " + e.toString());
-        }
-    }
-    
-    public boolean validate() throws SPLException
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-
-        TypeInfo eType = _exp.getType();
-        
-        // dataType = TypeConstants.numericType;
-        if (!eType.getIsArray() && TypeResolver.isString(eType))
-        {
-            _dataType.setType(TypeConstants.intType);
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-            
-            return true;
-        }
-
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-     
-        return false;
-    }
-    
-    public String toString()
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
-        String retStr= "StringLength("+this._exp.toString() +")";
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
-       
-        return retStr;
-    }
-    
-}
+/*
+ * 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.
+ */
+//
+
+/**
+ * @author Prashant Baliga <pr...@in.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.expressions.impl;
+
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.TypeConstants;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.expressions.NumericExpression;
+import org.apache.imperius.spl.parser.expressions.SingleArgumentExpression;
+import org.apache.imperius.spl.parser.util.TypeInfo;
+import org.apache.imperius.spl.parser.util.TypeResolver;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class StringLength extends SingleArgumentExpression implements
+        NumericExpression
+{
+    
+    public static final String className = StringLength.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="StringLength";
+    
+    
+    
+    public StringLength(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "StringLength");
+
+        if (validateExpression)
+        {
+            if (!validate())
+            {
+                logger.severe(Thread.currentThread().getName()+" "+"validation error: " + className
+                        + " has wrong data type passed in.");
+                
+                throw new SPLException("validation error: " + className
+                        + " has wrong data type passed in.");
+            }
+        }
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "StringLength");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        try
+        {
+        	Number result = new Integer(((String) _exp.evaluate()).length()); 
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
+            
+            return result;
+        }
+        catch (Exception e)
+        {
+            logger.severe(Thread.currentThread().getName()+" "+"evaluation error: " + e.toString());
+            
+            throw new SPLException("evaluation error: " + e.toString());
+        }
+    }
+    
+    public boolean validate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+
+        TypeInfo eType = _exp.getType();
+        
+        // dataType = TypeConstants.numericType;
+        if (!eType.getIsArray() && TypeResolver.isString(eType))
+        {
+            _dataType.setType(TypeConstants.intType);
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            
+            return true;
+        }
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+     
+        return false;
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+        String retStr= "StringLength("+this._exp.toString() +")";
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return retStr;
+    }
+    
+}

Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/StringLength.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/SubCollection.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/SubCollection.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/SubCollection.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/SubCollection.java Fri Jan 11 10:56:30 2008
@@ -1,195 +1,195 @@
-/*
- * 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.
- */
-//
-
-/**
- * @author Prashant Baliga <pr...@in.ibm.com>
- *
- */
-package org.apache.imperius.spl.parser.expressions.impl;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.imperius.spl.external.Expression;
-import org.apache.imperius.spl.external.TypeConstants;
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.expressions.DoubleArgumentExpression;
-import org.apache.imperius.spl.parser.util.TypeResolver;
-import org.apache.imperius.util.SPLLogger;
-
-
-public class SubCollection extends DoubleArgumentExpression implements
-        Expression
-{
-    
-    // private BasicCollectionExpression basicCollection=null;
-    public String className = SubCollection.class.toString();
-    
-    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-    private static final String sourceClass="SubCollection";
-    
-    
-    
-    public SubCollection(List exprList, boolean evaluateExpression)
-            throws SPLException
-    {
-        super(exprList);
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "SubCollection");
-
-       //System.out.println("SubCollection");
-        // this.basicCollection=new BasicCollectionExpression(exprList,new
-        // SPLSymbolTable());
-        
-        if (evaluateExpression)
-        {
-           //System.out.println("evaluateExpression " + evaluateExpression);
-            if (!validate())
-            {
-                logger.severe(Thread.currentThread().getName()+" "+"validation error: wrong data type passed in");
-                throw new SPLException(
-                        "validation error: wrong data type passed in "
-                                + this._dataType);
-            }
-            
-        }
-        this._dataType.setType(TypeConstants.booleanType);
-       
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "SubCollection");
-        
-    }
-    
-    public Object evaluate() throws SPLException
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
-       //System.out.println("SubCollection:evaluate");
-        Object lhsResult = this._lhsExp.evaluate();
-        Object rhsResult = this._rhsExp.evaluate();
-        if (!(lhsResult instanceof java.util.List))
-        {
-            logger.severe(Thread.currentThread().getName()+" "+"lhsResult is not of type List");
-            throw new SPLException("lhsResult is not of type List");
-        }
-        else
-        {
-           //System.out.println("lhsResult is of type List");
-        }
-        if (!(rhsResult instanceof java.util.List))
-        {
-            logger.severe(Thread.currentThread().getName()+" "+"rhsResult is not of type List");
-            throw new SPLException("rhsResult is not of type List");
-        }
-        else
-        {
-           //System.out.println("rhsResult is of type List");
-        }
-        
-        List lhsResultarray = (List) lhsResult;
-        List rhsResultarray = (List) rhsResult;
-        Boolean result = Boolean.FALSE;
-        if (lhsResultarray.size() > rhsResultarray.size())
-        {
-            result = Boolean.FALSE;
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-            
-            return result;
-        }
-        Iterator lhsResultarrayIt = lhsResultarray.iterator();
-        while (lhsResultarrayIt.hasNext())
-        {
-            Object lhsResultarrayElement = lhsResultarrayIt.next();
-           //System.out.println("element from Lhs ResultArray " + lhsResultarrayElement + "  " + lhsResultarrayElement.getClass());
-            if (!(rhsResultarray.contains(lhsResultarrayElement)))
-            {
-               //System.out.println("element does not exists in RHS List");
-                result = Boolean.FALSE;
-                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-                
-                return result;
-            }
-            else
-            {
-               //System.out.println("element exists in RHS List");
-            }
-            
-        }
-
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-     
-        return Boolean.TRUE;
-        
-    }
-    
-    public boolean validate() throws SPLException
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-
-       //System.out.println("SubCollection : validate ");
-        Expression lhsExpression = (Expression) this._lhsExp;
-        Expression rhsExpression = (Expression) this._rhsExp;
-        if ((lhsExpression == null) || (rhsExpression == null))
-        {
-           //System.out.println("SubCollection : One or more expressions are null ");
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-            
-            return false;
-        }
-        if (!TypeResolver.areTypesEqual(lhsExpression.getType(),rhsExpression.getType()))
-        {
-           //System.out.println("SubCollection : lhs Type !=rhs Type " + lhsExpression.getType() + ":" + rhsExpression.getType());
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-            
-            return false;
-        }
-        if (lhsExpression.isArray())
-        {
-           //System.out.println("lhsExpression.getType() ==TypeConstants.basicCollectionType");
-            if (rhsExpression.isArray())
-            {
-               //System.out.println("rhsExpression.getType() ==TypeConstants.basicCollectionType");
-                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-                
-                return true;
-                
-            }
-            else
-            {
-               //System.out.println("rhsExpression.getType() !=TypeConstants.basicCollectionType");
-                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-                
-                return false;
-            }
-        }
-        else
-        {
-           //System.out.println("lhsExpression.getType() !=TypeConstants.basicCollectionType");
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-            
-            return false;
-        }
-        
-    }
-    
-    public String toString()
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
-        String retStr= "SubCollection("+this._lhsExp.toString() + ","+ this._rhsExp.toString()+")";
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
-       
-        return retStr;
-    }
-    
-}
+/*
+ * 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.
+ */
+//
+
+/**
+ * @author Prashant Baliga <pr...@in.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.expressions.impl;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.external.TypeConstants;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.expressions.DoubleArgumentExpression;
+import org.apache.imperius.spl.parser.util.TypeResolver;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class SubCollection extends DoubleArgumentExpression implements
+        Expression
+{
+    
+    // private BasicCollectionExpression basicCollection=null;
+    public String className = SubCollection.class.toString();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="SubCollection";
+    
+    
+    
+    public SubCollection(List exprList, boolean evaluateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "SubCollection");
+
+       //System.out.println("SubCollection");
+        // this.basicCollection=new BasicCollectionExpression(exprList,new
+        // SPLSymbolTable());
+        
+        if (evaluateExpression)
+        {
+           //System.out.println("evaluateExpression " + evaluateExpression);
+            if (!validate())
+            {
+                logger.severe(Thread.currentThread().getName()+" "+"validation error: wrong data type passed in");
+                throw new SPLException(
+                        "validation error: wrong data type passed in "
+                                + this._dataType);
+            }
+            
+        }
+        this._dataType.setType(TypeConstants.booleanType);
+       
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "SubCollection");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+       //System.out.println("SubCollection:evaluate");
+        Object lhsResult = this._lhsExp.evaluate();
+        Object rhsResult = this._rhsExp.evaluate();
+        if (!(lhsResult instanceof java.util.List))
+        {
+            logger.severe(Thread.currentThread().getName()+" "+"lhsResult is not of type List");
+            throw new SPLException("lhsResult is not of type List");
+        }
+        else
+        {
+           //System.out.println("lhsResult is of type List");
+        }
+        if (!(rhsResult instanceof java.util.List))
+        {
+            logger.severe(Thread.currentThread().getName()+" "+"rhsResult is not of type List");
+            throw new SPLException("rhsResult is not of type List");
+        }
+        else
+        {
+           //System.out.println("rhsResult is of type List");
+        }
+        
+        List lhsResultarray = (List) lhsResult;
+        List rhsResultarray = (List) rhsResult;
+        Boolean result = Boolean.FALSE;
+        if (lhsResultarray.size() > rhsResultarray.size())
+        {
+            result = Boolean.FALSE;
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+            
+            return result;
+        }
+        Iterator lhsResultarrayIt = lhsResultarray.iterator();
+        while (lhsResultarrayIt.hasNext())
+        {
+            Object lhsResultarrayElement = lhsResultarrayIt.next();
+           //System.out.println("element from Lhs ResultArray " + lhsResultarrayElement + "  " + lhsResultarrayElement.getClass());
+            if (!(rhsResultarray.contains(lhsResultarrayElement)))
+            {
+               //System.out.println("element does not exists in RHS List");
+                result = Boolean.FALSE;
+                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+                
+                return result;
+            }
+            else
+            {
+               //System.out.println("element exists in RHS List");
+            }
+            
+        }
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+     
+        return Boolean.TRUE;
+        
+    }
+    
+    public boolean validate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+
+       //System.out.println("SubCollection : validate ");
+        Expression lhsExpression = (Expression) this._lhsExp;
+        Expression rhsExpression = (Expression) this._rhsExp;
+        if ((lhsExpression == null) || (rhsExpression == null))
+        {
+           //System.out.println("SubCollection : One or more expressions are null ");
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            
+            return false;
+        }
+        if (!TypeResolver.areTypesEqual(lhsExpression.getType(),rhsExpression.getType()))
+        {
+           //System.out.println("SubCollection : lhs Type !=rhs Type " + lhsExpression.getType() + ":" + rhsExpression.getType());
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            
+            return false;
+        }
+        if (lhsExpression.isArray())
+        {
+           //System.out.println("lhsExpression.getType() ==TypeConstants.basicCollectionType");
+            if (rhsExpression.isArray())
+            {
+               //System.out.println("rhsExpression.getType() ==TypeConstants.basicCollectionType");
+                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+                
+                return true;
+                
+            }
+            else
+            {
+               //System.out.println("rhsExpression.getType() !=TypeConstants.basicCollectionType");
+                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+                
+                return false;
+            }
+        }
+        else
+        {
+           //System.out.println("lhsExpression.getType() !=TypeConstants.basicCollectionType");
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            
+            return false;
+        }
+        
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+        String retStr= "SubCollection("+this._lhsExp.toString() + ","+ this._rhsExp.toString()+")";
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return retStr;
+    }
+    
+}

Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/SubCollection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Substring.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Substring.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Substring.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Substring.java Fri Jan 11 10:56:30 2008
@@ -1,271 +1,271 @@
-/*
- * 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.
- */
-//
-
-/**
- * @author Xiping Wang
- * @modified Neeraj Joshi
- *
- */
-package org.apache.imperius.spl.parser.expressions.impl;
-
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.imperius.spl.external.Expression;
-import org.apache.imperius.spl.external.TypeConstants;
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.expressions.StringExpression;
-import org.apache.imperius.spl.parser.util.TypeInfo;
-import org.apache.imperius.spl.parser.util.TypeResolver;
-import org.apache.imperius.util.SPLLogger;
-
-
-public class Substring implements StringExpression
-{
-    
-    public static final String className = Substring.class.getName();
-    
-    private Expression _lhsExp;
-    
-    private Expression _midExp;
-    
-    private Expression _rhsExp;
-    
-    private TypeInfo _dataType= new TypeInfo();;
-    
-    private boolean _isArray = false;
-    
-    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-    private static final String sourceClass="Substring";
-    
-    
-    
-    public boolean isArray()
-    {
-
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "isArray");
-
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "isArray");
-     
-        return _isArray;
-    }
-    
-    public Substring(List exprList, boolean validateExpression)
-            throws SPLException
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "Substring");
-
-        if (exprList != null)
-        {
-            if (exprList.size() == 3)
-            {
-                Expression l = (Expression) exprList.get(0);
-                Expression m = (Expression) exprList.get(1);
-                Expression r = (Expression) exprList.get(2);
-                if (l == null)
-                { 
-                    logger.severe(
-                    "left hand side expression passed in is null.");
-                    throw new IllegalArgumentException(
-                            "left hand side expression passed in is null.");
-                }
-                
-                if (m == null)
-                { 
-                    logger.severe(
-                    "middle expression passed in is null.");
-                    throw new IllegalArgumentException(
-                            "middle expression passed in is null.");
-                }
-                
-                if (r == null)
-                {
-                    logger.severe(
-                "right hand side expression passed in is null.");
-                    throw new IllegalArgumentException(
-                            "right hand side expression passed in is null.");
-                }
-                
-                this._lhsExp = l;
-                this._midExp = m;
-                this._rhsExp = r;
-                
-            }
-            else if (exprList.size() == 2)
-            {
-                Expression l = (Expression) exprList.get(0);
-                Expression m = (Expression) exprList.get(1);
-                
-                if (l == null)
-                { 
-                    logger.severe(
-                "left hand side expression passed in is null.");
-                    throw new IllegalArgumentException(
-                            "left hand side expression passed in is null.");
-                }
-                
-                if (m == null)
-                { 
-                    logger.severe(
-                    "middle expression passed in is null.");
-                    throw new IllegalArgumentException(
-                            "middle expression passed in is null.");
-                }
-                
-                this._lhsExp = l;
-                this._midExp = m;
-                this._rhsExp = null;
-                
-            }
-            else
-            { 
-                logger.severe(
-                "number of parameters passed is not 3.");
-                throw new IllegalArgumentException(
-                        "number of parameters passed is not 3.");
-            }
-        }
-        else
-        { 
-            logger.severe(Thread.currentThread().getName()+" "+"parameters passed are null.");
-            throw new IllegalArgumentException("parameters passed are null.");
-        }
-        if (validateExpression)
-        {
-            if (!validate())
-            {
-                logger.severe(Thread.currentThread().getName()+" "+"validation error: " + className
-                        + " has wrong data type passed in.");
-                
-                throw new SPLException("validation error: " + className
-                        + " has wrong data type passed in.");
-            }
-        }
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "Substring");
-        
-    }
-    
-    public Object evaluate() throws SPLException
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
-        try
-        {
-        	String result = "";
-            String o1 = (String) _lhsExp.evaluate();
-            Number o2 = (Number) _midExp.evaluate();
-            if (_rhsExp != null)
-            {
-                Number o3 = (Number) _rhsExp.evaluate();
-                result = o1.substring(((Integer) o2).intValue(), ((Integer) o3)
-                        .intValue());
-                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
-                
-                return result;
-            }
-            else
-            {
-            	result = o1.substring(((Integer) o2).intValue());
-                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
-                
-                return result;
-            }
-        }
-        catch (Exception e)
-        {
-            logger.severe(Thread.currentThread().getName()+" "+"evaluation error: " + e.toString());
-            
-            throw new SPLException("evaluation error: " + e.toString());
-        }
-        
-    }
-    
-    public boolean validate() throws SPLException
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-
-        TypeInfo lType = _lhsExp.getType();
-        TypeInfo mType = _midExp.getType();
-        
-        _dataType.setType(TypeConstants.stringType);
-        if(!lType.getIsArray() && !mType.getIsArray())
-        {	
-	        if (_rhsExp != null)
-	        {
-	        	TypeInfo rType = _rhsExp.getType();
-	            if (!rType.getIsArray() && TypeResolver.isString(lType) && 
-	            		TypeResolver.isNumeric(mType) && 
-	            		TypeResolver.isNumeric(rType))
-	            {
-	                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-	                
-	                return true;
-	            }
-	        }
-	        else
-	        {
-	            if (TypeResolver.isString(lType) && TypeResolver.isNumeric(mType))
-	            {
-	                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-	                
-	                return true;
-	            }
-	        }
-        }    
-
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-     
-        return false;
-    }
-    
-    public TypeInfo getType() throws SPLException
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getType");
-
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getType");
-     
-        
-        return _dataType;
-    }
-    
-    public String toString()
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
-        
-        String className=this.getClass().getName();
-        
-        String str=className.substring(className.lastIndexOf(".")+1, className.length())+"( ";
-        if(this._lhsExp!=null){
-            str+=this._lhsExp.toString();
-        }
-        if(this._midExp!=null){
-            str+=this._midExp.toString();
-        }
-        if(this._rhsExp!=null){
-            str+=this._rhsExp.toString();
-        }
-        str+=" )";
-        
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
-       
-        return str;
-    }
-
-	public String getReferenceTypeName() throws SPLException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-    
-}
+/*
+ * 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.
+ */
+//
+
+/**
+ * @author Xiping Wang
+ * @modified Neeraj Joshi
+ *
+ */
+package org.apache.imperius.spl.parser.expressions.impl;
+
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.external.TypeConstants;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.expressions.StringExpression;
+import org.apache.imperius.spl.parser.util.TypeInfo;
+import org.apache.imperius.spl.parser.util.TypeResolver;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class Substring implements StringExpression
+{
+    
+    public static final String className = Substring.class.getName();
+    
+    private Expression _lhsExp;
+    
+    private Expression _midExp;
+    
+    private Expression _rhsExp;
+    
+    private TypeInfo _dataType= new TypeInfo();;
+    
+    private boolean _isArray = false;
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="Substring";
+    
+    
+    
+    public boolean isArray()
+    {
+
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "isArray");
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "isArray");
+     
+        return _isArray;
+    }
+    
+    public Substring(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "Substring");
+
+        if (exprList != null)
+        {
+            if (exprList.size() == 3)
+            {
+                Expression l = (Expression) exprList.get(0);
+                Expression m = (Expression) exprList.get(1);
+                Expression r = (Expression) exprList.get(2);
+                if (l == null)
+                { 
+                    logger.severe(
+                    "left hand side expression passed in is null.");
+                    throw new IllegalArgumentException(
+                            "left hand side expression passed in is null.");
+                }
+                
+                if (m == null)
+                { 
+                    logger.severe(
+                    "middle expression passed in is null.");
+                    throw new IllegalArgumentException(
+                            "middle expression passed in is null.");
+                }
+                
+                if (r == null)
+                {
+                    logger.severe(
+                "right hand side expression passed in is null.");
+                    throw new IllegalArgumentException(
+                            "right hand side expression passed in is null.");
+                }
+                
+                this._lhsExp = l;
+                this._midExp = m;
+                this._rhsExp = r;
+                
+            }
+            else if (exprList.size() == 2)
+            {
+                Expression l = (Expression) exprList.get(0);
+                Expression m = (Expression) exprList.get(1);
+                
+                if (l == null)
+                { 
+                    logger.severe(
+                "left hand side expression passed in is null.");
+                    throw new IllegalArgumentException(
+                            "left hand side expression passed in is null.");
+                }
+                
+                if (m == null)
+                { 
+                    logger.severe(
+                    "middle expression passed in is null.");
+                    throw new IllegalArgumentException(
+                            "middle expression passed in is null.");
+                }
+                
+                this._lhsExp = l;
+                this._midExp = m;
+                this._rhsExp = null;
+                
+            }
+            else
+            { 
+                logger.severe(
+                "number of parameters passed is not 3.");
+                throw new IllegalArgumentException(
+                        "number of parameters passed is not 3.");
+            }
+        }
+        else
+        { 
+            logger.severe(Thread.currentThread().getName()+" "+"parameters passed are null.");
+            throw new IllegalArgumentException("parameters passed are null.");
+        }
+        if (validateExpression)
+        {
+            if (!validate())
+            {
+                logger.severe(Thread.currentThread().getName()+" "+"validation error: " + className
+                        + " has wrong data type passed in.");
+                
+                throw new SPLException("validation error: " + className
+                        + " has wrong data type passed in.");
+            }
+        }
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "Substring");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        try
+        {
+        	String result = "";
+            String o1 = (String) _lhsExp.evaluate();
+            Number o2 = (Number) _midExp.evaluate();
+            if (_rhsExp != null)
+            {
+                Number o3 = (Number) _rhsExp.evaluate();
+                result = o1.substring(((Integer) o2).intValue(), ((Integer) o3)
+                        .intValue());
+                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
+                
+                return result;
+            }
+            else
+            {
+            	result = o1.substring(((Integer) o2).intValue());
+                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
+                
+                return result;
+            }
+        }
+        catch (Exception e)
+        {
+            logger.severe(Thread.currentThread().getName()+" "+"evaluation error: " + e.toString());
+            
+            throw new SPLException("evaluation error: " + e.toString());
+        }
+        
+    }
+    
+    public boolean validate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+
+        TypeInfo lType = _lhsExp.getType();
+        TypeInfo mType = _midExp.getType();
+        
+        _dataType.setType(TypeConstants.stringType);
+        if(!lType.getIsArray() && !mType.getIsArray())
+        {	
+	        if (_rhsExp != null)
+	        {
+	        	TypeInfo rType = _rhsExp.getType();
+	            if (!rType.getIsArray() && TypeResolver.isString(lType) && 
+	            		TypeResolver.isNumeric(mType) && 
+	            		TypeResolver.isNumeric(rType))
+	            {
+	                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+	                
+	                return true;
+	            }
+	        }
+	        else
+	        {
+	            if (TypeResolver.isString(lType) && TypeResolver.isNumeric(mType))
+	            {
+	                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+	                
+	                return true;
+	            }
+	        }
+        }    
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+     
+        return false;
+    }
+    
+    public TypeInfo getType() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getType");
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getType");
+     
+        
+        return _dataType;
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+        
+        String className=this.getClass().getName();
+        
+        String str=className.substring(className.lastIndexOf(".")+1, className.length())+"( ";
+        if(this._lhsExp!=null){
+            str+=this._lhsExp.toString();
+        }
+        if(this._midExp!=null){
+            str+=this._midExp.toString();
+        }
+        if(this._rhsExp!=null){
+            str+=this._rhsExp.toString();
+        }
+        str+=" )";
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+
+	public String getReferenceTypeName() throws SPLException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+    
+}

Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Substring.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Subtraction.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Subtraction.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Subtraction.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Subtraction.java Fri Jan 11 10:56:30 2008
@@ -1,161 +1,161 @@
-/*
- * 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.
- */
-//
-
-/**
- * @author Neeraj Joshi
- *
- */
-package org.apache.imperius.spl.parser.expressions.impl;
-
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.imperius.spl.external.TypeConstants;
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.expressions.DoubleArgumentExpression;
-import org.apache.imperius.spl.parser.expressions.NumericExpression;
-import org.apache.imperius.spl.parser.util.TypeInfo;
-import org.apache.imperius.spl.parser.util.TypeResolver;
-import org.apache.imperius.util.SPLLogger;
-
-
-public class Subtraction extends DoubleArgumentExpression implements
-        NumericExpression
-{
-    
-    public static final String className = Subtraction.class.getName();
-    
-    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-    private static final String sourceClass="Subtraction";
-    
-    
-    
-    public Subtraction(List exprList, boolean validateExpression)
-            throws SPLException
-    {
-        super(exprList);
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "Subtraction");
-
-        if (validateExpression)
-        {
-            if (!validate())
-            {
-                logger.severe(Thread.currentThread().getName()+" "+"validation error: " + className
-                        + " has wrong data type passed in.");
-                
-                throw new SPLException("validation error: " + className
-                        + " has wrong data type passed in.");
-            }
-        }
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "Subtraction");
-        
-    }
-    
-    public Object evaluate() throws SPLException
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-        try
-        {
-            Number lhs = (Number) _lhsExp.evaluate();
-            Number rhs = (Number) _rhsExp.evaluate();
-
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-         
-          
-            return minus(lhs, rhs);
-        }
-        catch (Exception e)
-        {
-            logger.severe(Thread.currentThread().getName()+" "+"evaluation error: " + e.toString());
-            
-            
-            throw new SPLException("evaluation error: " + e.toString());
-        }
-    }
-    
-    private static Number minus(Number o1, Number o2) throws SPLException
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "minus");
-
-        
-        Number[] o = new Number[2];
-        o[0] = o1;
-        o[1] = o2;
-        
-        int resolvedType = TypeResolver.resolveType(o);
-        
-        if (resolvedType == TypeConstants.doubleType)
-        {
-            double result = o1.doubleValue() - o2.doubleValue();
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "minus");
-            
-            return new Double(result);
-        }
-        else if (resolvedType == TypeConstants.floatType)
-        {
-            float result = o1.floatValue() - o2.floatValue();
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "minus");
-            
-            return new Float(result);
-        }
-        else if (resolvedType == TypeConstants.longType)
-        {
-            long result = o1.longValue() - o2.longValue();
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "minus");
-            
-            return new Long(result);
-        }
-        else
-        {
-            int result = o1.intValue() - o2.intValue();
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "minus");
-            
-            return new Integer(result);
-        }
-    }
-    
-    public boolean validate() throws SPLException
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-
-        TypeInfo lType = _lhsExp.getType();
-        TypeInfo rType = _rhsExp.getType();
-        
-        // dataType = TypeConstants.numericType;
-        if (!lType.getIsArray() && !rType.getIsArray() &&
-        		TypeResolver.isNumeric(lType) && TypeResolver.isNumeric(rType))
-        {
-            _dataType = TypeResolver
-                    .binaryNumericPromotionResolver(lType, rType);
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-            
-            return true;
-        }
-
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-     
-        return false;
-    }
-    
-    public String toString()
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
-        String retStr= this._lhsExp.toString() + "-" + this._rhsExp.toString();
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
-       
-        return retStr;
-    }
-    
-}
+/*
+ * 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.
+ */
+//
+
+/**
+ * @author Neeraj Joshi
+ *
+ */
+package org.apache.imperius.spl.parser.expressions.impl;
+
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.TypeConstants;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.expressions.DoubleArgumentExpression;
+import org.apache.imperius.spl.parser.expressions.NumericExpression;
+import org.apache.imperius.spl.parser.util.TypeInfo;
+import org.apache.imperius.spl.parser.util.TypeResolver;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class Subtraction extends DoubleArgumentExpression implements
+        NumericExpression
+{
+    
+    public static final String className = Subtraction.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="Subtraction";
+    
+    
+    
+    public Subtraction(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "Subtraction");
+
+        if (validateExpression)
+        {
+            if (!validate())
+            {
+                logger.severe(Thread.currentThread().getName()+" "+"validation error: " + className
+                        + " has wrong data type passed in.");
+                
+                throw new SPLException("validation error: " + className
+                        + " has wrong data type passed in.");
+            }
+        }
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "Subtraction");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+        try
+        {
+            Number lhs = (Number) _lhsExp.evaluate();
+            Number rhs = (Number) _rhsExp.evaluate();
+
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+         
+          
+            return minus(lhs, rhs);
+        }
+        catch (Exception e)
+        {
+            logger.severe(Thread.currentThread().getName()+" "+"evaluation error: " + e.toString());
+            
+            
+            throw new SPLException("evaluation error: " + e.toString());
+        }
+    }
+    
+    private static Number minus(Number o1, Number o2) throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "minus");
+
+        
+        Number[] o = new Number[2];
+        o[0] = o1;
+        o[1] = o2;
+        
+        int resolvedType = TypeResolver.resolveType(o);
+        
+        if (resolvedType == TypeConstants.doubleType)
+        {
+            double result = o1.doubleValue() - o2.doubleValue();
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "minus");
+            
+            return new Double(result);
+        }
+        else if (resolvedType == TypeConstants.floatType)
+        {
+            float result = o1.floatValue() - o2.floatValue();
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "minus");
+            
+            return new Float(result);
+        }
+        else if (resolvedType == TypeConstants.longType)
+        {
+            long result = o1.longValue() - o2.longValue();
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "minus");
+            
+            return new Long(result);
+        }
+        else
+        {
+            int result = o1.intValue() - o2.intValue();
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "minus");
+            
+            return new Integer(result);
+        }
+    }
+    
+    public boolean validate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+
+        TypeInfo lType = _lhsExp.getType();
+        TypeInfo rType = _rhsExp.getType();
+        
+        // dataType = TypeConstants.numericType;
+        if (!lType.getIsArray() && !rType.getIsArray() &&
+        		TypeResolver.isNumeric(lType) && TypeResolver.isNumeric(rType))
+        {
+            _dataType = TypeResolver
+                    .binaryNumericPromotionResolver(lType, rType);
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            
+            return true;
+        }
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+     
+        return false;
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+        String retStr= this._lhsExp.toString() + "-" + this._rhsExp.toString();
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return retStr;
+    }
+    
+}

Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Subtraction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Sum.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Sum.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Sum.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Sum.java Fri Jan 11 10:56:30 2008
@@ -1,195 +1,195 @@
-/*
- * 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.
- */
-//
-
-/**
- * @author Neeraj Joshi
- *
- */
-package org.apache.imperius.spl.parser.expressions.impl;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.imperius.spl.external.Expression;
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.expressions.SingleArgumentExpression;
-import org.apache.imperius.spl.parser.util.ExpressionUtility;
-import org.apache.imperius.spl.parser.util.TypeResolver;
-import org.apache.imperius.util.SPLLogger;
-
-
-public class Sum extends SingleArgumentExpression implements Expression
-{
-    
-    public String className = Sum.class.toString();
-    
-    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-    private static final String sourceClass="Sum";
-    
-    
-    
-    public Sum(List exprList, boolean evaluateExpression)
-            throws SPLException
-    {
-        super(exprList);
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "Sum");
-
-        //System.out.println("Sum");
-        if (evaluateExpression)
-        {
-            //System.out.println("evaluateExpression " + evaluateExpression);
-            if (!validate())
-            {
-                logger.severe(
-                        "validation error: wrong data type passed in "
-                        + this._dataType);
-                throw new SPLException(
-                        "validation error: wrong data type passed in "
-                                + this._dataType);
-            }
-        }
-        
-        this._dataType.copy(_exp.getType());
-        this._dataType.setIsArray(false);
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "Sum");
-        
-        
-    }
-    
-    public Object evaluate() throws SPLException
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
-        //System.out.println("Sum:evaluate");
-        //System.out.println("this.exp class " + this.exp.getClass() + " type "+ this.exp.getType());
-        Object sum = null;
-        Object expResult = this._exp.evaluate();
-        if (!(expResult instanceof java.util.List))
-        {
-            logger.severe(Thread.currentThread().getName()+" "+"result of expression is not of type List");
-            throw new SPLException(
-                    "result of expression is not of type List");
-        }
-        ArrayList resultArray = (ArrayList) expResult;
-        //System.out.println("resultArray size " + resultArray.size()+ " to string " + resultArray.toString());
-        ////System.out.println("resultArray is of type "+expression.getType());
-        if ((resultArray != null) && (!resultArray.isEmpty()))
-        {
-            Iterator resultIt = resultArray.iterator();
-            while (resultIt.hasNext())
-            {
-                Object resultObject = resultIt.next();
-                //System.out.println("resultObject,class " + resultObject + " " + resultObject.getClass());
-                if (sum == null)
-                {
-                    sum = resultObject;
-                }
-                else
-                {
-                    //System.out.println("Adding resultObject to sum is "+ resultObject + "  " + sum);
-                    sum = ExpressionUtility.plus((Number) sum,
-                            (Number) resultObject);
-                }
-                //System.out.println("current sum is " + sum);
-            }
-            //System.out.println("sum " + sum);
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate "+sum);
-            
-            return sum;
-        }
-        else
-        {
-
-            logger.severe(Thread.currentThread().getName()+" "+"result Array is empty");
-         
-            throw new SPLException("result Array is empty");
-        }
-        
-    }
-    
-    public boolean validate() throws SPLException
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-
-        //System.out.println("Sum : validate ");
-       ////System.out.println("this.exp.getClass() " + this.exp.getClass()+ " type " + this.exp.getType());
-        
-        if (!this._exp.isArray())
-        {
-            //System.out.println("expression is not a valid BasicCollectExpression");
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-            
-            return false;
-        }
-        
-        else
-        {
-           ////System.out.println("expression is a valid BasicCollectExpression");
-        	boolean result = TypeResolver.isNumeric(_exp.getType());
-        	return result;
-            /*switch (this._exp.getType())
-            {
-            	TypeResol
-                case TypeConstants.byteType:
-                    logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-                    
-                    return true;
-                case TypeConstants.doubleType:
-                    logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-                    
-                    return true;
-                case TypeConstants.floatType:
-                    logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-                    
-                    return true;
-                case TypeConstants.intType:
-                    logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-                    
-                    return true;
-                case TypeConstants.longType:
-                    logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-                    
-                    return true;
-                case TypeConstants.numericType:
-                    logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-                    
-                    return true;
-                case TypeConstants.shortType:
-                    logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-                    
-                    return true;
-                default:
-                    logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-                
-                    return false;
-            }*/
-            
-        }
-        
-    }
-    
-    public String toString()
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
-        String retStr= "SUM("+this._exp.toString() + ")";
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
-       
-        return retStr;
-    }
-    
-    
-}
+/*
+ * 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.
+ */
+//
+
+/**
+ * @author Neeraj Joshi
+ *
+ */
+package org.apache.imperius.spl.parser.expressions.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.expressions.SingleArgumentExpression;
+import org.apache.imperius.spl.parser.util.ExpressionUtility;
+import org.apache.imperius.spl.parser.util.TypeResolver;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class Sum extends SingleArgumentExpression implements Expression
+{
+    
+    public String className = Sum.class.toString();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="Sum";
+    
+    
+    
+    public Sum(List exprList, boolean evaluateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "Sum");
+
+        //System.out.println("Sum");
+        if (evaluateExpression)
+        {
+            //System.out.println("evaluateExpression " + evaluateExpression);
+            if (!validate())
+            {
+                logger.severe(
+                        "validation error: wrong data type passed in "
+                        + this._dataType);
+                throw new SPLException(
+                        "validation error: wrong data type passed in "
+                                + this._dataType);
+            }
+        }
+        
+        this._dataType.copy(_exp.getType());
+        this._dataType.setIsArray(false);
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "Sum");
+        
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        //System.out.println("Sum:evaluate");
+        //System.out.println("this.exp class " + this.exp.getClass() + " type "+ this.exp.getType());
+        Object sum = null;
+        Object expResult = this._exp.evaluate();
+        if (!(expResult instanceof java.util.List))
+        {
+            logger.severe(Thread.currentThread().getName()+" "+"result of expression is not of type List");
+            throw new SPLException(
+                    "result of expression is not of type List");
+        }
+        ArrayList resultArray = (ArrayList) expResult;
+        //System.out.println("resultArray size " + resultArray.size()+ " to string " + resultArray.toString());
+        ////System.out.println("resultArray is of type "+expression.getType());
+        if ((resultArray != null) && (!resultArray.isEmpty()))
+        {
+            Iterator resultIt = resultArray.iterator();
+            while (resultIt.hasNext())
+            {
+                Object resultObject = resultIt.next();
+                //System.out.println("resultObject,class " + resultObject + " " + resultObject.getClass());
+                if (sum == null)
+                {
+                    sum = resultObject;
+                }
+                else
+                {
+                    //System.out.println("Adding resultObject to sum is "+ resultObject + "  " + sum);
+                    sum = ExpressionUtility.plus((Number) sum,
+                            (Number) resultObject);
+                }
+                //System.out.println("current sum is " + sum);
+            }
+            //System.out.println("sum " + sum);
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate "+sum);
+            
+            return sum;
+        }
+        else
+        {
+
+            logger.severe(Thread.currentThread().getName()+" "+"result Array is empty");
+         
+            throw new SPLException("result Array is empty");
+        }
+        
+    }
+    
+    public boolean validate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+
+        //System.out.println("Sum : validate ");
+       ////System.out.println("this.exp.getClass() " + this.exp.getClass()+ " type " + this.exp.getType());
+        
+        if (!this._exp.isArray())
+        {
+            //System.out.println("expression is not a valid BasicCollectExpression");
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            
+            return false;
+        }
+        
+        else
+        {
+           ////System.out.println("expression is a valid BasicCollectExpression");
+        	boolean result = TypeResolver.isNumeric(_exp.getType());
+        	return result;
+            /*switch (this._exp.getType())
+            {
+            	TypeResol
+                case TypeConstants.byteType:
+                    logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+                    
+                    return true;
+                case TypeConstants.doubleType:
+                    logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+                    
+                    return true;
+                case TypeConstants.floatType:
+                    logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+                    
+                    return true;
+                case TypeConstants.intType:
+                    logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+                    
+                    return true;
+                case TypeConstants.longType:
+                    logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+                    
+                    return true;
+                case TypeConstants.numericType:
+                    logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+                    
+                    return true;
+                case TypeConstants.shortType:
+                    logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+                    
+                    return true;
+                default:
+                    logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+                
+                    return false;
+            }*/
+            
+        }
+        
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+        String retStr= "SUM("+this._exp.toString() + ")";
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return retStr;
+    }
+    
+    
+}

Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Sum.java
------------------------------------------------------------------------------
    svn:eol-style = native