Package org.openrefine.model
Class Row
- java.lang.Object
-
- org.openrefine.model.Row
-
- All Implemented Interfaces:
Serializable
,HasFields
public class Row extends Object implements HasFields, Serializable
Class representing a single Row which contains a list ofCell
s. There may be multiple rows in aRecord
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description Row(int nbCells)
protected
Row(com.google.common.collect.ImmutableList<Cell> cells, boolean flagged, boolean starred)
Row(List<Cell> cells)
Construct a new Row containing the given cells.Row(List<Cell> cells, boolean flagged, boolean starred)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
boolean
fieldAlsoHasFields(String name)
Cell
getCell(int cellIndex)
List<Cell>
getCells()
CellTuple
getCellTuple(ColumnModel columnModel)
Serializable
getCellValue(int cellIndex)
Object
getField(String name)
Row
insertCell(int index, Cell cell)
Inserts a cell at a given index.Row
insertCells(int index, List<Cell> cells)
Insest multiple cells contiguously, starting at a given indexboolean
isCellBlank(int cellIndex)
Whether the cell at the given index is null or consists only of whitespace.boolean
isCellPending(int cellIndex)
Whether the cell at the given index is being computed and should not be treated as a definitive value.boolean
isEmpty()
boolean
isFlagged()
boolean
isStarred()
protected boolean
isValueBlank(Object value)
static Row
load(String s)
static Row
loadStreaming(String s)
Row
padWithNull(int finalSize)
Returns a copy of this row with null cells added at the end, such that the new row has the supplied size.Row
removeCell(int index)
Removes a cell from the row (removing the corresponding column).void
save(Writer writer, Properties options)
String
toString()
Row
withCell(int index, Cell cell)
Overwrite a cell at a given index.Row
withFlagged(boolean newFlagged)
Changes the flag on the row.Row
withStarred(boolean newStarred)
Changes the star on the row.
-
-
-
Field Detail
-
flagged
public final boolean flagged
-
starred
public final boolean starred
-
cells
public final com.google.common.collect.ImmutableList<Cell> cells
-
-
Constructor Detail
-
Row
public Row(int nbCells)
-
Row
protected Row(com.google.common.collect.ImmutableList<Cell> cells, boolean flagged, boolean starred)
-
-
Method Detail
-
fieldAlsoHasFields
public boolean fieldAlsoHasFields(String name)
- Specified by:
fieldAlsoHasFields
in interfaceHasFields
-
isEmpty
public boolean isEmpty()
-
getCell
public Cell getCell(int cellIndex)
- Parameters:
cellIndex
- index of cell to return- Returns:
- given cell or null if cell doesn't exist or cell index is out of range
-
getCellValue
public Serializable getCellValue(int cellIndex)
-
isCellBlank
public boolean isCellBlank(int cellIndex)
Whether the cell at the given index is null or consists only of whitespace.
-
isCellPending
public boolean isCellPending(int cellIndex)
Whether the cell at the given index is being computed and should not be treated as a definitive value.
-
isValueBlank
protected boolean isValueBlank(Object value)
-
getCellTuple
public CellTuple getCellTuple(ColumnModel columnModel)
-
isFlagged
public boolean isFlagged()
-
isStarred
public boolean isStarred()
-
withCell
public Row withCell(int index, Cell cell)
Overwrite a cell at a given index. As rows are immutable this returns a new row.- Parameters:
index
- the position of the cell to overwritecell
- the cell value- Returns:
- the modified row
-
insertCell
public Row insertCell(int index, Cell cell)
Inserts a cell at a given index. As rows are immutable this returns a new row.- Parameters:
index
- the position where to insert the cellcell
- the cell to insert- Returns:
- the new row
-
insertCells
public Row insertCells(int index, List<Cell> cells)
Insest multiple cells contiguously, starting at a given index- Parameters:
index
- the index of the first inserted cellcells
- the cells to insert
-
removeCell
public Row removeCell(int index)
Removes a cell from the row (removing the corresponding column).- Parameters:
index
- the index of the cell to remove- Returns:
- the new row without the cell
-
withFlagged
public Row withFlagged(boolean newFlagged)
Changes the flag on the row.
-
withStarred
public Row withStarred(boolean newStarred)
Changes the star on the row.
-
padWithNull
public Row padWithNull(int finalSize)
Returns a copy of this row with null cells added at the end, such that the new row has the supplied size.- Parameters:
finalSize
- the size of the returned row
-
save
public void save(Writer writer, Properties options)
-
-