import org.apache.poi.ss.formula.WorkbookEvaluator;
import org.apache.poi.ss.formula.eval.BoolEval;
import org.apache.poi.ss.formula.eval.ErrorEval;
-import org.apache.poi.ss.formula.eval.NumberEval;
-import org.apache.poi.ss.formula.eval.StringEval;
+import org.apache.poi.ss.formula.eval.NumericValueEval;
+import org.apache.poi.ss.formula.eval.StringValueEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.udf.UDFFinder;
import org.apache.poi.ss.usermodel.Cell;
/**
* Returns a CellValue wrapper around the supplied ValueEval instance.
- * @param eval
+ * @param cell
*/
private CellValue evaluateFormulaCellValue(Cell cell) {
ValueEval eval = _bookEvaluator.evaluate(new HSSFEvaluationCell((HSSFCell)cell));
- if (eval instanceof NumberEval) {
- NumberEval ne = (NumberEval) eval;
- return new CellValue(ne.getNumberValue());
- }
if (eval instanceof BoolEval) {
BoolEval be = (BoolEval) eval;
return CellValue.valueOf(be.getBooleanValue());
}
- if (eval instanceof StringEval) {
- StringEval ne = (StringEval) eval;
+ 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) {
import org.apache.poi.ss.formula.eval.ErrorEval;
import org.apache.poi.ss.formula.eval.EvaluationException;
import org.apache.poi.ss.formula.eval.NumberEval;
+import org.apache.poi.ss.formula.eval.NumericValueEval;
import org.apache.poi.ss.formula.eval.OperandResolver;
import org.apache.poi.ss.formula.eval.RefEval;
-import org.apache.poi.ss.formula.eval.StringEval;
+import org.apache.poi.ss.formula.eval.StringValueEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.TwoDEval;
if (ve == null) {
throw new IllegalArgumentException("ve must not be null");
}
- if (ve instanceof NumberEval) {
- NumberEval ne = (NumberEval) ve;
- temp.add(ne.getNumberValue());
+ if (ve instanceof BoolEval) {
+ if (!isViaReference || _isReferenceBoolCounted) {
+ BoolEval boolEval = (BoolEval) ve;
+ temp.add(boolEval.getNumberValue());
+ }
return;
}
- if (ve instanceof ErrorEval) {
- throw new EvaluationException((ErrorEval) ve);
+ if (ve instanceof NumericValueEval) {
+ NumericValueEval ne = (NumericValueEval) ve;
+ temp.add(ne.getNumberValue());
+ return;
}
- if (ve instanceof StringEval) {
+ if (ve instanceof StringValueEval) {
if (isViaReference) {
// ignore all ref strings
return;
}
- String s = ((StringEval) ve).getStringValue();
+ String s = ((StringValueEval) ve).getStringValue();
Double d = OperandResolver.parseDouble(s);
if(d == null) {
throw new EvaluationException(ErrorEval.VALUE_INVALID);
temp.add(d.doubleValue());
return;
}
- if (ve instanceof BoolEval) {
- if (!isViaReference || _isReferenceBoolCounted) {
- BoolEval boolEval = (BoolEval) ve;
- temp.add(boolEval.getNumberValue());
- }
- return;
+ if (ve instanceof ErrorEval) {
+ throw new EvaluationException((ErrorEval) ve);
}
if (ve == BlankEval.instance) {
if (_isBlankCounted) {