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 jn...@apache.org on 2007/12/22 19:34:03 UTC

svn commit: r606479 [15/30] - in /incubator/imperius/trunk/trunk: ./ modules/ modules/imperius-javaspl/ modules/imperius-javaspl/resources/ modules/imperius-javaspl/resources/samples/ modules/imperius-javaspl/resources/samples/computersystem/ modules/i...

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/FloatConstant.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/FloatConstant.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/FloatConstant.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/FloatConstant.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,93 @@
+/*
+ * 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.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.expressions.NumericExpression;
+import org.apache.imperius.spl.parser.util.TypeInfo;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class FloatConstant extends ConstantExpression implements
+        NumericExpression
+{
+    
+    private float floatValue;
+    
+    public TypeInfo _dataType = new TypeInfo(TypeConstants.floatType);;
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="FloatConstant";
+    
+    
+    
+    public boolean isArray()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "isArray");
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "isArray");
+     
+        
+        return _dataType.getIsArray();
+    }
+    
+    public FloatConstant(float val)
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "FloatConstant");
+       
+        this.floatValue = val;
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "FloatConstant");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+     
+        return new Float(this.floatValue);
+    }
+    
+    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=Float.toString(this.floatValue);
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/Floor.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/Floor.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/Floor.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/Floor.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,124 @@
+/*
+ * 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 Floor extends SingleArgumentExpression implements
+        NumericExpression
+{
+    
+    public static final String className = Floor.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="Floor";
+    
+    
+    
+    public Floor(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "Floor");
+
+        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()+" "+ "Floor");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        try
+        {
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+            
+            return floor((Number) _exp.evaluate());
+        }
+        catch (Exception e)
+        {
+            logger.severe(Thread.currentThread().getName()+" "+"evaluation error: " + e.toString());
+            
+            throw new SPLException("evaluation error: " + e.toString());
+        }
+    }
+    
+    public static Number floor(Number o)
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "Number");
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "Number");
+     
+        return new Double(Math.floor(o.doubleValue()));
+    }
+    
+    public boolean validate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+
+        TypeInfo eType = _exp.getType();
+        
+        // dataType = TypeConstants.numericType;
+        if (TypeResolver.isNumeric(eType))
+        {
+            _dataType.setType(TypeConstants.doubleType);
+            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 str = "Floor( "+ this._exp.toString() + ")";
+        	
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetCurrentTime.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetCurrentTime.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetCurrentTime.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetCurrentTime.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,119 @@
+/*
+ * 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.Calendar;
+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.ZeroArgumentExpression;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class GetCurrentTime extends ZeroArgumentExpression implements
+NumericExpression
+{
+    
+    public static final String className = GetCurrentTime.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="GetCurrentTime";
+    private Calendar oCalendar = null;
+    
+    
+    public GetCurrentTime(List exprList, boolean validateExpression)
+    throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "GetCurrentTime");
+        
+        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()+" "+ "GetCurrentTime");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+        
+        /*
+         * this method returns an integer number corresponding to the day of the
+         * month where the first day of the month has value 1. The parser and
+         * validator should ensure the argument is of type calendar type.
+         */
+        try
+        {
+        	oCalendar = Calendar.getInstance();
+        	oCalendar.setTimeInMillis(System.currentTimeMillis());
+           //System.out.println("&&&&&&&&Current time is&&&&&&&& "+calendar.toString());
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+            
+            return oCalendar;
+        }
+        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");
+        
+        _dataType.setType(TypeConstants.dateTime);
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+        
+        return true;
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+        
+        String str="";
+        if (oCalendar != null){
+        	str = "GetCurrentTime "+ oCalendar.getTime().getTime();
+        }else{
+        	str = "GetCurrentTime() ";
+        }
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+    
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetDayOfMonth.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetDayOfMonth.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetDayOfMonth.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetDayOfMonth.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,123 @@
+/*
+ * 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.Calendar;
+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 GetDayOfMonth extends SingleArgumentExpression implements
+        NumericExpression
+{
+    
+    public static final String className = GetDayOfMonth.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="GetDayOfMonth";
+    
+    
+    
+    public GetDayOfMonth(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "GetDayOfMonth");
+
+        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()+" "+ "GetDayOfMonth");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+     
+        try
+        {
+            Calendar calendar = (Calendar) _exp.evaluate();
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+            
+            
+            return new Integer(calendar.get(Calendar.DAY_OF_MONTH));
+        }
+        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();
+        
+        
+        if (!eType.getIsArray() && TypeResolver.isCalendar(eType))
+        {
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            _dataType.setType(TypeConstants.intType);
+            return true;
+        }
+        else
+        {
+        	throw new SPLException("invalid expression type " + eType + " for getdayofmth");
+        }
+     
+     
+     
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+
+        String str = "GetDayOfMonth("+this._exp.toString() +")";
+        	
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetDayOfWeek.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetDayOfWeek.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetDayOfWeek.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetDayOfWeek.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,151 @@
+/*
+ * 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.Calendar;
+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 GetDayOfWeek extends SingleArgumentExpression implements
+        NumericExpression
+{
+    
+    public static final String className = GetDayOfWeek.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="GetDayOfWeek";
+    
+    
+    
+    public GetDayOfWeek(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "GetDayOfWeek");
+
+        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()+" "+ "GetDayOfWeek");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        try
+        {
+            Calendar calendar = (Calendar) _exp.evaluate();
+            
+            // I actually use a case statement in case the JVM later changes the
+            // constant values
+            int result = 0;
+            
+            switch (calendar.get(Calendar.DAY_OF_WEEK))
+            {
+                case Calendar.SUNDAY:
+                    result = 1;
+                    break;
+                case Calendar.MONDAY:
+                    result = 2;
+                    break;
+                case Calendar.TUESDAY:
+                    result = 3;
+                    break;
+                case Calendar.WEDNESDAY:
+                    result = 4;
+                    break;
+                case Calendar.THURSDAY:
+                    result = 5;
+                    break;
+                case Calendar.FRIDAY:
+                    result = 6;
+                    break;
+                case Calendar.SATURDAY:
+                    result = 7;
+                    break;
+            }
+
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+         
+            return new Integer(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();
+        
+        
+        if (!eType.getIsArray() && TypeResolver.isCalendar(eType))
+        {
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            
+            _dataType.setType(TypeConstants.intType);
+            return true;
+        }
+        else
+        {
+        	throw new SPLException("Invalid input type " + eType + " for getDayOfWeek");
+        }
+
+        
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+
+        String str = "GetDayOfWeek("+this._exp.toString() +")";
+        	
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetDayOfWeekInMonth.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetDayOfWeekInMonth.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetDayOfWeekInMonth.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetDayOfWeekInMonth.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,123 @@
+/*
+ * 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.Calendar;
+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 GetDayOfWeekInMonth extends SingleArgumentExpression implements
+        NumericExpression
+{
+    
+    public static final String className = GetDayOfWeekInMonth.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="GetDayOfWeekInMonth";
+    
+    
+    
+    public GetDayOfWeekInMonth(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "GetDayOfWeekInMonth");
+
+        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()+" "+ "GetDayOfWeekInMonth");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        /*
+         * this method returns an integer number corresponding to the day of the
+         * month where the first day of the month has value 1. The parser and
+         * validator should ensure the argument is of type calendar type.
+         */
+        Calendar calendar = null;
+        try
+        {
+            calendar = (Calendar) _exp.evaluate();
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+            
+            return new Integer(calendar.get(Calendar.DAY_OF_WEEK_IN_MONTH));
+        }
+        catch (Exception e)
+        {
+            logger.severe(Thread.currentThread().getName()+" "+"invalid expression.");
+            
+            throw new SPLException("invalid expression.");
+        }
+    }
+    
+    public boolean validate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+
+        TypeInfo eType = _exp.getType();
+        
+        
+        if (!eType.getIsArray() && TypeResolver.isCalendar(eType))
+        {
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            _dataType.setType(TypeConstants.intType);
+            return true;
+        }
+        else
+        {
+        	throw new SPLException("Invalid input type " + eType + " for getDayOfWeekInMonth");
+        }
+        
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+
+        String str = "GetDayOfWeekInMonth("+this._exp.toString() +")";
+        	
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetDayOfYear.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetDayOfYear.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetDayOfYear.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetDayOfYear.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,123 @@
+/*
+ * 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.Calendar;
+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 GetDayOfYear extends SingleArgumentExpression implements
+        NumericExpression
+{
+    
+    public static final String className = GetDayOfYear.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="GetDayOfYear";
+    
+    
+    
+    public GetDayOfYear(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "GetDayOfYear");
+
+        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()+" "+ "GetDayOfYear");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        /*
+         * this method returns an integer number corresponding to the day of the
+         * month where the first day of the month has value 1. The parser and
+         * validator should ensure the argument is of type calendar type.
+         */
+        try
+        {
+            Calendar calendar = (Calendar) _exp.evaluate();
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+            
+            return new Integer(calendar.get(Calendar.DAY_OF_YEAR));
+        }
+        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();
+        
+       
+        if (!eType.getIsArray() && TypeResolver.isCalendar(eType))
+        {
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            _dataType.setType(TypeConstants.intType);
+            return true;
+        }
+        else
+        {
+        	throw new SPLException("Invalid input type " + eType + " for getdayofyear");
+        }
+
+     
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+
+        String str = "GetDayOfYear("+this._exp.toString() +")";
+        	
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetHour12.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetHour12.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetHour12.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetHour12.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,122 @@
+/*
+ * 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.Calendar;
+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 GetHour12 extends SingleArgumentExpression implements
+        NumericExpression
+{
+    
+    public static final String className = GetHour12.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="GetHour12";
+    
+    
+    
+    public GetHour12(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "GetHour12");
+
+        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()+" "+ "GetHour12");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        /*
+         * this method returns an integer number corresponding to the day of the
+         * month where the first day of the month has value 1. The parser and
+         * validator should ensure the argument is of type calendar type.
+         */
+        try
+        {
+            Calendar calendar = (Calendar) _exp.evaluate();
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+            
+            return new Integer(calendar.get(Calendar.HOUR));
+        }
+        catch (Exception e)
+        {
+            logger.severe(Thread.currentThread().getName()+" "+"invalid expression.");
+            
+            throw new SPLException("invalid expression.");
+        }
+    }
+    
+    public boolean validate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+
+        TypeInfo eType = _exp.getType();
+        
+       
+        if (!eType.getIsArray() && TypeResolver.isCalendar(eType))
+        {
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            _dataType.setType(TypeConstants.intType);
+            return true;
+        }
+        else
+        {
+        	throw new SPLException("Invalid input type " + eType + " for gethour12");
+        }
+        
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+
+        String str = "GetHour12("+this._exp.toString() +")";
+        	
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetHour24.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetHour24.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetHour24.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetHour24.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,122 @@
+/*
+ * 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.Calendar;
+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 GetHour24 extends SingleArgumentExpression implements
+        NumericExpression
+{
+    
+    public static final String className = GetHour24.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="GetHour24";
+    
+    
+    
+    public GetHour24(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "GetHour24");
+
+        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()+" "+ "GetHour24");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        /*
+         * this method returns an integer number corresponding to the day of the
+         * month where the first day of the month has value 1. The parser and
+         * validator should ensure the argument is of type calendar type.
+         */
+        try
+        {
+            Calendar calendar = (Calendar) _exp.evaluate();
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+            
+            return new Integer(calendar.get(Calendar.HOUR_OF_DAY));
+        }
+        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();
+        
+        
+        if (!eType.getIsArray() && TypeResolver.isCalendar(eType))
+        {
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            _dataType.setType(TypeConstants.intType);
+            return true;
+        }
+        else
+        {
+        	throw new SPLException("Invalid input type " + eType + " for gethour24");
+        }
+        
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+
+        String str = "GetHour24("+this._exp.toString() +")";
+        	
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetMillisecond.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetMillisecond.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetMillisecond.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetMillisecond.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,123 @@
+/*
+ * 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
+ *
+ */
+package org.apache.imperius.spl.parser.expressions.impl;
+
+import java.util.Calendar;
+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 GetMillisecond extends SingleArgumentExpression implements
+        NumericExpression
+{
+    
+    public static final String className = GetMillisecond.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="GetMillisecond";
+    
+    
+    
+    public GetMillisecond(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "GetMillisecond");
+
+        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()+" "+ "GetMillisecond");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        /*
+         * this method returns an integer number corresponding to the day of the
+         * month where the first day of the month has value 1. The parser and
+         * validator should ensure the argument is of type calendar type.
+         */
+        try
+        {
+            Calendar calendar = (Calendar) _exp.evaluate();
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+            
+            return new Integer(calendar.get(Calendar.MILLISECOND));
+        }
+        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();
+        
+       
+        if (!eType.getIsArray() && TypeResolver.isCalendar(eType))
+        {
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            _dataType.setType(TypeConstants.intType);
+            return true;
+        }
+        else
+        {
+        	throw new SPLException("Invalid input type " + eType + " for getmilliseconds");
+        }
+
+     
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+
+        String str = "GetMillisecond("+this._exp.toString() +")";
+        	
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetMinute.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetMinute.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetMinute.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetMinute.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,123 @@
+/*
+ * 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
+ *
+ */
+package org.apache.imperius.spl.parser.expressions.impl;
+
+import java.util.Calendar;
+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 GetMinute extends SingleArgumentExpression implements
+        NumericExpression
+{
+    
+    public static final String className = GetMinute.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="GetMinute";
+    
+    
+    
+    public GetMinute(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "GetMinute");
+
+        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()+" "+ "GetMinute");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        /*
+         * this method returns an integer number corresponding to the day of the
+         * month where the first day of the month has value 1. The parser and
+         * validator should ensure the argument is of type calendar type.
+         */
+        try
+        {
+            Calendar calendar = (Calendar) _exp.evaluate();
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+            
+            return new Integer(calendar.get(Calendar.MINUTE));
+        }
+        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();
+        
+        
+        if (!eType.getIsArray() && TypeResolver.isCalendar(eType))
+        {
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            _dataType.setType(TypeConstants.intType);
+            return true;
+        }
+        else
+        {
+        	throw new SPLException("Invalid input type " + eType + " for getminute");
+        }
+
+       
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+
+        String str = "GetMinute("+this._exp.toString() +")";
+        	
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetMonth.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetMonth.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetMonth.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetMonth.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,169 @@
+/*
+ * 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.Calendar;
+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 GetMonth extends SingleArgumentExpression implements
+        NumericExpression
+{
+    
+    public static final String className = GetMonth.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="GetMonth";
+    
+    
+    
+    public GetMonth(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "GetMonth");
+
+        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()+" "+ "GetMonth");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        /*
+         * this method returns an integer number corresponding to the day of the
+         * month where the first day of the month has value 0. The parser and
+         * validator should ensure the argument is of type calendar type.
+         */
+        try
+        {
+            Calendar calendar = (Calendar) _exp.evaluate();
+            // using translation to insulate from future JVM constant changes
+            int result = 0;
+            switch (calendar.get(Calendar.MONTH))
+            {
+                case Calendar.JANUARY:
+                    result = 0;
+                    break;
+                case Calendar.FEBRUARY:
+                    result = 1;
+                    break;
+                case Calendar.MARCH:
+                    result = 2;
+                    break;
+                case Calendar.APRIL:
+                    result = 3;
+                    break;
+                case Calendar.MAY:
+                    result = 4;
+                    break;
+                case Calendar.JUNE:
+                    result = 5;
+                    break;
+                case Calendar.JULY:
+                    result = 6;
+                    break;
+                case Calendar.AUGUST:
+                    result = 7;
+                    break;
+                case Calendar.SEPTEMBER:
+                    result = 8;
+                    break;
+                case Calendar.OCTOBER:
+                    result = 9;
+                    break;
+                case Calendar.NOVEMBER:
+                    result = 10;
+                    break;
+                case Calendar.DECEMBER:
+                    result = 11;
+                    break;
+                case Calendar.UNDECIMBER:
+                    result = 12;
+                    break;
+            }
+
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+         
+            return new Integer(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();
+        
+        
+        if (!eType.getIsArray() && TypeResolver.isCalendar(eType))
+        {
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            _dataType.setType(TypeConstants.intType);
+            return true;
+        }
+        else
+        {
+        	throw new SPLException("Invalid input type " + eType + " for getmonth");
+        }
+
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+
+        String str = "GetMonth("+this._exp.toString() +")";
+        	
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetSecond.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetSecond.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetSecond.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetSecond.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,124 @@
+/*
+ * 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.Calendar;
+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 GetSecond extends SingleArgumentExpression implements
+        NumericExpression
+{
+    
+    public static final String className = GetSecond.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="GetSecond";
+    
+    
+    
+    public GetSecond(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "GetSecond");
+
+        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()+" "+ "GetSecond");
+        
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        /*
+         * this method returns an integer number corresponding to the day of the
+         * month where the first day of the month has value 1. The parser and
+         * validator should ensure the argument is of type calendar type.
+         */
+        try
+        {
+            Calendar calendar = (Calendar) _exp.evaluate();
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+            
+            return new Integer(calendar.get(Calendar.SECOND));
+        }
+        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();
+        
+       
+        if (!eType.getIsArray() && TypeResolver.isCalendar(eType))
+        {
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            _dataType.setType(TypeConstants.intType);
+            return true;
+        }
+        else
+        {
+        	throw new SPLException("Invalid input type " + eType + " for getsecond");
+        }
+
+        
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+
+        String str = "GetSecond("+this._exp.toString() +")";
+        	
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetWeekOfMonth.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetWeekOfMonth.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetWeekOfMonth.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetWeekOfMonth.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,124 @@
+/*
+ * 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.Calendar;
+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 GetWeekOfMonth extends SingleArgumentExpression implements
+        NumericExpression
+{
+    
+    public static final String className = GetWeekOfMonth.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="GetWeekOfMonth";
+    
+    
+    
+    public GetWeekOfMonth(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "GetWeekOfMonth");
+
+        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()+" "+ "GetWeekOfMonth");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        /*
+         * this method returns an integer number corresponding to the day of the
+         * month where the first day of the month has value 1. The parser and
+         * validator should ensure the argument is of type calendar type.
+         */
+        try
+        {
+            Calendar calendar = (Calendar) _exp.evaluate();
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+            
+            return new Integer(calendar.get(Calendar.WEEK_OF_MONTH));
+        }
+        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();
+        
+       
+        if (!eType.getIsArray() && TypeResolver.isCalendar(eType))
+        {
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            _dataType.setType(TypeConstants.intType);
+            return true;
+        }
+        else
+        {
+        	throw new SPLException("Invalid input type " + eType + " for getweekofmth");
+        }
+
+       
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+
+        String str = "GetWeekOfMonth("+this._exp.toString() +")";
+        	
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetWeekOfYear.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetWeekOfYear.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetWeekOfYear.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetWeekOfYear.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,121 @@
+/*
+ * 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.Calendar;
+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 GetWeekOfYear extends SingleArgumentExpression implements
+        NumericExpression
+{
+    
+    public static final String className = GetWeekOfYear.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="GetWeekOfYear";
+    
+    
+    
+    public GetWeekOfYear(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "GetWeekOfYear");
+
+        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()+" "+ "GetWeekOfYear");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        /*
+         * this method returns an integer number corresponding to the day of the
+         * month where the first day of the month has value 1. The parser and
+         * validator should ensure the argument is of type calendar type.
+         */
+        try
+        {
+            Calendar calendar = (Calendar) _exp.evaluate();
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+            
+            return new Integer(calendar.get(Calendar.WEEK_OF_YEAR));
+        }
+        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();
+        
+      
+        if (!eType.getIsArray() && TypeResolver.isCalendar(eType))
+        {
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            _dataType.setType(TypeConstants.intType);
+            return true;
+        }
+        else
+        {
+        	throw new SPLException("Invalid input type " + eType + " for getweekofyear");
+        }
+
+        
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+
+        String str = "GetWeekOfYear("+this._exp.toString() +")";
+        	
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetYear.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetYear.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetYear.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/GetYear.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,125 @@
+/*
+ * 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.Calendar;
+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 GetYear extends SingleArgumentExpression implements
+        NumericExpression
+{
+    
+    public static final String className = GetYear.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="GetYear";
+    
+    
+    
+    public GetYear(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "GetYear");
+
+        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()+" "+ "GetYear");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        /*
+         * this method returns an integer number corresponding to the day of the
+         * month where the first day of the month has value 1. The parser and
+         * validator should ensure the argument is of type calendar type.
+         */
+        try
+        {
+            Calendar calendar = (Calendar) _exp.evaluate();
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+            
+            return new Integer(calendar.get(Calendar.YEAR));
+        }
+        catch (Exception e)
+        {
+            logger.severe(Thread.currentThread().getName()+" "+"invalid expression");
+            
+            throw new SPLException("invalid expression");
+        }
+    }
+    
+    public boolean validate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+
+        TypeInfo eType = _exp.getType();
+        
+       
+        if (!eType.getIsArray() && TypeResolver.isCalendar(eType))
+        {
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            _dataType.setType(TypeConstants.intType);
+            return true;
+        }
+        else
+        {
+        	throw new SPLException("Invalid input type " + eType + " for getyear");
+        }
+
+       
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+
+        String str = "GetYear("+this._exp.toString() +")";
+        	
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/Greater.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/Greater.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/Greater.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/Greater.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,149 @@
+/*
+ * 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.BooleanExpression;
+import org.apache.imperius.spl.parser.expressions.DoubleArgumentExpression;
+import org.apache.imperius.spl.parser.util.ExpressionUtility;
+import org.apache.imperius.spl.parser.util.TypeInfo;
+import org.apache.imperius.spl.parser.util.TypeResolver;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class Greater extends DoubleArgumentExpression implements
+        BooleanExpression
+{
+    
+    public static final String className = Greater.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="Greater";
+    
+    
+    
+    public Greater(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "Greater");
+
+        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()+" "+ "Greater");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        try
+        {
+           //System.out.println("Greater::LHS type: RHS type ::" + lhsExp.getType() + ":" + rhsExp.getType());
+            Object lhsValue = _lhsExp.evaluate();
+            Object rhsValue = _rhsExp.evaluate();
+           //System.out.println("Greater::after Evaluation LHS: RHS ::"+ lhsValue + ":" + rhsValue);
+            if (ExpressionUtility.compare(lhsValue, rhsValue) > 0)
+            {
+               //System.out.println("Greater::True");
+                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+                
+                return Boolean.TRUE;
+            }
+            else
+            {
+               //System.out.println("Greater::false");
+                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+                
+                return Boolean.FALSE;
+            }
+        }
+        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");
+        boolean validation = false;
+        TypeInfo lType = _lhsExp.getType();
+        TypeInfo rType = _rhsExp.getType();
+       //System.out.println("Greater:validate:TypeResolver.isBoolean(lType)"+ TypeResolver.isBoolean(lType));
+       //System.out.println("Greater:validate:TypeResolver.isBoolean(rType)"+ TypeResolver.isBoolean(rType));
+        
+        if (!lType.getIsArray() && !rType.getIsArray() &&
+        		TypeResolver.isTypeAssignableForRelation(lType, rType))
+        {
+            _dataType.setType(TypeConstants.booleanType);
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            
+            validation = true;
+        }
+        if (!lType.getIsArray() && !rType.getIsArray() &&
+        		(TypeResolver.isCalendar(lType))&& 
+        		(TypeResolver.isCalendar(rType)))
+        {
+            _dataType.setType(TypeConstants.booleanType);
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            
+            validation = true;
+        }
+        
+        if(!validation)
+        {
+        	throw new SPLException("Invalid input for Greater " + lType + rType);
+        }
+        else
+        {
+        	return validation;
+        }
+
+        
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+
+        String str = this._lhsExp.toString() + ">" + this._rhsExp.toString() +")";
+        	
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+}