{
//System.out.println(" expression3.getType().getIsArray() "+expression3.getType().getIsArray());
//System.out.println("expression3 "+expression3.getClass()+" "+expression3.toString());
logger.severe(Thread.currentThread().getName()+" "+"Last Expression should be a collection");
throw new SPLException("Last Expression should be a collection");
}
if (expression1.isArray())
{
logger.severe(Thread.currentThread().getName()+" "+"First Expression cannot be a collection");
throw new SPLException(Messages.getString(
"SPL_PASSED_EXPRESSION_TYPE_ERROR_MSG", new Object[] {
"left", "can not", "collection" }));
}
if (!TypeResolver.isString(middleType))
{
logger.severe(
"Middle Expression should be a string describing the Operation");
throw new SPLException(Messages.getString(
"SPL_PASSED_EXPRESSION_TYPE_ERROR_MSG", new Object[] {
"middle", "should", "string" }));
}
this.operationString = (String) expression2.evaluate();
if (this.operationString == null)
{
logger.severe(Thread.currentThread().getName()+" "+"Operation string is null");
throw new SPLException(Messages.getString(
"SPL_PASSED_EXPRESSION_ERROR_MSG", new Object[] {
"middle" }));
}
// if (this.operationString == null)
// {
// logger.severe(Thread.currentThread().getName()+" "+"Operation type is "
// + this.operationString);
//
// throw new SPLException("Operation type is "
// + this.operationString);
// }
if (operationString.equalsIgnoreCase(LAND)
|| operationString.equalsIgnoreCase(LOR)
|| operationString.equalsIgnoreCase(BXOR))
{
if (TypeResolver.isBoolean(leftType))
{
if (TypeResolver.isBoolean(rightType))
{
logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
return true;
}
else
{
logger.severe(
"LHS is of type Boolean but RHS is not of type Boolean");
throw new SPLException(Messages.getString(
"SPL_TYPE_NOT_COMPATIBLE_EXCEPTION_MSG",
new Object[] { leftType, rightType }));
}
}
else
{
logger.severe(
"Operation is of type Boolean but LHS is not of type boolean");
throw new SPLException(Messages.getString(
"SPL_PASSED_EXPRESSION_TYPE_ERROR_MSG", new Object[] {
"left", "is not", "boolean" }));
}
}
else if (operationString.equalsIgnoreCase(EQUAL)
|| operationString.equalsIgnoreCase(NOT_EQUAL)
|| operationString.equalsIgnoreCase(GT)
|| operationString.equalsIgnoreCase(GE)
|| operationString.equalsIgnoreCase(LT)
|| operationString.equalsIgnoreCase(LE))
{
if (TypeResolver.isTypeAssignableForEquality(leftType, rightType))
{
logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
return true;
}
else if (TypeResolver.isTypeAssignableForRelation(leftType,
rightType))
{
logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
return true;
}
else
{
logger.severe(
"types are not assignable for Relation or Equality");
throw new SPLException(Messages.getString(
"SPL_TYPE_NOT_COMPATIBLE_EXCEPTION_MSG",
new Object[] { leftType, rightType }));
}
}
else
{
logger.severe(
"operationString is not supported by AnyInCollection");
throw new SPLException(Messages.getString("SPL_OPERATION_NOT_SUPPORTED_EXCEPTION_MSG")); }
}