Examples of AbstractFunctionPtg


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

    token.setClass(transformClass(token.getPtgClass(), desiredOperandClass, callerForceArrayFlag));
  }

  private static boolean isSimpleValueFunction(Ptg token) {
    if (token instanceof AbstractFunctionPtg) {
      AbstractFunctionPtg aptg = (AbstractFunctionPtg) token;
      if (aptg.getDefaultOperandClass() != Ptg.CLASS_VALUE) {
        return false;
      }
      int numberOfOperands = aptg.getNumberOfOperands();
      for (int i=numberOfOperands-1; i>=0; i--) {
        if (aptg.getParameterClass(i) != Ptg.CLASS_VALUE) {
          return false;
        }
      }
      return true;
    }
View Full Code Here

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

        }
        boolean isVarArgs = !fm.hasFixedArgsLength();
        int funcIx = fm.getIndex();
        validateNumArgs(args.length, fm);

        AbstractFunctionPtg retval;
        if(isVarArgs) {
            retval = new FuncVarPtg(name, (byte)numArgs);
        } else {
            retval = new FuncPtg(funcIx);
        }
View Full Code Here

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

   
    // Check critical things in the Ptg array encoding.
    if(!(ptgF instanceof AbstractFunctionPtg)) {
        throw new RuntimeException("function token missing");
    }
    AbstractFunctionPtg func = (AbstractFunctionPtg) ptgF;
    if(func.getFunctionIndex() == 255) {
      throw new AssertionFailedError("Failed to recognise built-in function in formula '"
          + formula + "'");
    }
    assertEquals(expPtgArraySize, ptgs.length);
    assertEquals(funcIx, func.getFunctionIndex());
    Class expCls = isVarArgFunc ? FuncVarPtg.class : FuncPtg.class;
    assertEquals(expCls, ptgF.getClass());
   
    // check that parsed Ptg array converts back to formula text OK
    HSSFWorkbook book = new HSSFWorkbook();
View Full Code Here

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

    confirmFuncClass(ptgs, 14, "IRR", Ptg.CLASS_VALUE);
  }

  private void confirmFuncClass(Ptg[] ptgs, int i, String expectedFunctionName, byte operandClass) {
    confirmTokenClass(ptgs, i, operandClass);
    AbstractFunctionPtg afp = (AbstractFunctionPtg) ptgs[i];
    assertEquals(expectedFunctionName, afp.getName());
  }
View Full Code Here

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

    // the name gets encoded as the first arg
    NamePtg tname = (NamePtg) ptg[0];
    assertEquals("myFunc", tname.toFormulaString(book));

    AbstractFunctionPtg tfunc = (AbstractFunctionPtg) ptg[1];
    assertTrue(tfunc.isExternalFunction());
  }
View Full Code Here

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

    // the name gets encoded as the first arg
    NamePtg tname = (NamePtg) ptg[0];
    assertEquals("myFunc", tname.toFormulaString(book));

    AbstractFunctionPtg tfunc = (AbstractFunctionPtg) ptg[1];
    assertTrue(tfunc.isExternalFunction());
  }
View Full Code Here

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

    // the name gets encoded as the first arg
    NamePtg tname = (NamePtg) ptg[0];
    assertEquals("myFunc", tname.toFormulaString(book));

    AbstractFunctionPtg tfunc = (AbstractFunctionPtg) ptg[1];
    assertTrue(tfunc.isExternalFunction());
  }
View Full Code Here

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

    token.setClass(transformClass(token.getPtgClass(), desiredOperandClass, callerForceArrayFlag));
  }

  private static boolean isSimpleValueFunction(Ptg token) {
    if (token instanceof AbstractFunctionPtg) {
      AbstractFunctionPtg aptg = (AbstractFunctionPtg) token;
      if (aptg.getDefaultOperandClass() != Ptg.CLASS_VALUE) {
        return false;
      }
      int numberOfOperands = aptg.getNumberOfOperands();
      for (int i=numberOfOperands-1; i>=0; i--) {
        if (aptg.getParameterClass(i) != Ptg.CLASS_VALUE) {
          return false;
        }
      }
      return true;
    }
View Full Code Here

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

        }
        boolean isVarArgs = !fm.hasFixedArgsLength();
        int funcIx = fm.getIndex();
        validateNumArgs(args.length, fm);

        AbstractFunctionPtg retval;
        if(isVarArgs) {
            retval = new FuncVarPtg(name, (byte)numArgs);
        } else {
            retval = new FuncPtg(funcIx);
        }
View Full Code Here

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

        }
        boolean isVarArgs = !fm.hasFixedArgsLength();
        int funcIx = fm.getIndex();
        validateNumArgs(args.length, fm);

        AbstractFunctionPtg retval;
        if(isVarArgs) {
            retval = new FuncVarPtg(name, (byte)numArgs);
        } else {
            retval = new FuncPtg(funcIx);
        }
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.