org.apache.poi.ss.util
Class SSCellRange<K extends Cell>

java.lang.Object
  extended by org.apache.poi.ss.util.SSCellRange<K>
All Implemented Interfaces:
java.lang.Iterable<K>, CellRange<K>

@Internal
public final class SSCellRange<K extends Cell>
extends java.lang.Object
implements CellRange<K>

For POI internal use only


Method Summary
static
<B extends Cell>
SSCellRange<B>
create(int firstRow, int firstColumn, int height, int width, java.util.List<B> flattenedList, java.lang.Class<B> cellClass)
           
 K getCell(int relativeRowIndex, int relativeColumnIndex)
           
 K[][] getCells()
           
 K[] getFlattenedCells()
           
 int getHeight()
           
 java.lang.String getReferenceText()
           
 K getTopLeftCell()
           
 int getWidth()
           
 java.util.Iterator<K> iterator()
           
 int size()
          Gets the number of cells in this range.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static <B extends Cell> SSCellRange<B> create(int firstRow,
                                                     int firstColumn,
                                                     int height,
                                                     int width,
                                                     java.util.List<B> flattenedList,
                                                     java.lang.Class<B> cellClass)

getHeight

public int getHeight()
Specified by:
getHeight in interface CellRange<K extends Cell>

getWidth

public int getWidth()
Specified by:
getWidth in interface CellRange<K extends Cell>

size

public int size()
Description copied from interface: CellRange
Gets the number of cells in this range.

Specified by:
size in interface CellRange<K extends Cell>
Returns:
height * width

getReferenceText

public java.lang.String getReferenceText()
Specified by:
getReferenceText in interface CellRange<K extends Cell>
Returns:
the text format of this range. Single cell ranges are formatted like single cell references (e.g. 'A1' instead of 'A1:A1').

getTopLeftCell

public K getTopLeftCell()
Specified by:
getTopLeftCell in interface CellRange<K extends Cell>
Returns:
the cell at relative coordinates (0,0). Never null.

getCell

public K getCell(int relativeRowIndex,
                 int relativeColumnIndex)
Specified by:
getCell in interface CellRange<K extends Cell>
Parameters:
relativeRowIndex - must be between 0 and height-1
relativeColumnIndex - must be between 0 and width-1
Returns:
the cell at the specified coordinates. Never null.

getFlattenedCells

public K[] getFlattenedCells()
Specified by:
getFlattenedCells in interface CellRange<K extends Cell>
Returns:
a flattened array of all the cells in this CellRange

getCells

public K[][] getCells()
Specified by:
getCells in interface CellRange<K extends Cell>
Returns:
a 2-D array of all the cells in this CellRange. The first array dimension is the row index (values 0...height-1) and the second dimension is the column index (values 0...width-1)

iterator

public java.util.Iterator<K> iterator()
Specified by:
iterator in interface java.lang.Iterable<K extends Cell>
Specified by:
iterator in interface CellRange<K extends Cell>
Returns:
an Iterator over all cells in this range. Iteration starts with all cells in the first row followed by all cells in the next row, etc.