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

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


    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() + ")");
View Full Code Here


    if(match_type instanceof ErrorEval) {
      throw new EvaluationException((ErrorEval)match_type);
    }
    if(match_type instanceof NumericValueEval) {
      NumericValueEval ne = (NumericValueEval) match_type;
      return ne.getNumberValue();
    }
    if (match_type instanceof StringEval) {
      StringEval se = (StringEval) match_type;
      Double d = OperandResolver.parseDouble(se.getStringValue());
      if(d == null) {
View Full Code Here

      throw EvaluationException.invalidValue();
      // This is in contrast to the code below,, where NumberEvals values (for
      // example 0.01) *do* resolve to equivalent boolean values.
    }
    if (valEval instanceof NumericValueEval) {
      NumericValueEval nve = (NumericValueEval) valEval;
      // zero is FALSE, everything else is TRUE
      return 0.0 != nve.getNumberValue();
    }
    throw new RuntimeException("Unexpected eval type (" + valEval.getClass().getName() + ")");
  }
View Full Code Here

  }
  private static void confirmInt(int expected, ValueEval actualEval) {
    if(!(actualEval instanceof NumericValueEval)) {
      fail("Expected numeric result");
    }
    NumericValueEval nve = (NumericValueEval)actualEval;
    assertEquals(expected, nve.getNumberValue(), 0);
  }
View Full Code Here

        temp.add(boolEval.getNumberValue());
      }
      return;
    }
    if (ve instanceof NumericValueEval) {
      NumericValueEval ne = (NumericValueEval) ve;
      temp.add(ne.getNumberValue());
      return;
    }
    if (ve instanceof StringValueEval) {
      if (isViaReference) {
        // ignore all ref strings
View Full Code Here

      // Note for area SUMPRODUCTs, string values are interpreted as zero
      // even if they would parse as valid numeric values
      return 0;
    }
    if(ve instanceof NumericValueEval) {
      NumericValueEval nve = (NumericValueEval) ve;
      return nve.getNumberValue();
    }
    throw new RuntimeException("Unexpected value eval class ("
        + ve.getClass().getName() + ")");
  }
View Full Code Here

        temp.add(boolEval.getNumberValue());
      }
      return;
    }
    if (ve instanceof NumericValueEval) {
      NumericValueEval ne = (NumericValueEval) ve;
      temp.add(ne.getNumberValue());
      return;
    }
    if (ve instanceof StringValueEval) {
      if (isViaReference) {
        // ignore all ref strings
View Full Code Here

    if(match_type instanceof ErrorEval) {
      throw new EvaluationException((ErrorEval)match_type);
    }
    if(match_type instanceof NumericValueEval) {
      NumericValueEval ne = (NumericValueEval) match_type;
      return ne.getNumberValue();
    }
    if (match_type instanceof StringEval) {
      StringEval se = (StringEval) match_type;
      Double d = OperandResolver.parseDouble(se.getStringValue());
      if(d == null) {
View Full Code Here

    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() + ")");
View Full Code Here

      throw EvaluationException.invalidValue();
      // This is in contrast to the code below,, where NumberEvals values (for
      // example 0.01) *do* resolve to equivalent boolean values.
    }
    if (valEval instanceof NumericValueEval) {
      NumericValueEval nve = (NumericValueEval) valEval;
      // zero is FALSE, everything else is TRUE
      return 0.0 != nve.getNumberValue();
    }
    throw new RuntimeException("Unexpected eval type (" + valEval.getClass().getName() + ")");
  }
View Full Code Here

TOP

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

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.