* Only rows that have cells should be added to a Sheet.
* @version 1.0-pre
* @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Glen Stampoultzis (glens at apache.org)
*/
public class HSSFRow
public final static int INITIAL_CAPACITY = 5;
private short rowNum;
private HashMap cells;
- private short firstcell = -1;
- private short lastcell = -1;
+// private short firstcell = -1;
+// private short lastcell = -1;
/**
* reference to low level representation
this.sheet = sheet;
row = new RowRecord();
row.setHeight((short) 0xff);
+ row.setLastCol((short)-1);
+ row.setFirstCol((short)-1);
// row.setRowNumber(rowNum);
setRowNum(rowNum);
* remove the HSSFCell from this row.
* @param cell to remove
*/
-
public void removeCell(HSSFCell cell)
{
CellValueRecordInterface cval = cell.getCellValueRecord();
sheet.removeValueRecord(getRowNum(), cval);
cells.remove(new Integer(cell.getCellNum()));
- if (cell.getCellNum() == lastcell)
+ if (cell.getCellNum() == row.getLastCol())
{
- lastcell = findLastCell(lastcell);
- } else if (cell.getCellNum() == firstcell)
+ row.setLastCol( findLastCell(row.getLastCol()) );
+ } else if (cell.getCellNum() == row.getFirstCol())
{
- firstcell = findFirstCell(firstcell);
+ row.setFirstCol( findFirstCell(row.getFirstCol()) );
}
}
private void addCell(HSSFCell cell)
{
- if (firstcell == -1)
+ if (row.getFirstCol() == -1)
{
- firstcell = cell.getCellNum();
+ row.setFirstCol( cell.getCellNum() );
}
- if (lastcell == -1)
+ if (row.getLastCol() == -1)
{
- lastcell = cell.getCellNum();
+ row.setLastCol( cell.getCellNum() );
}
cells.put(new Integer(cell.getCellNum()), cell);
public short getFirstCellNum()
{
- return firstcell;
+ return row.getFirstCol();
}
/**
public short getLastCellNum()
{
-
- // if (cells.size() == 0) return -1;
- // return ((HSSFCell)cells.get(cells.size()-1)).getCellNum();
- return lastcell;
+ return row.getLastCol();
}
/**