double left = leftLit.doubleValue();
double right = rightLit.doubleValue();
switch (op) {
case PLUS:
return new NumericLiteralImpl(left + right);
case MINUS:
return new NumericLiteralImpl(left - right);
case MULTIPLY:
return new NumericLiteralImpl(left * right);
case DIVIDE:
return new NumericLiteralImpl(left / right);
default:
throw new IllegalArgumentException("Unknown operator: " + op);
}
}
else if (commonDatatype.equals(XMLSchema.FLOAT)) {
float left = leftLit.floatValue();
float right = rightLit.floatValue();
switch (op) {
case PLUS:
return new NumericLiteralImpl(left + right);
case MINUS:
return new NumericLiteralImpl(left - right);
case MULTIPLY:
return new NumericLiteralImpl(left * right);
case DIVIDE:
return new NumericLiteralImpl(left / right);
default:
throw new IllegalArgumentException("Unknown operator: " + op);
}
}
else if (commonDatatype.equals(XMLSchema.DECIMAL)) {