Package org.apache.poi.hssf.record.formula.eval

Examples of org.apache.poi.hssf.record.formula.eval.AreaEval


    }
    Eval firstArg = args[0];

    int result;
    if (firstArg instanceof AreaEval) {
      AreaEval ae = (AreaEval) firstArg;
      result = ae.getLastRow() - ae.getFirstRow() + 1;
    } else if (firstArg instanceof RefEval) {
      result = 1;
    } else { // anything else is not valid argument
      return ErrorEval.VALUE_INVALID;
    }
View Full Code Here


     * Note: no short-circuit boolean loop exit because any ErrorEvals will override the result
     */
    for (int i=0, iSize=args.length; i<iSize; i++) {
      Eval arg = args[i];
      if (arg instanceof AreaEval) {
        AreaEval ae = (AreaEval) arg;
        int height = ae.getHeight();
        int width = ae.getWidth();
        for (int rrIx=0; rrIx<height; rrIx++) {
          for (int rcIx=0; rcIx<width; rcIx++) {
            ValueEval ve = ae.getRelativeValue(rrIx, rcIx);
            Boolean tempVe = OperandResolver.coerceValueToBoolean(ve, true);
            if (tempVe != null) {
              result = partialEvaluate(result, tempVe.booleanValue());
              atleastOneNonBlank = true;
            }
View Full Code Here

    }


    try {
      ValueEval lookupValue = OperandResolver.getSingleValue(args[0], srcCellRow, srcCellCol);
      AreaEval aeLookupVector = LookupUtils.resolveTableArrayArg(args[1]);
      AreaEval aeResultVector = LookupUtils.resolveTableArrayArg(args[2]);

      ValueVector lookupVector = createVector(aeLookupVector);
      ValueVector resultVector = createVector(aeResultVector);
      if(lookupVector.getSize() > resultVector.getSize()) {
        // Excel seems to handle this by accessing past the end of the result vector.
View Full Code Here

      // else the other variation of this function takes an array as the first argument
      // it seems like interface 'ArrayEval' does not even exist yet
      throw new RuntimeException("Incomplete code - cannot handle first arg of type ("
          + firstArg.getClass().getName() + ")");
    }
    AreaEval reference = (AreaEval) firstArg;

    int rowIx = 0;
    int columnIx = 0;
    boolean colArgWasPassed = false;
    try {
View Full Code Here

   * Collects values from a single argument
   */
  private void collectValues(Eval operand, DoubleList temp) throws EvaluationException {

    if (operand instanceof AreaEval) {
      AreaEval ae = (AreaEval) 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.getRelativeValue(rrIx, rcIx);
          collectValue(ve, true, temp);
        }
      }
      return;
    }
View Full Code Here

      int rowNum, int colNum, double expectedResult) {
    ValueEval[] values = new ValueEval[dValues.length];
    for (int i = 0; i < values.length; i++) {
      values[i] = new NumberEval(dValues[i]);
    }
    AreaEval arg0 = EvalFactory.createAreaEval(areaRefString, values);

    Eval[] args;
    if (colNum > 0) {
      args = new Eval[] { arg0, new NumberEval(rowNum), new NumberEval(colNum), };
    } else {
View Full Code Here

    ValueEval[] values = {
        new NumberEval(25.0),
        new NumberEval(26.0),
        new NumberEval(28.0),
    };
    AreaEval arg0 = EvalFactory.createAreaEval("A10:C10", values);
    Eval[] args = new Eval[] { arg0, MissingArgEval.instance, new NumberEval(2), };
    Eval actualResult;
    try {
      actualResult = FUNC_INST.evaluate(args, 1, (short)1);
    } catch (RuntimeException e) {
View Full Code Here

    confirmCountA(59, args);
  }

  public void testCountIf() {

    AreaEval range;
    ValueEval[] values;

    // when criteria is a boolean value
    values = new ValueEval[] {
        new NumberEval(0),
View Full Code Here

    }
    assertFalse(mp.matches(seA));
    assertTrue(mp.matches(seB));

    // general tests for not-equal (<>) operator
    AreaEval range;
    ValueEval[] values;

    values = new ValueEval[] {
        new StringEval("aa"),
        new StringEval("def"),
View Full Code Here

        new NumberEval(21),
        new NumberEval(25),
        new NumberEval(25),
        new NumberEval(25),
    };
    AreaEval arg0 = EvalFactory.createAreaEval("C1:C6", values);

    ValueEval criteriaArg = EvalFactory.createRefEval("A1", new NumberEval(25));
    Eval[] args=  { arg0, criteriaArg, };

    double actual = NumericFunctionInvoker.invoke(new Countif(), args);
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.record.formula.eval.AreaEval

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.