Parses the formula passed in (either as parsed strings or as a string)
into a tree of operators and operands
| Constructor: |
public FormulaParser(String form,
ExternalSheet es,
WorkbookMethods nt,
WorkbookSettings ws) {
parser = new StringFormulaParser(form, es, nt, ws);
}
Constructor which creates the parse tree out of the string Parameters:
form - the formula string
es - the external sheet handle
nt - the name table
ws - the workbook settings
|
public FormulaParser(byte[] tokens,
Cell rt,
ExternalSheet es,
WorkbookMethods nt,
WorkbookSettings ws) throws FormulaException {
// A null workbook bof means that it is a writable workbook and therefore
// must be biff8
if (es.getWorkbookBof() != null &&
!es.getWorkbookBof().isBiff8())
{
throw new FormulaException(FormulaException.BIFF8_SUPPORTED);
}
Assert.verify(nt != null);
parser = new TokenFormulaParser(tokens, rt, es, nt, ws);
}
Constructor which creates the parse tree out of tokens Parameters:
tokens - the list of parsed tokens
rt - the cell containing the formula
es - a handle to the external sheet
nt - a handle to the name table
ws - the workbook settings
Throws:
FormulaException -
- exception:
FormulaException -
|
| Method from jxl.biff.formula.FormulaParser Detail: |
public void adjustRelativeCellReferences(int colAdjust,
int rowAdjust) {
parser.adjustRelativeCellReferences(colAdjust, rowAdjust);
}
Adjusts all the relative cell references in this formula by the
amount specified. Used when copying formulas |
public void columnInserted(int sheetIndex,
int col,
boolean currentSheet) {
parser.columnInserted(sheetIndex, col, currentSheet);
}
Called when a column is inserted on the specified sheet. Tells
the formula parser to update all of its cell references beyond this
column |
public void columnRemoved(int sheetIndex,
int col,
boolean currentSheet) {
parser.columnRemoved(sheetIndex, col, currentSheet);
}
Called when a column is inserted on the specified sheet. Tells
the formula parser to update all of its cell references beyond this
column |
public byte[] getBytes() {
return parser.getBytes();
}
Gets the bytes for the formula. This takes into account any
token mapping necessary because of shared formulas |
public String getFormula() throws FormulaException {
return parser.getFormula();
}
Gets the formula as a string |
public boolean handleImportedCellReferences() {
return parser.handleImportedCellReferences();
}
If this formula was on an imported sheet, check that
cell references to another sheet are warned appropriately |
public void parse() throws FormulaException {
parser.parse();
}
Parses the formula into a parse tree |
public void rowInserted(int sheetIndex,
int row,
boolean currentSheet) {
parser.rowInserted(sheetIndex, row, currentSheet);
}
Called when a column is inserted on the specified sheet. Tells
the formula parser to update all of its cell references beyond this
column |
public void rowRemoved(int sheetIndex,
int row,
boolean currentSheet) {
parser.rowRemoved(sheetIndex, row, currentSheet);
}
Called when a column is inserted on the specified sheet. Tells
the formula parser to update all of its cell references beyond this
column |