Examples of AreaEval


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

   * Collects values from a single argument
   */
  private void collectValues(ValueEval 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

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

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

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

      }
      if(firstArg instanceof RefEval) {
        return evaluateSingleProduct(args);
      }
      if(firstArg instanceof AreaEval) {
        AreaEval ae = (AreaEval) firstArg;
        if(ae.isRow() && ae.isColumn()) {
          return evaluateSingleProduct(args);
        }
        return evaluateAreaSumProduct(args);
      }
    } catch (EvaluationException e) {
View Full Code Here

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

    if (eval == null) {
      throw new RuntimeException("parameter may not be null");
    }
    if (eval instanceof AreaEval) {
      AreaEval ae = (AreaEval) eval;
      // an area ref can work as a scalar value if it is 1x1
      if(!ae.isColumn() || !ae.isRow()) {
        throw new EvaluationException(ErrorEval.VALUE_INVALID);
      }
      eval = ae.getRelativeValue(0, 0);
    }

    return getProductTerm(eval, true);
  }
View Full Code Here

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

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


    AreaEval 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.hssf.record.formula.eval.AreaEval

    }
  }

  private static boolean areasAllSameSize(AreaEval[] args, int height, int width) {
    for (int i = 0; i < args.length; i++) {
      AreaEval 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.hssf.record.formula.eval.AreaEval

    return new NumberEval(result);
  }

  private static void collectValues(ValueEval arg, List<Double> temp) throws EvaluationException {
    if (arg instanceof AreaEval) {
      AreaEval ae = (AreaEval) 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.getRelativeValue(rrIx, rcIx);
          collectValue(ve1, temp, false);
        }
      }
      return;
    }
View Full Code Here

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

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

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

  public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1,
      ValueEval arg2) {
    try {
      ValueEval lookupValue = OperandResolver.getSingleValue(arg0, srcRowIndex, srcColumnIndex);
      AreaEval aeLookupVector = LookupUtils.resolveTableArrayArg(arg1);
      AreaEval aeResultVector = LookupUtils.resolveTableArrayArg(arg2);

      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

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

* @author Josh Micich
*/
public final class Index implements Function2Arg, Function3Arg, Function4Arg {

  public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) {
    AreaEval reference = convertFirstArg(arg0);

    boolean colArgWasPassed = false;
    int columnIx = 0;
    try {
      int rowIx = resolveIndexArg(arg1, srcRowIndex, srcColumnIndex);
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.