/** * Gets the value from a non-formula cell. * * @param cell may be <code>null</code> * @return {@link BlankEval} if cell is <code>null</code> or blank, never <code>null</code> */ /* package */ static ValueEval getValueFromNonFormulaCell(EvaluationCell cell) { if (cell == null) { return BlankEval.INSTANCE; } int cellType = cell.getCellType(); switch (cellType) { case Cell.CELL_TYPE_NUMERIC: return new NumberEval(cell.getNumericCellValue()); case Cell.CELL_TYPE_STRING: return new StringEval(cell.getStringCellValue()); case Cell.CELL_TYPE_BOOLEAN: return BoolEval.valueOf(cell.getBooleanCellValue()); case Cell.CELL_TYPE_BLANK: return BlankEval.INSTANCE; case Cell.CELL_TYPE_ERROR: return ErrorEval.valueOf(cell.getErrorCellValue()); } throw new RuntimeException("Unexpected cell type (" + cellType + ")"); }