org.apache.poi.hssf.record.formula
Class ArrayPtg

java.lang.Object
  extended by org.apache.poi.hssf.record.formula.Ptg
      extended by org.apache.poi.hssf.record.formula.ArrayPtg
All Implemented Interfaces:
java.lang.Cloneable

public final class ArrayPtg
extends Ptg

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.

Author:
Jason Height (jheight at chariot dot net dot au)

Field Summary
static 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)
static byte sid
           
 
Fields inherited from class org.apache.poi.hssf.record.formula.Ptg
CLASS_ARRAY, CLASS_REF, CLASS_VALUE, EMPTY_PTG_ARRAY
 
Constructor Summary
ArrayPtg(java.lang.Object[][] values2d)
           
ArrayPtg(RecordInputStream in)
           
 
Method Summary
 java.lang.String formatAsString()
           
 short getColumnCount()
           
 byte getDefaultOperandClass()
           
 short getRowCount()
           
 int getSize()
          This size includes the size of the array Ptg plus the Array Ptg Token value size
 java.lang.Object[][] getTokenArrayValues()
           
 boolean isBaseToken()
           
 void readTokenValues(RecordInputStream in)
          Read in the actual token (array) values.
 java.lang.String toFormulaString()
          return a string representation of this token alone
 java.lang.String toString()
          Overridden toString method to ensure object hash is not printed.
 void writeBytes(byte[] data, int offset)
          write this Ptg to a byte array
 int writeTokenValueBytes(byte[] data, int offset)
           
 
Methods inherited from class org.apache.poi.hssf.record.formula.Ptg
clone, copy, createPtg, getBytes, getEncodedSize, getEncodedSizeWithoutArrayData, getPtgClass, getRVAType, readTokens, serializePtgs, setClass, toDebugString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sid

public static final byte sid
See Also:
Constant Field Values

PLAIN_TOKEN_SIZE

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)

See Also:
Constant Field Values
Constructor Detail

ArrayPtg

public ArrayPtg(RecordInputStream in)

ArrayPtg

public ArrayPtg(java.lang.Object[][] values2d)
Parameters:
values2d - array values arranged in rows
Method Detail

getTokenArrayValues

public java.lang.Object[][] getTokenArrayValues()
Returns:
2-d array (inner index is rowIx, outer index is colIx)

isBaseToken

public boolean isBaseToken()
Specified by:
isBaseToken in class Ptg
Returns:
false if this token is classified as 'reference', 'value', or 'array'

readTokenValues

public void readTokenValues(RecordInputStream in)
Read in the actual token (array) values. This occurs AFTER the last Ptg in the expression. See page 304-305 of Excel97-2007BinaryFileFormat(xls)Specification.pdf


toString

public java.lang.String toString()
Description copied from class: Ptg
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

Overrides:
toString in class Ptg

writeBytes

public void writeBytes(byte[] data,
                       int offset)
Description copied from class: Ptg
write this Ptg to a byte array

Specified by:
writeBytes in class Ptg

writeTokenValueBytes

public int writeTokenValueBytes(byte[] data,
                                int offset)

getRowCount

public short getRowCount()

getColumnCount

public short getColumnCount()

getSize

public int getSize()
This size includes the size of the array Ptg plus the Array Ptg Token value size

Specified by:
getSize in class Ptg
Returns:
the encoded length of this Ptg, including the initial Ptg type identifier byte.

formatAsString

public java.lang.String formatAsString()

toFormulaString

public java.lang.String toFormulaString()
Description copied from class: Ptg
return a string representation of this token alone

Specified by:
toFormulaString in class Ptg

getDefaultOperandClass

public byte getDefaultOperandClass()
Specified by:
getDefaultOperandClass in class Ptg


Copyright 2008 The Apache Software Foundation or its licensors, as applicable.