Object sum = null;
Object expResult = this._exp.evaluate();
if (!(expResult instanceof java.util.List))
{
logger.severe(Thread.currentThread().getName()+" "+"result of expression is not of type List");
throw new SPLException(Messages.getString(
"SPL_NOT_REQUIRED_EXP_EXCEPTION_MSG",
new Object[] { "List" }));
}
ArrayList resultArray = (ArrayList) expResult;
//System.out.println("resultArray size " + resultArray.size()+ " to string " + resultArray.toString());
////System.out.println("resultArray is of type "+expression.getType());
if ((resultArray != null) && (!resultArray.isEmpty()))
{
Iterator resultIt = resultArray.iterator();
while (resultIt.hasNext())
{
Object resultObject = resultIt.next();
//System.out.println("resultObject,class " + resultObject + " " + resultObject.getClass());
if (sum == null)
{
sum = resultObject;
}
else
{
//System.out.println("Adding resultObject to sum is "+ resultObject + " " + sum);
sum = ExpressionUtility.plus((Number) sum,
(Number) resultObject);
}
//System.out.println("current sum is " + sum);
}
//System.out.println("sum " + sum);
logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate "+sum);
return sum;
}
else
{
logger.severe(Thread.currentThread().getName()+" "+"result Array is empty");
throw new SPLException(Messages.getString(
"SPL_BLANK_EXPRESSION_PASSED_ERROR_MSG",
new Object[] { "" }));
}
}