Examples of FuncVarPtg


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

    assertEquals(AttrPtg.class,    ptgs[5].getClass());
    assertEquals(RefPtg.class, ptgs[6].getClass());
    assertEquals(AttrPtg.class,    ptgs[7].getClass());
    assertEquals(FuncVarPtg.class,   ptgs[8].getClass());

    FuncVarPtg choose = (FuncVarPtg)ptgs[8];
    assertEquals("CHOOSE", choose.getName());
  }
View Full Code Here

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

    AttrPtg ptgGoto2 = (AttrPtg) asts[7];   
    assertEquals("Goto 2 Length", (short)3, ptgGoto2.getData());
   
    assertEquals("If FALSE offset", (short)7, ifPtg.getData());
   
    FuncVarPtg funcPtg = (FuncVarPtg)asts[8];
   
   
  }
View Full Code Here

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

    assertTrue("Single Value is not an IntPtg", (asts[4] instanceof IntPtg));
    IntPtg intPtg = (IntPtg)asts[4];
    assertEquals("Result", (short)10, intPtg.getValue());
   
    assertTrue("Ptg is not a Variable Function", (asts[6] instanceof FuncVarPtg));
    FuncVarPtg funcPtg = (FuncVarPtg)asts[6];
    assertEquals("Arguments", 2, funcPtg.getNumberOfOperands());
   
   
  }
View Full Code Here

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

    AttrPtg ptgGoto2 = (AttrPtg) asts[7];   
    assertEquals("Goto 2 Length", (short)3, ptgGoto2.getData());
   
    assertEquals("If FALSE offset", (short)7, ifPtg.getData());
   
    FuncVarPtg funcPtg = (FuncVarPtg)asts[8];
   
   
  }
View Full Code Here

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

    assertTrue("Single Value is not an IntPtg", (asts[4] instanceof IntPtg));
    IntPtg intPtg = (IntPtg)asts[4];
    assertEquals("Result", (short)10, intPtg.getValue());
   
    assertTrue("Ptg is not a Variable Function", (asts[6] instanceof FuncVarPtg));
    FuncVarPtg funcPtg = (FuncVarPtg)asts[6];
    assertEquals("Arguments", 2, funcPtg.getNumberOfOperands());
   
   
  }
View Full Code Here

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

        EvaluationCell cell = getSheet().getCell(rowIndex, columnIndex);
        if(cell != null && cell.getCellType() == Cell.CELL_TYPE_FORMULA){
            EvaluationWorkbook wb = _bookEvaluator.getWorkbook();
            for(Ptg ptg : wb.getFormulaTokens(cell)){
                if(ptg instanceof FuncVarPtg){
                    FuncVarPtg f = (FuncVarPtg)ptg;
                    if("SUBTOTAL".equals(f.getName())) {
                        subtotal = true;
                        break;
                    }
                }
            }
View Full Code Here

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

        EvaluationCell cell = getSheet().getCell(rowIndex, columnIndex);
        if(cell != null && cell.getCellType() == Cell.CELL_TYPE_FORMULA){
            EvaluationWorkbook wb = _bookEvaluator.getWorkbook();
            for(Ptg ptg : wb.getFormulaTokens(cell)){
                if(ptg instanceof FuncVarPtg){
                    FuncVarPtg f = (FuncVarPtg)ptg;
                    if("SUBTOTAL".equals(f.getName())) {
                        subtotal = true;
                        break;
                    }
                }
            }
View Full Code Here

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

    temp.add(_token);
  }

  private static boolean isIf(Ptg token) {
    if (token instanceof FuncVarPtg) {
      FuncVarPtg func = (FuncVarPtg) token;
      if (FunctionMetadataRegistry.FUNCTION_NAME_IF.equals(func.getName())) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

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

    assertEquals(AttrPtg.class,    ptgs[5].getClass());
    assertEquals(RefPtg.class, ptgs[6].getClass());
    assertEquals(AttrPtg.class,    ptgs[7].getClass());
    assertEquals(FuncVarPtg.class,   ptgs[8].getClass());

    FuncVarPtg choose = (FuncVarPtg)ptgs[8];
    assertEquals("CHOOSE", choose.getName());
  }
View Full Code Here

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

 
  public void testComplexIRR_bug45041() {
    String formula = "(1+IRR(SUMIF(A:A,ROW(INDIRECT(MIN(A:A)&\":\"&MAX(A:A))),B:B),0))^365-1";
    Ptg[] ptgs = parseFormula(formula);

    FuncVarPtg rowFunc = (FuncVarPtg) ptgs[10];
    FuncVarPtg sumifFunc = (FuncVarPtg) ptgs[12];
    assertEquals("ROW", rowFunc.getName());
    assertEquals("SUMIF", sumifFunc.getName());

    if (rowFunc.getPtgClass() == Ptg.CLASS_VALUE || sumifFunc.getPtgClass() == Ptg.CLASS_VALUE) {
      throw new AssertionFailedError("Identified bug 45041");
    }
    confirmTokenClass(ptgs, 1, Ptg.CLASS_REF);
    confirmTokenClass(ptgs, 2, Ptg.CLASS_REF);
    confirmFuncClass(ptgs, 3, "MIN", Ptg.CLASS_VALUE);
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.