Package adams.data.spreadsheet
Class AbstractRow
- java.lang.Object
-
- adams.data.spreadsheet.AbstractRow
-
- All Implemented Interfaces:
Mergeable<Row>,Row,Serializable
- Direct Known Subclasses:
HeaderRow,SparseDataRow
public abstract class AbstractRow extends Object implements Row
Ancestor for row objects.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractRow(SpreadSheet owner)default constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract CelladdCell(int columnIndex)Adds a cell with the key of the cell in the header at the specified location.abstract CelladdCell(String cellKey)Adds a cell with the given key to the list and returns the created object.voidassign(Row row)Obtains copies of the cells from the other row, but not the owner.abstract Collection<String>cellKeys()Returns a collection of all stored cell keys.voidclear()Removes all cells.CellgetCell(int columnIndex)Returns the cell with the given index, null if not found.CellgetCell(String cellKey)Returns the cell with the given key, null if not found.intgetCellCount()Returns the number of cells stored in the row.abstract StringgetCellKey(int columnIndex)Returns the cell key with the given column index.StringgetContent(int columnIndex)Returns the cell content with the given index.SpreadSheetgetOwner()Returns the spreadsheet this row belongs to.booleanhasCell(String cellKey)Returns whether the row alread contains the cell with the given key.booleanisEmpty(int columnIndex)Returns whether the row has a non-empty/non-missing cell at the specified location.booleanisEmpty(String cellKey)Returns whether the row has a non-empty/non-missing cell with the given key.CellremoveCell(int columnIndex)Removes the cell at the specified index.CellremoveCell(String cellKey)Removes the cell at the specified index.booleanremoveMissing()Removes all cells marked "missing".voidsetOwner(SpreadSheet owner)Sets the spreadsheet this row belongs to.StringtoString()Simply returns the internal hashtable of cells as string.
-
-
-
Field Detail
-
m_Owner
protected SpreadSheet m_Owner
the owner.
-
-
Constructor Detail
-
AbstractRow
protected AbstractRow(SpreadSheet owner)
default constructor.- Parameters:
owner- the spreadsheet this row belongs to
-
-
Method Detail
-
setOwner
public void setOwner(SpreadSheet owner)
Sets the spreadsheet this row belongs to.
-
getOwner
public SpreadSheet getOwner()
Returns the spreadsheet this row belongs to.
-
assign
public void assign(Row row)
Obtains copies of the cells from the other row, but not the owner.
-
hasCell
public boolean hasCell(String cellKey)
Returns whether the row alread contains the cell with the given key.
-
addCell
public abstract 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.
-
addCell
public abstract 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.
-
removeCell
public Cell removeCell(int columnIndex)
Removes the cell at the specified index.- Specified by:
removeCellin interfaceRow- Parameters:
columnIndex- the index of the column- Returns:
- the removed cell, null if non removed
-
removeCell
public Cell removeCell(String cellKey)
Removes the cell at the specified index.- Specified by:
removeCellin interfaceRow- Parameters:
cellKey- the key of the cell to remove- Returns:
- the removed cell, null if non removed
-
getCell
public Cell getCell(String cellKey)
Returns the cell with the given key, null if not found.
-
getCell
public Cell getCell(int columnIndex)
Returns the cell with the given index, null if not found.
-
isEmpty
public boolean isEmpty(int columnIndex)
Returns whether the row has a non-empty/non-missing cell at the specified location.
-
isEmpty
public boolean isEmpty(String cellKey)
Returns whether the row has a non-empty/non-missing cell with the given key.
-
getContent
public String getContent(int columnIndex)
Returns the cell content with the given index.- Specified by:
getContentin interfaceRow- Parameters:
columnIndex- the index of the column- Returns:
- the content or null if not found
-
getCellKey
public abstract String getCellKey(int columnIndex)
Returns the cell key with the given column index.- Specified by:
getCellKeyin interfaceRow- Parameters:
columnIndex- the index of the column- Returns:
- the cell key, null if invalid index
-
cellKeys
public abstract Collection<String> cellKeys()
Returns a collection of all stored cell keys.
-
getCellCount
public int getCellCount()
Returns the number of cells stored in the row.- Specified by:
getCellCountin interfaceRow- Returns:
- the number of cells
-
removeMissing
public boolean removeMissing()
Removes all cells marked "missing".- Specified by:
removeMissingin interfaceRow- Returns:
- whether any cell was removed
-
-