Package adams.data.spreadsheet
Interface Row
-
- All Superinterfaces:
Mergeable<Row>
,Serializable
- All Known Subinterfaces:
DataRow
- All Known Implementing Classes:
AbstractRow
,DataRowView
,DenseDataRow
,DenseFloatDataRow
,HeaderRow
,InstancesHeaderRow
,InstanceView
,SparseDataRow
,SparseFloatDataRow
public interface Row extends Serializable, Mergeable<Row>
Interface for a row in aSpreadSheet
.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Cell
addCell(int columnIndex)
Adds a cell with the key of the cell in the header at the specified location.Cell
addCell(String cellKey)
Adds a cell with the given key to the list and returns the created object.void
assign(Row row)
Obtains copies of the cells from the other row, but not the owner.Collection<String>
cellKeys()
Returns a collection of all stored cell keys.Collection<Cell>
cells()
Returns all cells.void
clear()
Removes all cells.Cell
getCell(int columnIndex)
Returns the cell with the given index, null if not found.Cell
getCell(String cellKey)
Returns the cell with the given key, null if not found.int
getCellCount()
Returns the number of cells stored in the row.String
getCellKey(int columnIndex)
Returns the cell key with the given column index.Row
getClone(SpreadSheet owner)
Returns a clone of itself.String
getContent(int columnIndex)
Returns the cell content with the given index.SpreadSheet
getOwner()
Returns the spreadsheet this row belongs to.boolean
hasCell(int columnIndex)
Returns whether the row alread contains the cell at the specified location.boolean
hasCell(String cellKey)
Returns whether the row alread contains the cell with the given key.int
indexOf(Cell cell)
Returns the column this particular cell is in (must belong to this row!).void
mergeWith(Row other)
Merges its own data with the one provided by the specified row.Cell
newCell(Row owner)
Creates a new instance of a cell.Cell
removeCell(int columnIndex)
Removes the cell at the specified index.Cell
removeCell(String cellKey)
Removes the cell at the specified index.boolean
removeMissing()
Removes all cells marked "missing".void
setOwner(SpreadSheet owner)
Sets the spreadsheet this row belongs to.String
toString()
Simply returns the internal hashtable of cells as string.
-
-
-
Method Detail
-
setOwner
void setOwner(SpreadSheet owner)
Sets the spreadsheet this row belongs to.- Parameters:
owner
- the owner
-
getOwner
SpreadSheet getOwner()
Returns the spreadsheet this row belongs to.- Returns:
- the owner
-
getClone
Row getClone(SpreadSheet owner)
Returns a clone of itself.- Parameters:
owner
- the new owner- Returns:
- the clone
-
clear
void clear()
Removes all cells.
-
assign
void assign(Row row)
Obtains copies of the cells from the other row, but not the owner.- Parameters:
row
- the row to get the cells from
-
newCell
Cell newCell(Row owner)
Creates a new instance of a cell.- Parameters:
owner
- the owner- Returns:
- the cell
-
hasCell
boolean hasCell(int columnIndex)
Returns whether the row alread contains the cell at the specified location.- Parameters:
columnIndex
- the column index- Returns:
- true if the cell already exists
-
hasCell
boolean hasCell(String cellKey)
Returns whether the row alread contains the cell with the given key.- Parameters:
cellKey
- the key to look for- Returns:
- true if the cell already exists
-
addCell
Cell addCell(int columnIndex)
Adds a cell with the key of the cell in the header at the specified location. If the cell already exists, it returns that instead of creating one.- Parameters:
columnIndex
- the index of the column to create- Returns:
- the created cell or the already existing cell
-
addCell
Cell addCell(String cellKey)
Adds a cell with the given key to the list and returns the created object. If the cell already exists, then this cell is returned instead and no new object created.- Parameters:
cellKey
- the key for the cell to create- Returns:
- the created cell or the already existing cell
-
removeCell
Cell removeCell(int columnIndex)
Removes the cell at the specified index.- Parameters:
columnIndex
- the index of the column- Returns:
- the removed cell, null if not removed
-
removeCell
Cell removeCell(String cellKey)
Removes the cell at the specified index.- Parameters:
cellKey
- the key of the cell to remove- Returns:
- the removed cell, null if non removed
-
getCell
Cell getCell(String cellKey)
Returns the cell with the given key, null if not found.- Parameters:
cellKey
- the cell to look for- Returns:
- the cell or null if not found
-
getCell
Cell getCell(int columnIndex)
Returns the cell with the given index, null if not found.- Parameters:
columnIndex
- the index of the column- Returns:
- the cell or null if not found
-
getContent
String getContent(int columnIndex)
Returns the cell content with the given index.- Parameters:
columnIndex
- the index of the column- Returns:
- the content or null if not found
-
getCellKey
String getCellKey(int columnIndex)
Returns the cell key with the given column index.- Parameters:
columnIndex
- the index of the column- Returns:
- the cell key, null if invalid index
-
cellKeys
Collection<String> cellKeys()
Returns a collection of all stored cell keys.- Returns:
- all cell keys
-
cells
Collection<Cell> cells()
Returns all cells.- Returns:
- the cells
-
getCellCount
int getCellCount()
Returns the number of cells stored in the row.- Returns:
- the number of cells
-
removeMissing
boolean removeMissing()
Removes all cells marked "missing".- Returns:
- true if any cell was removed
-
indexOf
int indexOf(Cell cell)
Returns the column this particular cell is in (must belong to this row!).- Parameters:
cell
- the cell to get the column index of- Returns:
- the column index, -1 if not found
-
mergeWith
void mergeWith(Row other)
Merges its own data with the one provided by the specified row.
-
-