Save This Page
Home » poi-src-3.1-FINAL-20080629 » org.apache » poi » hssf » record » formula » [javadoc | source]
org.apache.poi.hssf.record.formula
abstract public class: Ptg [javadoc | source]
java.lang.Object
   org.apache.poi.hssf.record.formula.Ptg

All Implemented Interfaces:
    Cloneable

Direct Known Subclasses:
    ScalarConstantPtg, Area3DPtg, AreaNPtg, ErrPtg, PercentPtg, LessEqualPtg, GreaterEqualPtg, AreaErrPtg, ArrayPtg, MissingArgPtg, DeletedRef3DPtg, IntPtg, MultiplyPtg, RefPtgBase, PowerPtg, UnionPtg, Ref3DPtg, LessThanPtg, EqualPtg, NamePtg, NameXPtg, ConcatPtg, MemErrPtg, UnknownPtg, OperandPtg, FuncVarPtg, StringPtg, ValueOperatorPtg, AreaPtg, AreaPtgBase, DeletedArea3DPtg, AddPtg, RefNPtg, MemFuncPtg, FuncPtg, ControlPtg, RangePtg, ExpPtg, MemAreaPtg, ParenthesisPtg, AttrPtg, OperationPtg, NumberPtg, IntersectionPtg, GreaterThanPtg, SubtractPtg, RefErrorPtg, BoolPtg, NotEqualPtg, UnaryMinusPtg, UnaryPlusPtg, DividePtg, RefPtg, ReferencePtg, AbstractFunctionPtg

Ptg represents a syntactic token in a formula. 'PTG' is an acronym for 'parse thing'. Originally, the name referred to the single byte identifier at the start of the token, but in POI, Ptg encapsulates the whole formula token (initial byte + value data).

Ptgs are logically arranged in a tree representing the structure of the parsed formula. However, in BIFF files Ptgs are written/read in Reverse-Polish Notation order. The RPN ordering also simplifies formula evaluation logic, so POI mostly accesses Ptgs in the same way.

Field Summary
public static final  byte CLASS_REF     
public static final  byte CLASS_VALUE     
public static final  byte CLASS_ARRAY     
Method from org.apache.poi.hssf.record.formula.Ptg Summary:
clone,   copy,   createParsedExpressionTokens,   createPtg,   getBytes,   getDefaultOperandClass,   getEncodedSize,   getEncodedSize,   getPtgClass,   getSize,   isBaseToken,   readTokens,   serializePtgStack,   serializePtgs,   setClass,   toDebugString,   toFormulaString,   toString,   writeBytes
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.poi.hssf.record.formula.Ptg Detail:
 protected Object clone() 
 public final Ptg copy() 
 public static Stack createParsedExpressionTokens(short size,
    RecordInputStream in) 
Deprecated! - - use readTokens()

 public static Ptg createPtg(RecordInputStream in) 
 public final byte[] getBytes() 
 abstract public byte getDefaultOperandClass()
 public static int getEncodedSize(Stack ptgs) 
 public static int getEncodedSize(Ptg[] ptgs) 
 public final byte getPtgClass() 
 abstract public int getSize()
 abstract public boolean isBaseToken()
 public static Ptg[] readTokens(int size,
    RecordInputStream in) 
    Reads size bytes of the input stream, to create an array of Ptgs. Extra data (beyond size) may be read if and ArrayPtgs are present.
 public static int serializePtgStack(Stack expression,
    byte[] array,
    int offset) 
Deprecated! use - serializePtgs()

 public static int serializePtgs(Ptg[] ptgs,
    byte[] data,
    int offset) 
    Writes the ptgs to the data buffer, starting at the specified offset.
    The 2 byte encode length field is not written by this method.
 public final  void setClass(byte thePtgClass) 
 public final String toDebugString() 
    dump a debug representation (hexdump) to a string
 abstract public String toFormulaString(HSSFWorkbook book)
    return a string representation of this token alone
 public String toString() 
    Overridden toString method to ensure object hash is not printed. This helps get rid of gratuitous diffs when comparing two dumps Subclasses may output more relevant information by overriding this method
 abstract public  void writeBytes(byte[] array,
    int offset)
    write this Ptg to a byte array