| java.lang.Object org.apache.poi.hssf.model.FormulaParser
FormulaParser | public class FormulaParser (Code) | | This class parses a formula string into a List of tokens in RPN order.
Inspired by
Lets Build a Compiler, by Jack Crenshaw
BNF for the formula expression is :
::= [ ]*
::= [ ]*
::= | () | |
::= ([expression [, expression]*])
author: Avik Sengupta author: Andrew C. oliver (acoliver at apache dot org) author: Eric Ladner (eladner at goldinc dot com) author: Cameron Riley (criley at ekmail.com) author: Peter M. Murray (pete at quantrix dot com) author: Pavel Krupets (pkrupets at palmtreebusiness dot com) |
Constructor Summary | |
public | FormulaParser(String formula, Workbook book) Create the formula parser, with the string that is to be
parsed against the supplied workbook. |
FORMULA_TYPE_ARRAY | public static int FORMULA_TYPE_ARRAY(Code) | | |
FORMULA_TYPE_CELL | public static int FORMULA_TYPE_CELL(Code) | | |
FORMULA_TYPE_CONDFOMRAT | public static int FORMULA_TYPE_CONDFOMRAT(Code) | | |
FORMULA_TYPE_NAMEDRANGE | public static int FORMULA_TYPE_NAMEDRANGE(Code) | | |
FORMULA_TYPE_SHARED | public static int FORMULA_TYPE_SHARED(Code) | | |
FormulaParser | public FormulaParser(String formula, Workbook book)(Code) | | Create the formula parser, with the string that is to be
parsed against the supplied workbook.
A later call the parse() method to return ptg list in
rpn order, then call the getRPNPtg() to retrive the
parse results.
This class is recommended only for single threaded use.
If you only have a usermodel.HSSFWorkbook, and not a
model.Workbook, then use the convenience method on
usermodel.HSSFFormulaEvaluator
|
getRPNPtg | public Ptg[] getRPNPtg()(Code) | | API call to retrive the array of Ptgs created as
a result of the parsing
|
getRPNPtg | public Ptg[] getRPNPtg(int formulaType)(Code) | | |
parse | public void parse()(Code) | | API call to execute the parsing of the formula
|
toFormulaString | public static String toFormulaString(Workbook book, List lptgs)(Code) | | Convience method which takes in a list then passes it to the
other toFormulaString signature.
Parameters: book - workbook for 3D and named references Parameters: lptgs - list of Ptg, can be null or empty a human readable String |
toFormulaString | public String toFormulaString(List lptgs)(Code) | | Convience method which takes in a list then passes it to the
other toFormulaString signature. Works on the current
workbook for 3D and named references
Parameters: lptgs - list of Ptg, can be null or empty a human readable String |
toFormulaString | public static String toFormulaString(Workbook book, Ptg[] ptgs)(Code) | | Static method to convert an array of Ptgs in RPN order
to a human readable string format in infix mode.
Parameters: book - workbook for named and 3D references Parameters: ptgs - array of Ptg, can be null or empty a human readable String |
toFormulaString | public String toFormulaString(Ptg[] ptgs)(Code) | | Static method to convert an array of Ptgs in RPN order
to a human readable string format in infix mode. Works
on the current workbook for named and 3D references.
Parameters: ptgs - array of Ptg, can be null or empty a human readable String |
toString | public String toString()(Code) | | toString on the parser instance returns the RPN ordered list of tokens
Useful for testing
|
|
|