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

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


    }
   
   
    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


         * dealing with errorevals later.
         */
        outer:
        for (int i=0, iSize=operands.length; i<iSize; i++) {
            if (operands[i] instanceof AreaEval) {
                AreaEval ae = (AreaEval) operands[i];
                ValueEval[] values = ae.getValues();
                for (int j=0, jSize=values.length; j<jSize; j++) {
                    ValueEval tempVe = singleOperandEvaluate(values[j], srcRow, srcCol, true);
                    if (tempVe instanceof BoolEval) {
                        b = b || ((BoolEval) tempVe).getBooleanValue();
                        atleastOneNonBlank = true;
View Full Code Here

        case 1:
            if (operands[0] instanceof ErrorEval) {
                b = true;
            }
            else if (operands[0] instanceof AreaEval) {
                AreaEval ae = (AreaEval) operands[0];
                if (ae.contains(srcCellRow, srcCellCol)) { // circular ref!
                    retval = ErrorEval.CIRCULAR_REF_ERROR;
                }
                else if (ae.isRow()) {
                    if (ae.containsColumn(srcCellCol)) {
                        ValueEval ve = ae.getValueAt(ae.getFirstRow(), srcCellCol);
                        if (ve instanceof RefEval)
                            b = ((RefEval) ve).getInnerValueEval() instanceof ErrorEval;
                        else
                            b = (ve instanceof ErrorEval);
                    }
                    else {
                        b = true;
                    }
                }
                else if (ae.isColumn()) {
                    if (ae.containsRow(srcCellRow)) {
                        ValueEval ve = ae.getValueAt(srcCellRow, ae.getFirstColumn());
                        if (ve instanceof RefEval)
                            b = ((RefEval) ve).getInnerValueEval() instanceof ErrorEval;
                        else
                            b = (ve instanceof ErrorEval);
                    }
View Full Code Here

    }
     
        Eval[] xEvals;
    Eval[] yEvals;
    if (argX instanceof AreaEval) {
        AreaEval ae = (AreaEval) argX;
        xEvals = ae.getValues();
    } else {
        xEvals = new Eval[] { argX, };
    }
   
    if (argY instanceof AreaEval) {
        AreaEval ae = (AreaEval) argY;
        yEvals = ae.getValues();
    } else {
        yEvals = new Eval[] { argY, };
    }
   
    return getNumberArray(xEvals, yEvals);
View Full Code Here

        default:
            retval = ErrorEval.VALUE_INVALID;
            break;
        case 1:
            if (operands[0] instanceof AreaEval) {
                AreaEval ae = (AreaEval) operands[0];
                if (ae.isRow() && ae.containsColumn(srcCol)) {
                    ValueEval ve = ae.getValueAt(ae.getFirstRow(), srcCol);
                    tempVe = singleOperandEvaluate(ve);
                } else if (ae.isColumn() && ae.containsRow(srcRow)) {
                    ValueEval ve = ae.getValueAt(srcRow, ae.getFirstColumn());
                    tempVe = singleOperandEvaluate(ve);
                } else {
                    retval = ErrorEval.VALUE_INVALID;
                }           
            }
View Full Code Here

        // TODO - it doesn't seem to be possible to enter COUNTIF() into Excel with the wrong arg count
        // perhaps this should be an exception
        return ErrorEval.VALUE_INVALID;
    }
   
    AreaEval range = (AreaEval) args[0];
    Eval criteriaArg = args[1];
    if(criteriaArg instanceof RefEval) {
      // criteria is not a literal value, but a cell reference
      // for example COUNTIF(B2:D4, E1)
      RefEval re = (RefEval)criteriaArg;
View Full Code Here

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

         * dealing with errorevals later.
         */
        outer:
        for (int i=0, iSize=operands.length; i<iSize; i++) {
            if (operands[i] instanceof AreaEval) {
                AreaEval ae = (AreaEval) operands[i];
                ValueEval[] values = ae.getValues();
                for (int j=0, jSize=values.length; j<jSize; j++) {
                    ValueEval tempVe = singleOperandEvaluate(values[j], srcRow, srcCol, true);
                    if (tempVe instanceof BoolEval) {
                        b = b && ((BoolEval) tempVe).getBooleanValue();
                        atleastOneNonBlank = true;
View Full Code Here

    }
    try {
      // Evaluation order:
      // arg0 lookup_value, arg1 table_array, arg3 range_lookup, find lookup value, arg2 row_index, fetch result
      ValueEval lookupValue = OperandResolver.getSingleValue(args[0], srcCellRow, srcCellCol);
      AreaEval tableArray = LookupUtils.resolveTableArrayArg(args[1]);
      boolean isRangeLookup = LookupUtils.resolveRangeLookupArg(arg3, srcCellRow, srcCellCol);
      int colIndex = LookupUtils.lookupIndexOfValue(lookupValue, new RowVector(tableArray, 0), isRangeLookup);
      ValueEval veColIndex = OperandResolver.getSingleValue(args[2], srcCellRow, srcCellCol);
      int rowIndex = LookupUtils.resolveRowOrColIndexArg(veColIndex);
      ValueVector resultCol = createResultColumnVector(tableArray, rowIndex);
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

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.