/** * Constructor used when parsing a function from a string * * @param f the function * @param a the number of arguments */ public VariableArgFunction(Function f,int a,WorkbookSettings ws) { function = f; arguments = a; readFromSheet = false; settings = ws; }
/** * Gets the name for the function * * @param f the function * @return the string */ public string getName(Function f) { if (!names.ContainsKey(f)) return null; return names[f]; }
/** * Constructor used when parsing a formula from a string * * @param f the function * @param ws the workbook settings */ public BuiltInFunction(Function f,WorkbookSettings ws) { function = f; settings = ws; }
/** * Reads the ptg data from the array starting at the specified position * * @param data the RPN array * @param pos the current position in the array, excluding the ptg identifier * @return the number of bytes read * @exception FormulaException */ public int read(byte[] data,int pos) { arguments = data[pos]; int index = IntegerHelper.getInt(data[pos + 1],data[pos + 2]); function = Function.getFunction(index); if (function == Function.UNKNOWN) { throw new FormulaException(FormulaException.UNRECOGNIZED_FUNCTION, index); } return 3; }
/** * Reads the ptg data from the array starting at the specified position * * @param data the RPN array * @param pos the current position in the array, excluding the ptg identifier * @return the number of bytes read */ public int read(byte[] data,int pos) { int index = IntegerHelper.getInt(data[pos],data[pos + 1]); function = Function.getFunction(index); Assert.verify(function != Function.UNKNOWN,"function code " + index); return 2; }