Eval retval = null;
double d = 0;
switch (operands.length) {
default: // will rarely happen. currently the parser itself fails.
retval = ErrorEval.UNKNOWN_ERROR;
break;
case 2:
for (int i = 0, iSize = 2; retval==null && i < iSize; i++) {
ValueEval ve = singleOperandEvaluate(operands[i], srcRow, srcCol);
if (ve instanceof NumericValueEval) {
d += ((NumericValueEval) ve).getNumberValue();
}
else if (ve instanceof BlankEval) {
// do nothing
}
else {
retval = ErrorEval.VALUE_INVALID;
}
} // end for inside case
} // end switch
if (retval == null) {
retval = Double.isNaN(d) ? (ValueEval) ErrorEval.VALUE_INVALID : new NumberEval(d);
}
return retval;