Examples of TwoDEval


Examples of org.apache.poi.ss.formula.TwoDEval

      ValueEval col_index, ValueEval range_lookup) {
    try {
      // Evaluation order:
      // lookup_value , table_array, range_lookup, find lookup value, col_index, fetch result
      ValueEval lookupValue = OperandResolver.getSingleValue(lookup_value, srcRowIndex, srcColumnIndex);
      TwoDEval tableArray = LookupUtils.resolveTableArrayArg(table_array);
      boolean isRangeLookup = LookupUtils.resolveRangeLookupArg(range_lookup, srcRowIndex, srcColumnIndex);
      int rowIndex = LookupUtils.lookupIndexOfValue(lookupValue, LookupUtils.createColumnVector(tableArray, 0), isRangeLookup);
      int colIndex = LookupUtils.resolveRowOrColIndexArg(col_index, srcRowIndex, srcColumnIndex);
      ValueVector resultCol = createResultColumnVector(tableArray, colIndex);
      return resultCol.getItem(rowIndex);
View Full Code Here

Examples of org.apache.poi.ss.formula.TwoDEval

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

    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

Examples of org.apache.poi.ss.formula.TwoDEval

      }
      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) {
View Full Code Here

Examples of org.apache.poi.ss.formula.TwoDEval

      // one of the other args was not an AreaRef
      return ErrorEval.VALUE_INVALID;
    }


    TwoDEval firstArg = args[0];

    int height = firstArg.getHeight();
    int width = firstArg.getWidth(); // TODO - junit

    // first check dimensions
    if (!areasAllSameSize(args, height, width)) {
      // normally this results in #VALUE!,
      // but errors in individual cells take precedence
View Full Code Here

Examples of org.apache.poi.ss.formula.TwoDEval

    }
  }

  private static boolean areasAllSameSize(TwoDEval[] args, int height, int width) {
    for (int i = 0; i < args.length; i++) {
      TwoDEval areaEval = args[i];
      // check that height and width match
      if(areaEval.getHeight() != height) {
        return false;
      }
      if(areaEval.getWidth() != width) {
        return false;
      }
    }
    return true;
  }
View Full Code Here

Examples of org.apache.poi.ss.formula.TwoDEval

    return new NumberEval(result);
  }

  private static void collectValues(ValueEval arg, List<Double> temp) throws EvaluationException {
    if (arg instanceof TwoDEval) {
      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

Examples of org.apache.poi.ss.formula.TwoDEval

                }
            }
            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

Examples of org.apache.poi.ss.formula.TwoDEval

     */
    for (int i=0, iSize=args.length; i<iSize; i++) {
            Boolean tempVe;
      ValueEval arg = args[i];
      if (arg instanceof TwoDEval) {
        TwoDEval ae = (TwoDEval) 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.getValue(rrIx, rcIx);
            tempVe = OperandResolver.coerceValueToBoolean(ve, true);
            if (tempVe != null) {
              result = partialEvaluate(result, tempVe.booleanValue());
              atleastOneNonBlank = true;
            }
View Full Code Here

Examples of org.apache.poi.ss.formula.TwoDEval

      ValueEval col_index, ValueEval range_lookup) {
    try {
      // Evaluation order:
      // lookup_value , table_array, range_lookup, find lookup value, col_index, fetch result
      ValueEval lookupValue = OperandResolver.getSingleValue(lookup_value, srcRowIndex, srcColumnIndex);
      TwoDEval tableArray = LookupUtils.resolveTableArrayArg(table_array);
      boolean isRangeLookup = LookupUtils.resolveRangeLookupArg(range_lookup, srcRowIndex, srcColumnIndex);
      int rowIndex = LookupUtils.lookupIndexOfValue(lookupValue, LookupUtils.createColumnVector(tableArray, 0), isRangeLookup);
      int colIndex = LookupUtils.resolveRowOrColIndexArg(col_index, srcRowIndex, srcColumnIndex);
      ValueVector resultCol = createResultColumnVector(tableArray, colIndex);
      return resultCol.getItem(rowIndex);
View Full Code Here

Examples of org.apache.poi.ss.formula.TwoDEval

     * Note: no short-circuit boolean loop exit because any ErrorEvals will override the result
     */
    for (int i=0, iSize=args.length; i<iSize; i++) {
      ValueEval arg = args[i];
      if (arg instanceof TwoDEval) {
        TwoDEval ae = (TwoDEval) 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.getValue(rrIx, rcIx);
            Boolean tempVe = OperandResolver.coerceValueToBoolean(ve, true);
            if (tempVe != null) {
              result = partialEvaluate(result, tempVe.booleanValue());
              atleastOneNonBlank = true;
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.