Examples of AreaPtg


Examples of org.apache.poi.hssf.record.formula.AreaPtg

      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.AreaPtg

        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.AreaPtg

    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.ss.formula.ptg.AreaPtg

    if (ptg instanceof RefPtg) {
      RefPtg rptg = (RefPtg) ptg;
      return ec.getRefEval(rptg.getRow(), rptg.getColumn());
    }
    if (ptg instanceof AreaPtg) {
      AreaPtg aptg = (AreaPtg) ptg;
      return ec.getAreaEval(aptg.getFirstRow(), aptg.getFirstColumn(), aptg.getLastRow(), aptg.getLastColumn());
    }

    if (ptg instanceof UnknownPtg) {
      // POI uses UnknownPtg when the encoded Ptg array seems to be corrupted.
      // This seems to occur in very rare cases (e.g. unused name formulas in bug 44774, attachment 21790)
View Full Code Here

Examples of org.apache.poi.ss.formula.ptg.AreaPtg

    if (ptg instanceof RefPtg) {
      RefPtg rptg = (RefPtg) ptg;
      return ec.getRefEval(rptg.getRow(), rptg.getColumn());
    }
    if (ptg instanceof AreaPtg) {
      AreaPtg aptg = (AreaPtg) ptg;
      return ec.getAreaEval(aptg.getFirstRow(), aptg.getFirstColumn(), aptg.getLastRow(), aptg.getLastColumn());
    }

    if (ptg instanceof UnknownPtg) {
      // POI uses UnknownPtg when the encoded Ptg array seems to be corrupted.
      // This seems to occur in very rare cases (e.g. unused name formulas in bug 44774, attachment 21790)
View Full Code Here

Examples of org.apache.poi.ss.formula.ptg.AreaPtg

   * moved
   */
  public void testShiftAreasSourceRows() {

    // all these operations are on an area ref spanning rows 10 to 20
    AreaPtg aptg  = createAreaPtg(10, 20);

    confirmAreaShift(aptg,  9, 21, 20, 30, 40);
    confirmAreaShift(aptg, 10, 21, 20, 30, 40);
    confirmAreaShift(aptg,  9, 20, 20, 30, 40);

View Full Code Here

Examples of org.apache.poi.ss.formula.ptg.AreaPtg

   * Tests what happens to an area ref when some outside rows are moved to overlap
   * that area ref
   */
  public void testShiftAreasDestRows() {
    // all these operations are on an area ref spanning rows 20 to 25
    AreaPtg aptg  = createAreaPtg(20, 25);

    // no change because no overlap:
    confirmAreaShift(aptg,  5, 109, 20, 25);
    confirmAreaShift(aptg,  5, 10, 21, 20, 25);

View Full Code Here

Examples of org.apache.poi.ss.formula.ptg.AreaPtg

      int expectedAreaFirstRow, int expectedAreaLastRow) {

    FormulaShifter fs = FormulaShifter.createForRowShift(0, "", firstRowMoved, lastRowMoved, numberRowsMoved);
    boolean expectedChanged = aptg.getFirstRow() != expectedAreaFirstRow || aptg.getLastRow() != expectedAreaLastRow;

    AreaPtg copyPtg = (AreaPtg) aptg.copy(); // clone so we can re-use aptg in calling method
    Ptg[] ptgs = { copyPtg, };
    boolean actualChanged = fs.adjustFormula(ptgs, 0);
    if (expectedAreaFirstRow < 0) {
      assertEquals(AreaErrPtg.class, ptgs[0].getClass());
      return;
    }
    assertEquals(expectedChanged, actualChanged);
    assertEquals(copyPtg, ptgs[0])// expected to change in place (although this is not a strict requirement)
    assertEquals(expectedAreaFirstRow, copyPtg.getFirstRow());
    assertEquals(expectedAreaLastRow, copyPtg.getLastRow());

  }
View Full Code Here

Examples of org.apache.poi.ss.formula.ptg.AreaPtg

    assertEquals(expectedAreaFirstRow, copyPtg.getFirstRow());
    assertEquals(expectedAreaLastRow, copyPtg.getLastRow());

  }
  private static AreaPtg createAreaPtg(int initialAreaFirstRow, int initialAreaLastRow) {
    return new AreaPtg(initialAreaFirstRow, initialAreaLastRow, 2, 5, false, false, false, false);
  }
View Full Code Here

Examples of org.apache.poi.ss.formula.ptg.AreaPtg

      }
    } else {
      AreaReference areaRef = createAreaRef(part1, part2);

      if (sheetIden == null) {
        ptg = new AreaPtg(areaRef);
      } else {
        ptg = _book.get3DReferencePtg(areaRef, sheetIden);
      }
    }
    return new ParseNode(ptg);
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.