if (eval instanceof BoolEval) {
BoolEval be = (BoolEval) eval;
return CellValue.valueOf(be.getBooleanValue());
}
if (eval instanceof NumericValueEval) {
NumericValueEval ne = (NumericValueEval) eval;
return new CellValue(ne.getNumberValue());
}
if (eval instanceof StringValueEval) {
StringValueEval ne = (StringValueEval) eval;
return new CellValue(ne.getStringValue());
}
if (eval instanceof ErrorEval) {
return CellValue.getError(((ErrorEval)eval).getErrorCode());
}
throw new RuntimeException("Unexpected eval class (" + eval.getClass().getName() + ")");