Examples of Area2DEval


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

                    for (short y = col0; row != null && y < col1 + 1; y++) {
                        values[(x - row0) * (col1 - col0 + 1) + (y - col0)] =
                            getEvalForCell(row.getCell(y), row, sheet, workbook);
                    }
                }
                AreaEval ae = new Area2DEval(ap, values);
                stack.push(ae);
            }
            else if (ptgs[i] instanceof Area3DPtg) {
                Area3DPtg a3dp = (Area3DPtg) ptgs[i];
                short row0 = a3dp.getFirstRow();
                short col0 = a3dp.getFirstColumn();
                short row1 = a3dp.getLastRow();
                short col1 = a3dp.getLastColumn();
                HSSFSheet xsheet = workbook.getSheetAt(a3dp.getExternSheetIndex());
                ValueEval[] values = new ValueEval[(row1 - row0 + 1) * (col1 - col0 + 1)];
                for (short x = row0; sheet != null && x < row1 + 1; x++) {
                    HSSFRow row = sheet.getRow(x);
                    for (short y = col0; row != null && y < col1 + 1; y++) {
                        values[(x - row0) * (col1 - col0 + 1) + (y - col0)] =
                            getEvalForCell(row.getCell(y), row, xsheet, workbook);
                    }
                }
                AreaEval ae = new Area3DEval(a3dp, values);
                stack.push(ae);
            }
            else {
                Eval ptgEval = getEvalForPtg(ptgs[i]);
                stack.push(ptgEval);
            }
        }
        ValueEval value = ((ValueEval) stack.pop());
        if (value instanceof RefEval) {
            RefEval rv = (RefEval) value;
            value = rv.getInnerValueEval();
        }
        else if (value instanceof AreaEval) {
            AreaEval ae = (AreaEval) value;
            if (ae.isRow())
                value = ae.getValueAt(ae.getFirstRow(), srcColNum);
            else if (ae.isColumn())
                value = ae.getValueAt(srcRowNum, ae.getFirstColumn());
            else
                value = ErrorEval.VALUE_INVALID;
        }
        return value;
    }
View Full Code Here

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

        // TODO: Handle whole column ranges properly
        if(row1 == -1 && row0 >= 0) {
            row1 = (short)sheet.getLastRowNum();
        }
        ValueEval[] values = evalArea(workbook, sheet, row0, col0, row1, col1);
        return new Area2DEval(ap, values);
    }
View Full Code Here

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

        // TODO: Handle whole column ranges properly
        if(row1 == -1 && row0 >= 0) {
            row1 = (short)sheet.getLastRowNum();
        }
        ValueEval[] values = evalArea(workbook, sheet, row0, col0, row1, col1);
        return new Area2DEval(ap, values);
    }
View Full Code Here

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

      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]);
    }
    Area2DEval arg0 = new Area2DEval(new AreaPtg(areaRefString), values);
   
    Eval[] args;
    if (colNum > 0) {
      args = new Eval[] { arg0, new NumberEval(rowNum), new NumberEval(colNum), };
    } else {
View Full Code Here

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

        new NumberEval(21),
        new NumberEval(25),
        new NumberEval(25),
        new NumberEval(25),
    };
    Area2DEval arg0 = new Area2DEval(new AreaPtg("C1:C6"), values);
   
    Ref2DEval criteriaArg = new Ref2DEval(new ReferencePtg("A1"), new NumberEval(25));
    Eval[] args=  { arg0, criteriaArg, };
   
    double actual = NumericFunctionInvoker.invoke(new Countif(), args);
View Full Code Here

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

    assertEquals(4, actual, 0D);
  }
 

  private static AreaEval createAreaEval(String areaRefStr, ValueEval[] values) {
    return new Area2DEval(new AreaPtg(areaRefStr), values);
  }
View Full Code Here

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

   
    // text (first) arg type is number, other args are strings with fractional digits
    confirmMid(new NumberEval(123456), new StringEval("3.1"), new StringEval("2.9"), "34");
   
    // startPos is 1x1 area ref, numChars is cell ref
    AreaEval aeStart = new Area2DEval(new AreaPtg("A1:A1"), new ValueEval[] { new NumberEval(2), } );
    RefEval reNumChars = new Ref2DEval(new ReferencePtg("B1"), new NumberEval(3));
    confirmMid(new StringEval("galactic"), aeStart, reNumChars, "ala");

    confirmMid(new StringEval("galactic"), new NumberEval(3.1), BlankEval.INSTANCE, "");
View Full Code Here

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

    ValueEval[] values = new ValueEval[nValues];
    for (int i = 0; i < nValues; i++) {
      values[i] = ZERO;
    }
   
    return new Area2DEval(new AreaPtg(areaRefStr), values);
  }
View Full Code Here

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

    return result;
  }

  private static ValueEval createAreaEval(ValueEval[] values) {
    String refStr = "A1:A" + values.length;
    return new Area2DEval(new AreaPtg(refStr), values);
  }
View Full Code Here

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

  /**
   * Convenience method
   * @return <code>new Area2DEval(new AreaPtg(ref), values)</code>
   */
  private static AreaEval createAreaEval(String ref, ValueEval[] values) {
    return new Area2DEval(new AreaPtg(ref), values);
  }
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.