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

java.lang.Object
  extended by org.apache.poi.hssf.record.formula.Ptg
      extended by org.apache.poi.hssf.record.formula.AreaPtg
All Implemented Interfaces:
AreaI
Direct Known Subclasses:
AreaAPtg, AreaErrPtg, AreaNAPtg, AreaNPtg, AreaNVPtg, AreaVPtg

public class AreaPtg
extends Ptg
implements AreaI

Specifies a rectangular area of cells A1:A4 for instance.

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

Field Summary
static short sid
           
 
Fields inherited from class org.apache.poi.hssf.record.formula.Ptg
CLASS_ARRAY, CLASS_REF, CLASS_VALUE, ptgClass
 
Constructor Summary
protected AreaPtg()
           
  AreaPtg(int firstRow, int lastRow, int firstColumn, int lastColumn, boolean firstRowRelative, boolean lastRowRelative, boolean firstColRelative, boolean lastColRelative)
           
  AreaPtg(RecordInputStream in)
           
  AreaPtg(java.lang.String arearef)
           
 
Method Summary
 java.lang.Object clone()
           
 java.lang.String getAreaPtgName()
           
 byte getDefaultOperandClass()
           
 int getFirstColumn()
           
 short getFirstColumnRaw()
           
 int getFirstRow()
           
 int getLastColumn()
           
 short getLastColumnRaw()
           
 int getLastRow()
           
 int getSize()
           
 boolean isFirstColRelative()
           
 boolean isFirstRowRelative()
           
 boolean isLastColRelative()
           
 boolean isLastRowRelative()
           
protected  java.lang.RuntimeException notImplemented()
          TODO - (May-2008) fix subclasses of AreaPtg 'AreaN~' which are used in shared formulas.
 void setFirstColRelative(boolean rel)
          set whether the first column is relative
 void setFirstColumn(int colIx)
          set the first column in the area
 void setFirstColumnRaw(int column)
          set the first column irespective of the bitmasks
 void setFirstRow(int rowIx)
          sets the first row
 void setFirstRowRelative(boolean rel)
          sets the first row to relative or not
 void setLastColRelative(boolean rel)
          set whether the last column should be relative or not
 void setLastColumn(int colIx)
          set the last column in the area
 void setLastColumnRaw(short column)
          set the last column irrespective of the bitmasks
 void setLastRow(int rowIx)
           
 void setLastRowRelative(boolean rel)
          set whether the last row is relative or not
protected static java.lang.String toFormulaString(AreaI area, HSSFWorkbook book)
           
 java.lang.String toFormulaString(HSSFWorkbook book)
          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[] array, int offset)
          write this Ptg to a byte array
 
Methods inherited from class org.apache.poi.hssf.record.formula.Ptg
createParsedExpressionTokens, createPtg, getBytes, getPtgClass, serializePtgStack, setClass, toDebugString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sid

public static final short sid
See Also:
Constant Field Values
Constructor Detail

AreaPtg

protected AreaPtg()

AreaPtg

public AreaPtg(java.lang.String arearef)

AreaPtg

public AreaPtg(int firstRow,
               int lastRow,
               int firstColumn,
               int lastColumn,
               boolean firstRowRelative,
               boolean lastRowRelative,
               boolean firstColRelative,
               boolean lastColRelative)

AreaPtg

public AreaPtg(RecordInputStream in)
Method Detail

notImplemented

protected final java.lang.RuntimeException notImplemented()
TODO - (May-2008) fix subclasses of AreaPtg 'AreaN~' which are used in shared formulas. see similar comment in ReferencePtg


getAreaPtgName

public java.lang.String getAreaPtgName()

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[] array,
                       int offset)
Description copied from class: Ptg
write this Ptg to a byte array

Specified by:
writeBytes in class Ptg

getSize

public int getSize()
Specified by:
getSize in class Ptg

getFirstRow

public int getFirstRow()
Specified by:
getFirstRow in interface AreaI
Returns:
the first row in the area

setFirstRow

public void setFirstRow(int rowIx)
sets the first row

Parameters:
rowIx - number (0-based)

getLastRow

public int getLastRow()
Specified by:
getLastRow in interface AreaI
Returns:
last row in the range (x2 in x1,y1-x2,y2)

setLastRow

public void setLastRow(int rowIx)
Parameters:
rowIx - last row number in the area

getFirstColumn

public int getFirstColumn()
Specified by:
getFirstColumn in interface AreaI
Returns:
the first column number in the area.

getFirstColumnRaw

public short getFirstColumnRaw()
Returns:
the first column number + the options bit settings unstripped

isFirstRowRelative

public boolean isFirstRowRelative()
Specified by:
isFirstRowRelative in interface AreaI
Returns:
whether or not the first row is a relative reference or not.

setFirstRowRelative

public void setFirstRowRelative(boolean rel)
sets the first row to relative or not

Parameters:
rel - is relative or not.

isFirstColRelative

public boolean isFirstColRelative()
Specified by:
isFirstColRelative in interface AreaI
Returns:
isrelative first column to relative or not

setFirstColRelative

public void setFirstColRelative(boolean rel)
set whether the first column is relative


setFirstColumn

public void setFirstColumn(int colIx)
set the first column in the area


setFirstColumnRaw

public void setFirstColumnRaw(int column)
set the first column irespective of the bitmasks


getLastColumn

public int getLastColumn()
Specified by:
getLastColumn in interface AreaI
Returns:
lastcolumn in the area

getLastColumnRaw

public short getLastColumnRaw()
Returns:
last column and bitmask (the raw field)

isLastRowRelative

public boolean isLastRowRelative()
Specified by:
isLastRowRelative in interface AreaI
Returns:
last row relative or not

setLastRowRelative

public void setLastRowRelative(boolean rel)
set whether the last row is relative or not

Parameters:
rel - true if the last row relative, else false

isLastColRelative

public boolean isLastColRelative()
Specified by:
isLastColRelative in interface AreaI
Returns:
lastcol relative or not

setLastColRelative

public void setLastColRelative(boolean rel)
set whether the last column should be relative or not


setLastColumn

public void setLastColumn(int colIx)
set the last column in the area


setLastColumnRaw

public void setLastColumnRaw(short column)
set the last column irrespective of the bitmasks


toFormulaString

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

Specified by:
toFormulaString in class Ptg

toFormulaString

protected static java.lang.String toFormulaString(AreaI area,
                                                  HSSFWorkbook book)

getDefaultOperandClass

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

clone

public java.lang.Object clone()
Specified by:
clone in class Ptg


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