jxl.biff.formula
Class TokenFormulaParser

java.lang.Object
  |
  +--jxl.biff.formula.TokenFormulaParser
All Implemented Interfaces:
Parser

class TokenFormulaParser
extends java.lang.Object
implements Parser

Parses the excel ptgs into a parse tree


Field Summary
private  NameTable nameTable
          A reference to the name table
private  int pos
          The current position within the array
private  Cell relativeTo
          The cell containing the formula.
private  ParseItem root
          The parse tree
private  WorkbookSettings settings
          The workbook settings
private  byte[] tokenData
          The Excel ptgs
private  java.util.Stack tokenStack
          The hash table of items that have been parsed
private  ExternalSheet workbook
          A reference to the workbook which holds the external sheet information
 
Constructor Summary
TokenFormulaParser(byte[] data, Cell c, ExternalSheet es, NameTable nt, WorkbookSettings ws)
          Constructor
 
Method Summary
private  void addOperator(Operator o)
          Adds the specified operator to the parse tree, taking operands off the stack as appropriate
 byte[] getBytes()
          Gets the bytes for the formula.
 java.lang.String getFormula()
          Gets the formula as a string
 void parse()
          Parses the list of tokens
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

tokenData

private byte[] tokenData
The Excel ptgs

relativeTo

private Cell relativeTo
The cell containing the formula. This is used in order to determine relative cell values

pos

private int pos
The current position within the array

root

private ParseItem root
The parse tree

tokenStack

private java.util.Stack tokenStack
The hash table of items that have been parsed

workbook

private ExternalSheet workbook
A reference to the workbook which holds the external sheet information

nameTable

private NameTable nameTable
A reference to the name table

settings

private WorkbookSettings settings
The workbook settings
Constructor Detail

TokenFormulaParser

public TokenFormulaParser(byte[] data,
                          Cell c,
                          ExternalSheet es,
                          NameTable nt,
                          WorkbookSettings ws)
Constructor
Method Detail

parse

public void parse()
           throws FormulaException
Parses the list of tokens
Specified by:
parse in interface Parser
Throws:
FormulaException -  

addOperator

private void addOperator(Operator o)
Adds the specified operator to the parse tree, taking operands off the stack as appropriate

getFormula

public java.lang.String getFormula()
Gets the formula as a string
Specified by:
getFormula in interface Parser
Following copied from interface: jxl.biff.formula.Parser
Returns:
the formula as a string

getBytes

public byte[] getBytes()
Gets the bytes for the formula. This takes into account any token mapping necessary because of shared formulas
Specified by:
getBytes in interface Parser
Returns:
the bytes in RPN