public abstract class Ptg extends java.lang.Object implements Duplicatable, GenericRecord
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.
(Ptg 表示公式中的句法标记。 “PTG”是“解析事物”的首字母缩写词。原本名称指的是token开头的单字节标识符,但在POI中,Ptg封装了整个公式token(初始字节+值数据)。 Ptg 逻辑排列在树中,表示解析公式的结构。但是,在 BIFF 文件中,Ptgs 以反向波兰表示法顺序写入/读取。 RPN 排序也简化了公式求值逻辑,因此 POI 大多以相同的方式访问 Ptgs。)Modifier and Type | Field and Description |
---|---|
static byte |
CLASS_ARRAY |
static byte |
CLASS_REF |
static byte |
CLASS_VALUE |
static Ptg[] |
EMPTY_PTG_ARRAY |
Modifier | Constructor and Description |
---|---|
protected |
Ptg() |
protected |
Ptg(Ptg other) |
Modifier and Type | Method and Description |
---|---|
abstract Ptg |
copy() |
static Ptg |
createPtg(LittleEndianInput in) |
static boolean |
doesFormulaReferToDeletedCell(Ptg[] ptgs) |
abstract byte |
getDefaultOperandClass() |
static int |
getEncodedSize(Ptg[] ptgs)
This method will return the same result as
getEncodedSizeWithoutArrayData(Ptg[]) if there are no array tokens present.
(如果不存在数组标记,此方法将返回与 getEncodedSizeWithoutArrayData(Ptg[]) 相同的结果。)
|
static int |
getEncodedSizeWithoutArrayData(Ptg[] ptgs)
Used to calculate value that should be encoded at the start of the encoded Ptg token array;
(用于计算应该在编码的 Ptg 令牌数组开始处编码的值;)
|
byte |
getPtgClass() |
char |
getRVAType()
Debug / diagnostic method to get this token's 'operand class' type.
(获取此令牌的“操作数类”类型的调试/诊断方法。)
|
abstract byte |
getSid() |
abstract int |
getSize() |
abstract boolean |
isBaseToken() |
static Ptg[] |
readTokens(int size, LittleEndianInput in)
Reads
size bytes of the input stream, to create an array of
Ptgs.
(读取输入流的 size 个字节,以创建 Ptgs 数组。)
|
static int |
serializePtgs(Ptg[] ptgs, byte[] array, int offset)
Writes the ptgs to the data buffer, starting at the specified offset.
(将 ptgs 写入数据缓冲区,从指定的偏移量开始。)
|
void |
setClass(byte thePtgClass) |
abstract java.lang.String |
toFormulaString()
return a string representation of this token alone
(单独返回此标记的字符串表示)
|
java.lang.String |
toString() |
abstract void |
write(LittleEndianOutput out) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getGenericChildren, getGenericProperties, getGenericRecordType
public static final Ptg[] EMPTY_PTG_ARRAY
public static final byte CLASS_REF
public static final byte CLASS_VALUE
public static final byte CLASS_ARRAY
protected Ptg()
protected Ptg(Ptg other)
public static Ptg[] readTokens(int size, LittleEndianInput in)
public static Ptg createPtg(LittleEndianInput in)
public static int getEncodedSize(Ptg[] ptgs)
getEncodedSizeWithoutArrayData(Ptg[])
if there are no array tokens present.
(如果不存在数组标记,此方法将返回与 getEncodedSizeWithoutArrayData(Ptg[]) 相同的结果。)
public static int getEncodedSizeWithoutArrayData(Ptg[] ptgs)
public static int serializePtgs(Ptg[] ptgs, byte[] array, int offset)
public abstract int getSize()
public abstract void write(LittleEndianOutput out)
public abstract java.lang.String toFormulaString()
public final java.lang.String toString()
toString
in class
java.lang.Object
public final void setClass(byte thePtgClass)
public final byte getPtgClass()
public final char getRVAType()
public abstract byte getDefaultOperandClass()
public abstract boolean isBaseToken()
false
if this token is classified as 'reference', 'value', or 'array'
(如果此标记被分类为“参考”、“值”或“数组”,则为 false)
public static boolean doesFormulaReferToDeletedCell(Ptg[] ptgs)
public abstract Ptg copy()
copy
in interface
Duplicatable
(复制到界面 Duplicatable)
public abstract byte getSid()
-1
if the record has no sid
(已解析事物的结构 id,如果记录没有 sid,则为 -1)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.