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

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


      new NumberEval(10)
      new NumberEval(10)
      new NumberEval(25)
    };
   
    AreaEval ae = createAreaEval("A1:A5", values);

    AreaEval matchAE = createAreaEval("C1:C1", new ValueEval[] { MATCH_LARGEST_LTE, });
   
    try {
      confirmInt(4, invokeMatch(new NumberEval(10), ae, matchAE));
    } catch (RuntimeException e) {
      if(e.getMessage().startsWith("Unexpected match_type type")) {
View Full Code Here


    }
    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

        switch (evals.length) {
        default:
            retval = ErrorEval.VALUE_INVALID;
        case 1:
            if (evals[0] instanceof AreaEval) {
                AreaEval ae = (AreaEval) evals[0];
                rnum = ae.getFirstRow();
            }
            else if (evals[0] instanceof RefEval) {
                RefEval re = (RefEval) evals[0];
                rnum = re.getRow();
            }
View Full Code Here

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

   
    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 EvalEx(ErrorEval.VALUE_INVALID);
      }
      eval = ae.getValues()[0];
    }

    if (!(eval instanceof ValueEval)) {
      throw new RuntimeException("Unexpected value eval class ("
          + eval.getClass().getName() + ")");
View Full Code Here

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

   
    AreaEval firstArg = args[0];
   
    int height = firstArg.getLastRow() - firstArg.getFirstRow() + 1;
    int width = firstArg.getLastColumn() - firstArg.getFirstColumn() + 1; // TODO - junit
   
   

    double[][][] elements = new double[maxN][][];
   
View Full Code Here

    }
    Eval firstArg = args[0];
   
    int result;
        if (firstArg instanceof AreaEval) {
            AreaEval ae = (AreaEval) firstArg;
            result = ae.getLastColumn() - ae.getFirstColumn() + 1;
        } else if (firstArg instanceof RefEval) {
            result = 1;
        } else { // anything else is not valid argument
            return ErrorEval.VALUE_INVALID;
        }
View Full Code Here

    protected static final String EMPTY_STRING = "";
   
    protected ValueEval singleOperandEvaluate(Eval eval, int srcRow, short srcCol) {
        ValueEval retval;
        if (eval instanceof AreaEval) {
            AreaEval ae = (AreaEval) eval;
            if (ae.contains(srcRow, srcCol)) { // circular ref!
                retval = ErrorEval.CIRCULAR_REF_ERROR;
            }
            else if (ae.isRow()) {
                if (ae.containsColumn(srcCol)) {
                    ValueEval ve = ae.getValueAt(ae.getFirstRow(), srcCol);
                    retval = attemptXlateToText(ve);
                }
                else {
                    retval = ErrorEval.VALUE_INVALID;
                }
            }
            else if (ae.isColumn()) {
                if (ae.containsRow(srcRow)) {
                    ValueEval ve = ae.getValueAt(srcRow, ae.getFirstColumn());
                    retval = attemptXlateToText(ve);
                }
                else {
                    retval = ErrorEval.VALUE_INVALID;
                }
View Full Code Here

  public Eval evaluate(Eval[] args, int srcRowIndex, short srcColumnIndex) {
    if (args.length < 2) {
      return ErrorEval.VALUE_INVALID;
    }
   
    AreaEval aeRange;
    AreaEval aeSum;
    try {
      aeRange = convertRangeArg(args[0]);
     
      switch (args.length) {
        case 2:
View Full Code Here

      // 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;
    int areaIx = 0;
    try
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.