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 [27/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/ToBoolean.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToBoolean.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToBoolean.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToBoolean.java Fri Jan 11 10:56:30 2008
@@ -1,173 +1,173 @@
-/*
- * 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.BooleanExpression;
-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 ToBoolean extends SingleArgumentExpression implements
- BooleanExpression
-{
-
- public static final String className = ToBoolean.class.getName();
-
- private static Logger logger = SPLLogger.getSPLLogger().getLogger();
- private static final String sourceClass="ToBoolean";
-
-
-
- public ToBoolean(List exprList, boolean validateExpression)
- throws SPLException
- {
- super(exprList);
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ToBoolean");
-
- 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()+" "+ "ToBoolean");
-
- }
-
- public Object evaluate() throws SPLException
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
- try
- {
- Object obj = _exp.evaluate();
- //System.out.println("after evaluation :" + obj.toString());
-
- if (_dataType.getType() == TypeConstants.doubleType)
- {
- // Necessary because double works differently
- Double number = (Double) obj;
- if (number.doubleValue() > 0 || number.doubleValue() < 0)
- {
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
- return new Boolean(true);
- }
- else
- {
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
- return new Boolean(false);
- }
- }
- else if (_dataType.getType() == TypeConstants.floatType)
- {
- // Necessary because float works differently
- Float number = (Float) obj;
- if (number.floatValue() > 0 || number.floatValue() < 0)
- {
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
- return new Boolean(true);
- }
- else
- {
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
- return new Boolean(false);
- }
- }
- else if (obj instanceof Number)
- {
- if (((Number) obj).longValue() == 0){
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
- return new Boolean(false);
-
- }
-
- else
- {
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
- return new Boolean(true);
- }
- }
- else
- {
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
- // must be string type
- return new Boolean((String) obj);
- }
- }
- 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();
- //System.out.println("validating : " + _exp.getType());
-
- if (!eType.getIsArray() &&
- TypeResolver.isNumeric(eType) || TypeResolver.isString(eType))
- {
- _dataType.setType(TypeConstants.booleanType);
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-
- return true;
- }
- else
- {
- //System.out.println("validation failure: " + _exp.toString() + _exp.getClass());
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-
- return false;
- }
- }
-
- public String toString()
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
- String retStr= "toBoolean("+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.BooleanExpression;
+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 ToBoolean extends SingleArgumentExpression implements
+ BooleanExpression
+{
+
+ public static final String className = ToBoolean.class.getName();
+
+ private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+ private static final String sourceClass="ToBoolean";
+
+
+
+ public ToBoolean(List exprList, boolean validateExpression)
+ throws SPLException
+ {
+ super(exprList);
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ToBoolean");
+
+ 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()+" "+ "ToBoolean");
+
+ }
+
+ public Object evaluate() throws SPLException
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+ try
+ {
+ Object obj = _exp.evaluate();
+ //System.out.println("after evaluation :" + obj.toString());
+
+ if (_dataType.getType() == TypeConstants.doubleType)
+ {
+ // Necessary because double works differently
+ Double number = (Double) obj;
+ if (number.doubleValue() > 0 || number.doubleValue() < 0)
+ {
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+ return new Boolean(true);
+ }
+ else
+ {
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+ return new Boolean(false);
+ }
+ }
+ else if (_dataType.getType() == TypeConstants.floatType)
+ {
+ // Necessary because float works differently
+ Float number = (Float) obj;
+ if (number.floatValue() > 0 || number.floatValue() < 0)
+ {
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+ return new Boolean(true);
+ }
+ else
+ {
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+ return new Boolean(false);
+ }
+ }
+ else if (obj instanceof Number)
+ {
+ if (((Number) obj).longValue() == 0){
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+ return new Boolean(false);
+
+ }
+
+ else
+ {
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+ return new Boolean(true);
+ }
+ }
+ else
+ {
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+ // must be string type
+ return new Boolean((String) obj);
+ }
+ }
+ 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();
+ //System.out.println("validating : " + _exp.getType());
+
+ if (!eType.getIsArray() &&
+ TypeResolver.isNumeric(eType) || TypeResolver.isString(eType))
+ {
+ _dataType.setType(TypeConstants.booleanType);
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+
+ return true;
+ }
+ else
+ {
+ //System.out.println("validation failure: " + _exp.toString() + _exp.getClass());
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+
+ return false;
+ }
+ }
+
+ public String toString()
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+ String retStr= "toBoolean("+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/ToBoolean.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToLower.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToLower.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToLower.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToLower.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.SingleArgumentExpression;
-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 ToLower extends SingleArgumentExpression implements
- StringExpression
-{
-
- public static final String className = ToLower.class.getName();
-
- private static Logger logger = SPLLogger.getSPLLogger().getLogger();
- private static final String sourceClass="ToLower";
-
-
-
- public ToLower(List exprList, boolean validateExpression)
- throws SPLException
- {
- super(exprList);
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ToLower");
-
- 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()+" "+ "ToLower");
-
- }
-
- public Object evaluate() throws SPLException
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
- try
- {
- Object obj = _exp.evaluate();
- String result = (((String) obj).toLowerCase());
- 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();
-
- if (TypeResolver.isString(eType))
- {
- _dataType.setType(TypeConstants.stringType);
- 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= "toLower("+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.SingleArgumentExpression;
+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 ToLower extends SingleArgumentExpression implements
+ StringExpression
+{
+
+ public static final String className = ToLower.class.getName();
+
+ private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+ private static final String sourceClass="ToLower";
+
+
+
+ public ToLower(List exprList, boolean validateExpression)
+ throws SPLException
+ {
+ super(exprList);
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ToLower");
+
+ 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()+" "+ "ToLower");
+
+ }
+
+ public Object evaluate() throws SPLException
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+ try
+ {
+ Object obj = _exp.evaluate();
+ String result = (((String) obj).toLowerCase());
+ 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();
+
+ if (TypeResolver.isString(eType))
+ {
+ _dataType.setType(TypeConstants.stringType);
+ 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= "toLower("+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/ToLower.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToMilliseconds.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToMilliseconds.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToMilliseconds.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToMilliseconds.java Fri Jan 11 10:56:30 2008
@@ -1,121 +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 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 ToMilliseconds extends SingleArgumentExpression implements
- NumericExpression
-{
-
- public static final String className = ToMilliseconds.class.getName();
-
- private static Logger logger = SPLLogger.getSPLLogger().getLogger();
- private static final String sourceClass="ToMilliseconds";
-
-
-
- public ToMilliseconds(List exprList, boolean validateExpression)
- throws SPLException
- {
- super(exprList);
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ToMilliseconds");
-
- 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()+" "+ "ToMilliseconds");
-
- }
-
- 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();
- Number result = new Long(calendar.getTime().getTime());
- 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.isCalendar(eType))
- {
- _dataType.setType(TypeConstants.longType);
- 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= "toMilliseconds("+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.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 ToMilliseconds extends SingleArgumentExpression implements
+ NumericExpression
+{
+
+ public static final String className = ToMilliseconds.class.getName();
+
+ private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+ private static final String sourceClass="ToMilliseconds";
+
+
+
+ public ToMilliseconds(List exprList, boolean validateExpression)
+ throws SPLException
+ {
+ super(exprList);
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ToMilliseconds");
+
+ 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()+" "+ "ToMilliseconds");
+
+ }
+
+ 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();
+ Number result = new Long(calendar.getTime().getTime());
+ 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.isCalendar(eType))
+ {
+ _dataType.setType(TypeConstants.longType);
+ 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= "toMilliseconds("+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/ToMilliseconds.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToREAL32.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToREAL32.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToREAL32.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToREAL32.java Fri Jan 11 10:56:30 2008
@@ -1,124 +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 ToREAL32 extends SingleArgumentExpression implements
- NumericExpression
-{
-
- public static final String className = ToREAL32.class.getName();
-
- private static Logger logger = SPLLogger.getSPLLogger().getLogger();
- private static final String sourceClass="ToREAL32";
-
-
-
- public ToREAL32(List exprList, boolean validateExpression)
- throws SPLException
- {
- super(exprList);
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ToREAL32");
-
- 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()+" "+ "ToREAL32");
-
- }
-
- public Object evaluate() throws SPLException
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
- try
- {
- Object obj = _exp.evaluate();
- if (obj instanceof Number)
- {
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
- return new Float(((Number) obj).floatValue());
- }
- else
- {
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
- // must be string type
- return new Float((String) obj);
- }
- }
- 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 (TypeResolver.isNumeric(eType) || TypeResolver.isString(eType))
- {
- _dataType.setType(TypeConstants.floatType);
- 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= "toREAL32("+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 ToREAL32 extends SingleArgumentExpression implements
+ NumericExpression
+{
+
+ public static final String className = ToREAL32.class.getName();
+
+ private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+ private static final String sourceClass="ToREAL32";
+
+
+
+ public ToREAL32(List exprList, boolean validateExpression)
+ throws SPLException
+ {
+ super(exprList);
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ToREAL32");
+
+ 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()+" "+ "ToREAL32");
+
+ }
+
+ public Object evaluate() throws SPLException
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+ try
+ {
+ Object obj = _exp.evaluate();
+ if (obj instanceof Number)
+ {
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+ return new Float(((Number) obj).floatValue());
+ }
+ else
+ {
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+ // must be string type
+ return new Float((String) obj);
+ }
+ }
+ 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 (TypeResolver.isNumeric(eType) || TypeResolver.isString(eType))
+ {
+ _dataType.setType(TypeConstants.floatType);
+ 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= "toREAL32("+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/ToREAL32.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToREAL64.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToREAL64.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToREAL64.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToREAL64.java Fri Jan 11 10:56:30 2008
@@ -1,130 +1,130 @@
-/*
- * 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 ToREAL64 extends SingleArgumentExpression implements
- NumericExpression
-{
-
- public static final String className = ToREAL64.class.getName();
-
- private static Logger logger = SPLLogger.getSPLLogger().getLogger();
- private static final String sourceClass="ToREAL64";
-
-
-
- public ToREAL64(List exprList, boolean validateExpression)
- throws SPLException
- {
- super(exprList);
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ToREAL64");
-
- 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()+" "+ "ToREAL64");
-
- }
-
- public Object evaluate() throws SPLException
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
- try
- {
- Object obj = _exp.evaluate();
-
- if (obj instanceof Number)
- {
- Number result = new Double(((Number) obj).doubleValue());
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
-
-
- return result;
- }
- else
- {
- Number result = new Double((String) obj);
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
-
-
- // must be string type
- 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 (TypeResolver.isNumeric(eType) || TypeResolver.isString(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 retStr= "toREAL64("+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 ToREAL64 extends SingleArgumentExpression implements
+ NumericExpression
+{
+
+ public static final String className = ToREAL64.class.getName();
+
+ private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+ private static final String sourceClass="ToREAL64";
+
+
+
+ public ToREAL64(List exprList, boolean validateExpression)
+ throws SPLException
+ {
+ super(exprList);
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ToREAL64");
+
+ 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()+" "+ "ToREAL64");
+
+ }
+
+ public Object evaluate() throws SPLException
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+ try
+ {
+ Object obj = _exp.evaluate();
+
+ if (obj instanceof Number)
+ {
+ Number result = new Double(((Number) obj).doubleValue());
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
+
+
+ return result;
+ }
+ else
+ {
+ Number result = new Double((String) obj);
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
+
+
+ // must be string type
+ 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 (TypeResolver.isNumeric(eType) || TypeResolver.isString(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 retStr= "toREAL64("+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/ToREAL64.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToSINT16.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToSINT16.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToSINT16.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToSINT16.java Fri Jan 11 10:56:30 2008
@@ -1,127 +1,127 @@
-/*
- * 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 ToSINT16 extends SingleArgumentExpression implements
- NumericExpression
-{
-
- public static final String className = ToSINT16.class.getName();
-
- private static Logger logger = SPLLogger.getSPLLogger().getLogger();
- private static final String sourceClass="ToSINT16";
-
-
-
- public ToSINT16(List exprList, boolean validateExpression)
- throws SPLException
- {
- super(exprList);
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ToSINT16");
-
- 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()+" "+ "ToSINT16");
-
- }
-
- public Object evaluate() throws SPLException
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
- try
- {
- Object obj = _exp.evaluate();
- Short result = null;
- if (obj instanceof Number)
- {
- result = new Short(((Number) obj).shortValue());
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
-
- return result;
- }
- else
- {
- result = new Short((String) obj);
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
-
- // must be string type
- 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 (TypeResolver.isNumeric(eType) || TypeResolver.isString(eType))
- {
- _dataType.setType(TypeConstants.shortType);
- 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= "toSINT16("+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 ToSINT16 extends SingleArgumentExpression implements
+ NumericExpression
+{
+
+ public static final String className = ToSINT16.class.getName();
+
+ private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+ private static final String sourceClass="ToSINT16";
+
+
+
+ public ToSINT16(List exprList, boolean validateExpression)
+ throws SPLException
+ {
+ super(exprList);
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ToSINT16");
+
+ 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()+" "+ "ToSINT16");
+
+ }
+
+ public Object evaluate() throws SPLException
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+ try
+ {
+ Object obj = _exp.evaluate();
+ Short result = null;
+ if (obj instanceof Number)
+ {
+ result = new Short(((Number) obj).shortValue());
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
+
+ return result;
+ }
+ else
+ {
+ result = new Short((String) obj);
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
+
+ // must be string type
+ 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 (TypeResolver.isNumeric(eType) || TypeResolver.isString(eType))
+ {
+ _dataType.setType(TypeConstants.shortType);
+ 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= "toSINT16("+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/ToSINT16.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToSINT32.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToSINT32.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToSINT32.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToSINT32.java Fri Jan 11 10:56:30 2008
@@ -1,127 +1,127 @@
-/*
- * 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 ToSINT32 extends SingleArgumentExpression implements
- NumericExpression
-{
-
- public static final String className = ToSINT32.class.getName();
-
- private static Logger logger = SPLLogger.getSPLLogger().getLogger();
- private static final String sourceClass="ToSINT32";
-
-
-
- public ToSINT32(List exprList, boolean validateExpression)
- throws SPLException
- {
- super(exprList);
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ToSINT32");
-
- 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()+" "+ "ToSINT32");
-
- }
-
- public Object evaluate() throws SPLException
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
- try
- {
- Object obj = _exp.evaluate();
- Integer result = null;
- if (obj instanceof Number)
- {
- result = new Integer(((Number) obj).intValue());
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
- return result;
- }
- else
- {
- result = new Integer((String) obj);
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
- // must be string type
- 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 (TypeResolver.isNumeric(eType) || 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= "toSINT32("+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 ToSINT32 extends SingleArgumentExpression implements
+ NumericExpression
+{
+
+ public static final String className = ToSINT32.class.getName();
+
+ private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+ private static final String sourceClass="ToSINT32";
+
+
+
+ public ToSINT32(List exprList, boolean validateExpression)
+ throws SPLException
+ {
+ super(exprList);
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ToSINT32");
+
+ 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()+" "+ "ToSINT32");
+
+ }
+
+ public Object evaluate() throws SPLException
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+ try
+ {
+ Object obj = _exp.evaluate();
+ Integer result = null;
+ if (obj instanceof Number)
+ {
+ result = new Integer(((Number) obj).intValue());
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+ return result;
+ }
+ else
+ {
+ result = new Integer((String) obj);
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+ // must be string type
+ 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 (TypeResolver.isNumeric(eType) || 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= "toSINT32("+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/ToSINT32.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToSINT64.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToSINT64.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToSINT64.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/ToSINT64.java Fri Jan 11 10:56:30 2008
@@ -1,126 +1,126 @@
-/*
- * 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 ToSINT64 extends SingleArgumentExpression implements
- NumericExpression
-{
-
- public static final String className = ToSINT64.class.getName();
-
- private static Logger logger = SPLLogger.getSPLLogger().getLogger();
- private static final String sourceClass="ToSINT64";
-
-
-
- public ToSINT64(List exprList, boolean validateExpression)
- throws SPLException
- {
- super(exprList);
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ToSINT64");
-
- 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()+" "+ "ToSINT64");
-
- }
-
- public Object evaluate() throws SPLException
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-
- try
- {
- Object obj = _exp.evaluate();
- Long result = null;
- if (obj instanceof Number)
- {
- result = new Long(((Number) obj).longValue());
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
-
- return result;
- }
- else
- {
- result = new Long((String) obj);
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
-
- // must be string type
- 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 (TypeResolver.isNumeric(eType) || TypeResolver.isString(eType))
- {
- _dataType.setType(TypeConstants.longType);
- 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= "toSINT64("+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 ToSINT64 extends SingleArgumentExpression implements
+ NumericExpression
+{
+
+ public static final String className = ToSINT64.class.getName();
+
+ private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+ private static final String sourceClass="ToSINT64";
+
+
+
+ public ToSINT64(List exprList, boolean validateExpression)
+ throws SPLException
+ {
+ super(exprList);
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ToSINT64");
+
+ 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()+" "+ "ToSINT64");
+
+ }
+
+ public Object evaluate() throws SPLException
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+ try
+ {
+ Object obj = _exp.evaluate();
+ Long result = null;
+ if (obj instanceof Number)
+ {
+ result = new Long(((Number) obj).longValue());
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
+
+ return result;
+ }
+ else
+ {
+ result = new Long((String) obj);
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
+
+ // must be string type
+ 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 (TypeResolver.isNumeric(eType) || TypeResolver.isString(eType))
+ {
+ _dataType.setType(TypeConstants.longType);
+ 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= "toSINT64("+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/ToSINT64.java
------------------------------------------------------------------------------
svn:eol-style = native