Package org.openrefine.model
Class Record
- java.lang.Object
-
- org.openrefine.model.Record
-
- All Implemented Interfaces:
Serializable
public class Record extends Object implements Serializable
A list of consecutive rows where only the first row has a non-blank value in the record key column (normally, the first column).This can also store the original row id of the first row in the record, if records have been temporarily reordered. Note that this assumes that the grid has been temporarily reordered as records, not as rows, so that only the first original row id needs to be recorded (so that the original ids of the other rows in the records can be deduced from it).
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
long
getEndRowId()
The id of the last row in this record.Iterable<IndexedRow>
getIndexedRows()
long
getLogicalStartRowId()
The record index to be used in user-exposed features (expression language, filtering, UI…).Long
getOriginalStartRowId()
The original id (before applying a temporary sorting operation) of the first row in this record.List<Row>
getRows()
The rows contained in this record.long
getStartRowId()
The id of the first row in this record.static CloseableIterator<Record>
groupIntoRecords(CloseableIterator<IndexedRow> parentIter, int keyCellIndex, boolean ignoreFirstRows, List<Row> additionalRows)
Groups a stream of indexed rows into a stream of records.int
hashCode()
static boolean
isRecordStart(Row row, int keyCellIndex)
Determines when a row marks the start of a new record.int
size()
String
toString()
-
-
-
Method Detail
-
getStartRowId
public long getStartRowId()
The id of the first row in this record.
-
getEndRowId
public long getEndRowId()
The id of the last row in this record.
-
getOriginalStartRowId
public Long getOriginalStartRowId()
The original id (before applying a temporary sorting operation) of the first row in this record.If no sorting has been applied, this returns null.
-
getLogicalStartRowId
public long getLogicalStartRowId()
The record index to be used in user-exposed features (expression language, filtering, UI…). IfgetOriginalStartRowId()
is defined then it is returned, otherwise this isgetStartRowId()
.
-
getIndexedRows
public Iterable<IndexedRow> getIndexedRows()
-
size
public int size()
-
isRecordStart
public static boolean isRecordStart(Row row, int keyCellIndex)
Determines when a row marks the start of a new record.
-
groupIntoRecords
public static CloseableIterator<Record> groupIntoRecords(CloseableIterator<IndexedRow> parentIter, int keyCellIndex, boolean ignoreFirstRows, List<Row> additionalRows)
Groups a stream of indexed rows into a stream of records.- Parameters:
parentIter
- the iterator of rows. They are supposed to be in their original order, meaning that all theirIndexedRow.getOriginalIndex()
is null.keyCellIndex
- the index of the column used to group rows into recordsignoreFirstRows
- whether the first rows with blank record key should be ignoredadditionalRows
- additional rows to read once the stream is consumed- Returns:
- a stream of records
-
-