/** * * Applies the operator to the given value **/ public Object apply (Object pLeft, Object pRight, Logger pLogger) throws ELException { // Coerce the values to booleans boolean left = Coercions.coerceToBoolean (pLeft, pLogger).booleanValue (); boolean right = Coercions.coerceToBoolean (pRight, pLogger).booleanValue (); return PrimitiveObjects.getBoolean (left || right); }
/** * * Applies the operator to the given value **/ public Object apply (Object pLeft, Object pRight, Logger pLogger) throws ELException { // Coerce the values to booleans boolean left = Coercions.coerceToBoolean (pLeft, pLogger).booleanValue (); boolean right = Coercions.coerceToBoolean (pRight, pLogger).booleanValue (); return PrimitiveObjects.getBoolean (left && right); }
/** * * Applies the operator to the given value **/ public Object apply (Object pLeft, Object pRight, Logger pLogger) throws ELException { // Coerce the values to booleans boolean left = Coercions.coerceToBoolean (pLeft, pLogger).booleanValue (); boolean right = Coercions.coerceToBoolean (pRight, pLogger).booleanValue (); return PrimitiveObjects.getBoolean (left && right); }
/** * * Applies the operator to the given value **/ public Object apply (Object pLeft, Object pRight, Logger pLogger) throws ELException { // Coerce the values to booleans boolean left = Coercions.coerceToBoolean (pLeft, pLogger).booleanValue (); boolean right = Coercions.coerceToBoolean (pRight, pLogger).booleanValue (); return PrimitiveObjects.getBoolean (left || right); }
/** * * Applies the operator to the given value **/ public Object apply (Object pValue, Logger pLogger) throws ELException { // Coerce the value to a boolean boolean val = Coercions.coerceToBoolean (pValue, pLogger).booleanValue (); return PrimitiveObjects.getBoolean (!val); }
/** * * Applies the operator to the given value **/ public Object apply (Object pValue, Logger pLogger) throws ELException { // Coerce the value to a boolean boolean val = Coercions.coerceToBoolean (pValue, pLogger).booleanValue (); return PrimitiveObjects.getBoolean (!val); }
/** * * Evaluates the conditional expression and returns the literal result **/ public Object evaluate (VariableResolver vr, FunctionMapper f, Logger l) throws ELException { // first, evaluate the condition (and coerce the result to a boolean value) boolean condition = Coercions.coerceToBoolean( mCondition.evaluate(vr, f, l), l).booleanValue(); // then, use this boolean to branch appropriately if (condition) return mTrueBranch.evaluate(vr, f, l); else return mFalseBranch.evaluate(vr, f, l); }
/** * * Evaluates the conditional expression and returns the literal result **/ public Object evaluate (VariableResolver vr, FunctionMapper f, Logger l) throws ELException { // first, evaluate the condition (and coerce the result to a boolean value) boolean condition = Coercions.coerceToBoolean( mCondition.evaluate(vr, f, l), l).booleanValue(); // then, use this boolean to branch appropriately if (condition) return mTrueBranch.evaluate(vr, f, l); else return mFalseBranch.evaluate(vr, f, l); }
/** * * Evaluates to the literal value **/ public Object evaluate (VariableResolver pResolver, FunctionMapper functions, Logger pLogger) throws ELException { Object value = mExpression.evaluate (pResolver, functions, pLogger); for (int i = 0; i < mOperators.size (); i++) { BinaryOperator operator = (BinaryOperator) mOperators.get (i); // For the And/Or operators, we need to coerce to a boolean // before testing if we shouldEvaluate if (operator.shouldCoerceToBoolean ()) { value = Coercions.coerceToBoolean (value, pLogger); } if (operator.shouldEvaluate (value)) { Expression expression = (Expression) mExpressions.get (i); Object nextValue = expression.evaluate (pResolver, functions, pLogger); value = operator.apply (value, nextValue, pLogger); } } return value; }
/** * * Evaluates to the literal value **/ public Object evaluate (VariableResolver pResolver, FunctionMapper functions, Logger pLogger) throws ELException { Object value = mExpression.evaluate (pResolver, functions, pLogger); for (int i = 0; i < mOperators.size (); i++) { BinaryOperator operator = (BinaryOperator) mOperators.get (i); // For the And/Or operators, we need to coerce to a boolean // before testing if we shouldEvaluate if (operator.shouldCoerceToBoolean ()) { value = Coercions.coerceToBoolean (value, pLogger); } if (operator.shouldEvaluate (value)) { Expression expression = (Expression) mExpressions.get (i); Object nextValue = expression.evaluate (pResolver, functions, pLogger); value = operator.apply (value, nextValue, pLogger); } } return value; }
/** * * Coerces the given value to the specified class. **/ public static Object coerce (Object pValue, Class pClass, Logger pLogger) throws ELException { if (pClass == String.class) { return coerceToString (pValue, pLogger); } else if (isNumberClass (pClass)) { return coerceToPrimitiveNumber (pValue, pClass, pLogger); } else if (pClass == Character.class || pClass == Character.TYPE) { return coerceToCharacter (pValue, pLogger); } else if (pClass == Boolean.class || pClass == Boolean.TYPE) { return coerceToBoolean (pValue, pLogger); } else { return coerceToObject (pValue, pClass, pLogger); } }
/** * * Coerces the given value to the specified class. **/ public static Object coerce (Object pValue, Class pClass, Logger pLogger) throws ELException { if (pClass == String.class) { return coerceToString (pValue, pLogger); } else if (isNumberClass (pClass)) { return coerceToPrimitiveNumber (pValue, pClass, pLogger); } else if (pClass == Character.class || pClass == Character.TYPE) { return coerceToCharacter (pValue, pLogger); } else if (pClass == Boolean.class || pClass == Boolean.TYPE) { return coerceToBoolean (pValue, pLogger); } else { return coerceToObject (pValue, pClass, pLogger); } }
boolean left = coerceToBoolean (pLeft, pLogger).booleanValue (); boolean right = coerceToBoolean (pRight, pLogger).booleanValue (); return PrimitiveObjects.getBoolean
boolean left = coerceToBoolean (pLeft, pLogger).booleanValue (); boolean right = coerceToBoolean (pRight, pLogger).booleanValue (); return PrimitiveObjects.getBoolean