Top Description Fields Constructors Methods
org.apache.poi.ss.formula.ptg

public final Class ArrayPtg

extends Ptg
Class Inheritance
Imports
java.util.Map, java.util.function.Supplier, org.apache.poi.ss.formula.constant.ConstantValueParser, .ErrorConstant, org.apache.poi.ss.util.NumberToTextConverter, org.apache.poi.util.GenericRecordUtil, .LittleEndianOutput

ArrayPtg - handles arrays The ArrayPtg is a little weird, the size of the Ptg when parsing initially only includes the Ptg sid and the reserved bytes. The next Ptg in the expression then follows. It is only after the "size" of all the Ptgs is met, that the ArrayPtg data is actually held after this. So Ptg.createParsedExpression keeps track of the number of ArrayPtg elements and need to parse the data upto the FORMULA record size.

Field Summary

Modifier and TypeField and Description
private final Object[]
private final int
private final int
private final int
private final int
private final int
public static final int
PLAIN_TOKEN_SIZE

The size of the plain tArray token written within the standard formula tokens (not including the data which comes after all formula tokens)

private static final int
public static final byte
Inherited from org.apache.poi.ss.formula.ptg.Ptg:
CLASS_ARRAYCLASS_REFCLASS_VALUEEMPTY_PTG_ARRAY

Constructor Summary

AccessConstructor and Description
pack-priv
ArrayPtg(int reserved0, int reserved1, int reserved2, int nColumns, int nRows, Object[] arrayValues)

public
public
ArrayPtg(Object[][]
array values arranged in rows
values2d
)

Method Summary

Modifier and TypeMethod and Description
public ArrayPtg
public int
private static String
public byte
public Map<String, Supplier<?>>
public int
public byte
public int
getSize()

Implements abstract org.apache.poi.ss.formula.ptg.Ptg.getSize.

This size includes the size of the array Ptg plus the Array Ptg Token value size

public Object[][]

Returns:

2-d array (inner index is rowIx, outer index is colIx)
getTokenArrayValues
()

pack-priv int

Returns:

the index into the internal 1D array for the specified column and row
getValueIndex
(int colIx, int rowIx)

Note - (2D) array elements are stored row by row

public boolean
public String
toFormulaString()

Implements abstract org.apache.poi.ss.formula.ptg.Ptg.toFormulaString.

return a string representation of this token alone

public void
public int
Inherited from org.apache.poi.ss.formula.ptg.Ptg:
createPtgdoesFormulaReferToDeletedCellgetEncodedSizegetEncodedSizeWithoutArrayDatagetPtgClassgetRVATypereadTokensserializePtgssetClasstoString

Field Detail

_arrayValuesback to summary
private final Object[] _arrayValues
_nColumnsback to summary
private final int _nColumns
_nRowsback to summary
private final int _nRows
_reserved0Intback to summary
private final int _reserved0Int
_reserved1Shortback to summary
private final int _reserved1Short
_reserved2Byteback to summary
private final int _reserved2Byte
PLAIN_TOKEN_SIZEback to summary
public static final int PLAIN_TOKEN_SIZE

The size of the plain tArray token written within the standard formula tokens (not including the data which comes after all formula tokens)

RESERVED_FIELD_LENback to summary
private static final int RESERVED_FIELD_LEN
sidback to summary
public static final byte sid

Constructor Detail

ArrayPtgback to summary
pack-priv ArrayPtg(int reserved0, int reserved1, int reserved2, int nColumns, int nRows, Object[] arrayValues)
ArrayPtgback to summary
public ArrayPtg(ArrayPtg other)
ArrayPtgback to summary
public ArrayPtg(Object[][] values2d)
Parameters
values2d:Object[][]

array values arranged in rows

Method Detail

copyback to summary
public ArrayPtg copy()

Implements abstract org.apache.poi.ss.formula.ptg.Ptg.copy.

Implements org.apache.poi.common.Duplicatable.copy.

Returns:ArrayPtg

Doc from org.apache.poi.common.Duplicatable.copy.

a deep copy of the implementing class / instance

Annotations
@Override
getColumnCountback to summary
public int getColumnCount()
getConstantTextback to summary
private static String getConstantText(Object o)
getDefaultOperandClassback to summary
public byte getDefaultOperandClass()

Implements abstract org.apache.poi.ss.formula.ptg.Ptg.getDefaultOperandClass.

Annotations
@Override
getGenericPropertiesback to summary
public Map<String, Supplier<?>> getGenericProperties()

Implements org.apache.poi.common.usermodel.GenericRecord.getGenericProperties.

Annotations
@Override
getRowCountback to summary
public int getRowCount()
getSidback to summary
public byte getSid()

Implements abstract org.apache.poi.ss.formula.ptg.Ptg.getSid.

Returns:byte

Doc from org.apache.poi.ss.formula.ptg.Ptg.getSid.

structure id of the parsed thing, or -1 if the record has no sid

Annotations
@Override
getSizeback to summary
public int getSize()

Implements abstract org.apache.poi.ss.formula.ptg.Ptg.getSize.

This size includes the size of the array Ptg plus the Array Ptg Token value size

Returns:int

Doc from org.apache.poi.ss.formula.ptg.Ptg.getSize.

the encoded length of this Ptg, including the initial Ptg type identifier byte.

getTokenArrayValuesback to summary
public Object[][] getTokenArrayValues()
Returns:Object[][]

2-d array (inner index is rowIx, outer index is colIx)

getValueIndexback to summary
pack-priv int getValueIndex(int colIx, int rowIx)

Note - (2D) array elements are stored row by row

Returns:int

the index into the internal 1D array for the specified column and row

isBaseTokenback to summary
public boolean isBaseToken()

Implements abstract org.apache.poi.ss.formula.ptg.Ptg.isBaseToken.

Returns:boolean

Doc from org.apache.poi.ss.formula.ptg.Ptg.isBaseToken.

false if this token is classified as 'reference', 'value', or 'array'

Annotations
@Override
toFormulaStringback to summary
public String toFormulaString()

Implements abstract org.apache.poi.ss.formula.ptg.Ptg.toFormulaString.

Doc from org.apache.poi.ss.formula.ptg.Ptg.toFormulaString.

return a string representation of this token alone

writeback to summary
public void write(LittleEndianOutput out)

Implements abstract org.apache.poi.ss.formula.ptg.Ptg.write.

writeTokenValueBytesback to summary
public int writeTokenValueBytes(LittleEndianOutput out)