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

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


    }

    //percentile has to be between 0 and 1 - here we test more than 1
    public void testUnusualArgs3() {
        ValueEval[] values = { new NumberEval(1), new NumberEval(2) };
        ValueEval percentile = new NumberEval(1.1);
        confirmPercentile(percentile, values, ErrorEval.NUM_ERROR);
    }
View Full Code Here


    }

    //here we test where there are errors as part of inputs
    public void testErrors() {
        ValueEval[] values = { new NumberEval(1), ErrorEval.NAME_INVALID, new NumberEval(3), ErrorEval.DIV_ZERO, };
        ValueEval percentile = new NumberEval(0.95);
        confirmPercentile(percentile, values, ErrorEval.NAME_INVALID);
    }
View Full Code Here

    }

    //here we test where there are errors as part of inputs
    public void testErrors2() {
        ValueEval[] values = { new NumberEval(1), new NumberEval(2), new NumberEval(3), ErrorEval.DIV_ZERO, };
        ValueEval percentile = new NumberEval(0.95);
        confirmPercentile(percentile, values, ErrorEval.DIV_ZERO);
    }
View Full Code Here

      TwoDEval ae = (TwoDEval) operand;
      int width = ae.getWidth();
      int height = ae.getHeight();
      for (int rrIx=0; rrIx<height; rrIx++) {
        for (int rcIx=0; rcIx<width; rcIx++) {
          ValueEval ve = ae.getValue(rrIx, rcIx);
                    if(!isSubtotalCounted() && ae.isSubTotal(rrIx, rcIx)) continue;
                    collectValue(ve, true, temp);
        }
      }
      return;
View Full Code Here

        Double result = null;
        if (args.length == 0 || args.length % 2 > 0) {
            return ErrorEval.VALUE_INVALID;
        }
        for (int i = 0; i < args.length; ) {
            ValueEval firstArg = args[i];
            ValueEval secondArg = args[i + 1];
            i += 2;
            NumberEval evaluate = (NumberEval) new Countif().evaluate(new ValueEval[]{firstArg, secondArg}, ec.getRowIndex(), ec.getColumnIndex());
            if (result == null) {
                result = evaluate.getNumberValue();
            } else if (evaluate.getNumberValue() < result) {
View Full Code Here

    int maxN = args.length;

    if(maxN < 1) {
      return ErrorEval.VALUE_INVALID;
    }
    ValueEval firstArg = args[0];
    try {
      if(firstArg instanceof NumericValueEval) {
        return evaluateSingleProduct(args);
      }
      if(firstArg instanceof RefEval) {
        return evaluateSingleProduct(args);
      }
      if (firstArg instanceof TwoDEval) {
        TwoDEval ae = (TwoDEval) firstArg;
        if(ae.isRow() && ae.isColumn()) {
          return evaluateSingleProduct(args);
        }
        return evaluateAreaSumProduct(args);
      }
    } catch (EvaluationException e) {
      return e.getErrorEval();
    }
    throw new RuntimeException("Invalid arg type for SUMPRODUCT: ("
        + firstArg.getClass().getName() + ")");
  }
View Full Code Here

    return new NumberEval(term);
  }

  private static double getScalarValue(ValueEval arg) throws EvaluationException {

    ValueEval eval;
    if (arg instanceof RefEval) {
      RefEval re = (RefEval) arg;
      if (re.getNumberOfSheets() > 1) {
                throw new EvaluationException(ErrorEval.VALUE_INVALID);
      }
View Full Code Here

  private static void throwFirstError(TwoDEval areaEval) throws EvaluationException {
    int height = areaEval.getHeight();
    int width = areaEval.getWidth();
    for (int rrIx=0; rrIx<height; rrIx++) {
      for (int rcIx=0; rcIx<width; rcIx++) {
        ValueEval ve = areaEval.getValue(rrIx, rcIx);
        if (ve instanceof ErrorEval) {
          throw new EvaluationException((ErrorEval) ve);
        }
      }
    }
View Full Code Here

      TwoDEval ae = (TwoDEval) arg;
      int width = ae.getWidth();
      int height = ae.getHeight();
      for (int rrIx = 0; rrIx < height; rrIx++) {
        for (int rcIx = 0; rcIx < width; rcIx++) {
          ValueEval ve1 = ae.getValue(rrIx, rcIx);
          collectValue(ve1, temp, false);
        }
      }
      return;
    }
View Full Code Here

            for (int sIx=ae.getFirstSheetIndex(); sIx <= ae.getLastSheetIndex(); sIx++) {
                int width = ae.getWidth();
                int height = ae.getHeight();
                for (int rrIx=0; rrIx<height; rrIx++) {
                    for (int rcIx=0; rcIx<width; rcIx++) {
                        ValueEval ve = ae.getValue(sIx, rrIx, rcIx);
                        if(!isSubtotalCounted() && ae.isSubTotal(rrIx, rcIx)) continue;
                        collectValue(ve, true, temp);
                    }
                }
            }
            return;
        }
    if (operand instanceof TwoDEval) {
      TwoDEval ae = (TwoDEval) operand;
      int width = ae.getWidth();
      int height = ae.getHeight();
      for (int rrIx=0; rrIx<height; rrIx++) {
        for (int rcIx=0; rcIx<width; rcIx++) {
          ValueEval ve = ae.getValue(rrIx, rcIx);
                    if(!isSubtotalCounted() && ae.isSubTotal(rrIx, rcIx)) continue;
                    collectValue(ve, true, temp);
        }
      }
      return;
View Full Code Here

TOP

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

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.