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 ofCells. There may be multiple rows in aRecord.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description Row(int nbCells)protectedRow(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 booleanequals(Object other)booleanfieldAlsoHasFields(String name)CellgetCell(int cellIndex)List<Cell>getCells()CellTuplegetCellTuple(ColumnModel columnModel)SerializablegetCellValue(int cellIndex)ObjectgetField(String name)RowinsertCell(int index, Cell cell)Inserts a cell at a given index.RowinsertCells(int index, List<Cell> cells)Insest multiple cells contiguously, starting at a given indexbooleanisCellBlank(int cellIndex)Whether the cell at the given index is null or consists only of whitespace.booleanisCellPending(int cellIndex)Whether the cell at the given index is being computed and should not be treated as a definitive value.booleanisEmpty()booleanisFlagged()booleanisStarred()protected booleanisValueBlank(Object value)static Rowload(String s)static RowloadStreaming(String s)RowpadWithNull(int finalSize)Returns a copy of this row with null cells added at the end, such that the new row has the supplied size.RowremoveCell(int index)Removes a cell from the row (removing the corresponding column).voidsave(Writer writer, Properties options)StringtoString()RowwithCell(int index, Cell cell)Overwrite a cell at a given index.RowwithFlagged(boolean newFlagged)Changes the flag on the row.RowwithStarred(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:
fieldAlsoHasFieldsin 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)
-
-