Class 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
    • Constructor Detail

      • Record

        public Record​(long startRowIndex,
                      List<Row> rows)
      • Record

        public Record​(long startRowIndex,
                      Long startRowOriginalIndex,
                      List<Row> rows)
    • 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…). If getOriginalStartRowId() is defined then it is returned, otherwise this is getStartRowId().
      • getRows

        public List<Row> getRows()
        The rows contained in this record.
      • size

        public int size()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • 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 their IndexedRow.getOriginalIndex() is null.
        keyCellIndex - the index of the column used to group rows into records
        ignoreFirstRows - whether the first rows with blank record key should be ignored
        additionalRows - additional rows to read once the stream is consumed
        Returns:
        a stream of records