public TypeValuePair evaluate(final FormulaContext context,
final TypeValuePair value1,
final TypeValuePair value2)
throws EvaluationException
{
final TypeRegistry typeRegistry = context.getTypeRegistry();
// Error or empty string, that's the question ..
final Object raw1 = value1.getValue();
final Object raw2 = value2.getValue();
if (raw1 == null || raw2 == null)
{
throw new EvaluationException(LibFormulaErrorValue.ERROR_NA_VALUE);
}
final String text1 = typeRegistry.convertToText(value1.getType(), raw1);
final String text2 = typeRegistry.convertToText(value2.getType(), raw2);
if (text1 == null && text2 == null)
{
throw new EvaluationException
(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
}