Package org.apache.poi.ss.formula.eval

Examples of org.apache.poi.ss.formula.eval.NumberEval


        NumberEval result = (NumberEval) eDate.evaluate(new ValueEval[]{new RefEvalImplementation(new NumberEval(1000)), new NumberEval(0)}, null);
        assertEquals(1000d, result.getNumberValue());
    }

    public void testEDateInvalidValueEval() {
        ValueEval evaluate = new EDate().evaluate(new ValueEval[]{new ValueEval() {}, new NumberEval(0)}, null);
        assertTrue(evaluate instanceof ErrorEval);
        assertEquals(ErrorEval.VALUE_INVALID, evaluate);
    }
View Full Code Here


        assertTrue(evaluate instanceof ErrorEval);
        assertEquals(ErrorEval.VALUE_INVALID, evaluate);
    }

    public void testEDateBlankValueEval() {
        NumberEval evaluate = (NumberEval) new EDate().evaluate(new ValueEval[]{BlankEval.instance, new NumberEval(0)}, null);
        assertEquals(-1.0d, evaluate.getNumberValue());
    }
View Full Code Here

        assertEquals(-1.0d, evaluate.getNumberValue());
    }

    public void testEDateBlankRefValueEval() {
        EDate eDate = new EDate();
        NumberEval result = (NumberEval) eDate.evaluate(new ValueEval[]{new RefEvalImplementation(BlankEval.instance), new NumberEval(0)}, null);
        assertEquals("0 startDate triggers BAD_DATE currently, thus -1.0!",
                -1.0d, result.getNumberValue());

        result = (NumberEval) eDate.evaluate(new ValueEval[]{new NumberEval(1), new RefEvalImplementation(BlankEval.instance)}, null);
        assertEquals("Blank is handled as 0 otherwise",
                1.0d, result.getNumberValue());
    }
View Full Code Here

      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:
View Full Code Here

    if (ptg instanceof NameXPtg) {
       return ec.getNameXEval(((NameXPtg) ptg));
    }

    if (ptg instanceof IntPtg) {
      return new NumberEval(((IntPtg)ptg).getValue());
    }
    if (ptg instanceof NumberPtg) {
      return new NumberEval(((NumberPtg)ptg).getValue());
    }
    if (ptg instanceof StringPtg) {
      return new StringEval(((StringPtg) ptg).getValue());
    }
    if (ptg instanceof BoolPtg) {
View Full Code Here

    if(mp == null) {
      // If the criteria arg is a reference to a blank cell, countif always returns zero.
      return NumberEval.ZERO;
    }
    double result = countMatchingCellsInArea(arg0, mp);
    return new NumberEval(result);
  }
View Full Code Here

          // x is text that is not a number
          return false;
        }
        return _value == val.doubleValue();
      } else if((x instanceof NumberEval)) {
        NumberEval ne = (NumberEval) x;
        testValue = ne.getNumberValue();
      } else {
        return false;
      }
      return evaluate(Double.compare(testValue, _value));
    }
View Full Code Here

        NumericFunction.checkValue(result);
      } catch (EvaluationException e) {
        return e.getErrorEval();
      }

      return new NumberEval(result);
    }
View Full Code Here

        NumericFunction.checkValue(result);
      } catch (EvaluationException e) {
        return e.getErrorEval();
      }

      return new NumberEval(result);
    }
View Full Code Here

    if(mp == null) {
      // If the criteria arg is a reference to a blank cell, countif always returns zero.
      return NumberEval.ZERO;
    }
    double result = countMatchingCellsInArea(arg0, mp);
    return new NumberEval(result);
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.ss.formula.eval.NumberEval

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.