com.tibbo.aggregate.common.datatable

## Interface DataTable

- All Superinterfaces:
    AttributedObject, java.lang.Iterable<DataRecord>, StringEncodable
  All Known Implementing Classes:
    AbstractBigDataTable, AbstractDataTable, AbstractUnmodifiableDataTable, FilteringDataTable, ProxyDataTable, ResultSetDataTable, SimpleDataTable, SortedCompositeDataTable, TransformableDataTable

      public interface DataTable
      extends java.lang.Iterable<DataRecord>, AttributedObject, StringEncodable

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `DataRecord` | `addRecord()` Adds new record to the table.
    `DataTable` | `addRecord(DataRecord record)` Adds new record to the table.
    `DataTable` | `addRecord(int index, DataRecord record)` Adds new record to the table at the specified index.
    `DataRecord` | `addRecord(java.lang.Object... fieldValues)` Adds new record to the table.
    `DataTable` | `addRecords(java.util.List<DataRecord> records)` Adds new records to the table.
    `void` | `append(DataTable src)`
    `boolean` | `applyCachedFormat(java.util.Optional<FormatCache> formatCache)`
    `DataTable` | `clone()`
    `DataTable` | `cloneIfImmutable()`
    `void` | `close()`
    `int` | `compareTo(DataTable other)`
    `boolean` | `conform(TableFormat rf)`
    `java.lang.String` | `conformMessage(TableFormat rf)`
    `java.lang.String` | `dataAsString()`
    `java.lang.String` | `dataAsString(boolean showFieldNames, boolean showHiddenFields)`
    `java.lang.String` | `dataAsString(boolean showFieldNames, boolean showHiddenFields, boolean showPasswords)`
    `java.lang.String` | `encode()`
    `java.lang.String` | `encode(boolean useVisibleSeparators)`
    `java.lang.String` | `encode(ClassicEncodingSettings settings)`
    `java.lang.StringBuilder` | `encode(java.lang.StringBuilder finalSB, ClassicEncodingSettings settings, java.lang.Boolean isTransferEncode, java.lang.Integer encodeLevel)`
    `boolean` | `equals(java.lang.Object obj)`
    `java.lang.Integer` | `findIndex(DataRecord record)` Returns the index of the first occurrence of `record` in this Data Table, or null if this Data Table does not contain the specified record.
    `java.lang.Integer` | `findIndex(DataTableQuery query)`
    `java.lang.Integer` | `findIndex(java.lang.String field, java.lang.Object value)`
    `void` | `fixRecords()`
    `java.lang.Object` | `get()` Returns value of first field in first record of the table.
    `java.lang.String` | `getDescription()` Returns human-readable description of the table.
    `java.lang.String` | `getEncodedData(ClassicEncodingSettings settings)`
    `java.lang.StringBuilder` | `getEncodedData(java.lang.StringBuilder finalSB, ClassicEncodingSettings settings, java.lang.Boolean isTransferEncode, java.lang.Integer encodeLevel)`
    `int` | `getFieldCount()` Returns number of fields in the table.
    `TableFormat` | `getFormat()` Returns format of the table.
    `FieldFormat` | `getFormat(int field)` Returns format of field with specified index.
    `FieldFormat` | `getFormat(java.lang.String name)` Returns format of field with specified name.
    `java.lang.Long` | `getId()` Returns table ID.
    `java.lang.String` | `getInvalidationMessage()`
    `java.lang.Integer` | `getQuality()`
    `DataRecord` | `getRecord(int number)` Returns record with specified index.
    `DataRecord` | `getRecordById(java.lang.String id)`
    `java.lang.Integer` | `getRecordCount()` Returns number of records in the table or null if the number of records is unknown.
    `java.util.List<DataRecord>` | `getRecords()` Deprecated.
    `java.util.Date` | `getTimestamp()`
    `java.lang.Object` | `getValue()`
    `boolean` | `hasField(java.lang.String field)`
    `int` | `hashCode()`
    `boolean` | `isImmutable()`
    `boolean` | `isInvalid()`
    `boolean` | `isOneCellTable()` Returns true if table has exactly one record and one field.
    `boolean` | `isSimple()`
    `java.util.Iterator<DataRecord>` | `iterator()`
    `java.util.Iterator<DataRecord>` | `iterator(int index)`
    `void` | `joinFormats()`
    `DataTable` | `makeImmutable()`
    `DataRecord` | `rec()` Returns first record of the table.
    `DataRecord` | `removeRecord(int index)` Removes record with specified index from the table.
    `void` | `removeRecords(DataRecord rec)` Removes all records equal to the rec parameter from the table.
    `void` | `removeRecordsByIds(java.util.Collection<java.lang.String> ids)` Removes all records from the table which contain in ids.
    `void` | `reorderRecord(DataRecord record, int index)` Moves specified record to position specified by `index` argument.
    `DataRecord` | `select(DataTableQuery query)`
    `DataRecord` | `select(java.lang.String field, java.lang.Object value)`
    `java.util.List<DataRecord>` | `selectAll(DataTableQuery query)`
    `DataTable` | `setFormat(TableFormat format)` Sets new format for the table.
    `void` | `setId(java.lang.Long id)` Sets table ID.
    `void` | `setInvalidationMessage(java.lang.String invalidationMessage)`
    `void` | `setQuality(java.lang.Integer quality)`
    `DataTable` | `setRecord(int index, DataRecord record)` Replaces record at the specified index.
    `void` | `setTimestamp(java.util.Date timestamp)`
    `void` | `sort(java.util.Comparator<DataRecord> comparator)`
    `void` | `sort(DataTableSorter sorter)`
    `void` | `sort(java.lang.String field, boolean ascending)`
    `void` | `splitFormat()`
    `java.util.stream.Stream<DataRecord>` | `stream()`
    `void` | `swapRecords(int index1, int index2)` Swaps two records.
    `java.lang.String` | `toDefaultString()`
    `java.lang.String` | `toString()`
    `void` | `validate(Context context, ContextManager contextManager, CallerController caller)` Executes table validators to make sure table data is valid.
    `void` | `validateRecord(DataRecord record)` Executes validators of a specific record to make sure its data is valid.

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Method Detail

    - #### getRecordCount

          java.lang.Integer getRecordCount()

      Returns number of records in the table or null if the number of records is unknown.

    - #### getFieldCount

          int getFieldCount()

      Returns number of fields in the table.

    - #### getFormat

          TableFormat getFormat()

      Returns format of the table.

    - #### setFormat

          DataTable setFormat(TableFormat format)

      Sets new format for the table. Note, that resulting table is not checked for validity. Format of existing records may be incompatible with new format of table.

    - #### getFormat

          FieldFormat getFormat(int field)

      Returns format of field with specified index.

    - #### getFormat

          FieldFormat getFormat(java.lang.String name)

      Returns format of field with specified name.

    - #### applyCachedFormat

          boolean applyCachedFormat(java.util.Optional<FormatCache> formatCache)

    - #### getId

          java.lang.Long getId()

      Returns table ID.

    - #### setId

          void setId(java.lang.Long id)

      Sets table ID.

    - #### hasField

          boolean hasField(java.lang.String field)

    - #### addRecords

          DataTable addRecords(java.util.List<DataRecord> records)

      Adds new records to the table.

    - #### addRecord

          DataTable addRecord(DataRecord record)

      Adds new record to the table.

    - #### addRecord

          DataRecord addRecord(java.lang.Object... fieldValues)

      Adds new record to the table.

    - #### addRecord

          DataTable addRecord(int index,
                              DataRecord record)

      Adds new record to the table at the specified index.

    - #### addRecord

          DataRecord addRecord()

      Adds new record to the table.

    - #### validate

          void validate(Context context,
                        ContextManager contextManager,
                        CallerController caller)
                 throws DataTableException

      Executes table validators to make sure table data is valid. Throws an error if validation fails.
      Throws:
        `DataTableException`

    - #### validateRecord

          void validateRecord(DataRecord record)
                       throws ValidationException

      Executes validators of a specific record to make sure its data is valid. Throws an error if validation fails.
      Throws:
        `ValidationException`

    - #### setRecord

          DataTable setRecord(int index,
                              DataRecord record)

      Replaces record at the specified index.

    - #### swapRecords

          void swapRecords(int index1,
                           int index2)

      Swaps two records. Both records must belong to this table, otherwise method will throw an `IllegalStateException`

    - #### getRecords

          @Deprecated
          java.util.List<DataRecord> getRecords()

      Deprecated.
      Returns list of table records.

    - #### isInvalid

          boolean isInvalid()

    - #### getInvalidationMessage

          java.lang.String getInvalidationMessage()

    - #### setInvalidationMessage

          void setInvalidationMessage(java.lang.String invalidationMessage)

    - #### getTimestamp

          java.util.Date getTimestamp()

      Specified by:
        `getTimestamp` in interface `AttributedObject`

    - #### setTimestamp

          void setTimestamp(java.util.Date timestamp)

      Specified by:
        `setTimestamp` in interface `AttributedObject`

    - #### getQuality

          java.lang.Integer getQuality()

      Specified by:
        `getQuality` in interface `AttributedObject`

    - #### setQuality

          void setQuality(java.lang.Integer quality)

      Specified by:
        `setQuality` in interface `AttributedObject`

    - #### getValue

          java.lang.Object getValue()

      Specified by:
        `getValue` in interface `AttributedObject`

    - #### getRecord

          DataRecord getRecord(int number)

      Returns record with specified index.

    - #### getRecordById

          DataRecord getRecordById(java.lang.String id)

    - #### removeRecord

          DataRecord removeRecord(int index)

      Removes record with specified index from the table.

    - #### removeRecordsByIds

          void removeRecordsByIds(java.util.Collection<java.lang.String> ids)

      Removes all records from the table which contain in ids.

    - #### removeRecords

          void removeRecords(DataRecord rec)

      Removes all records equal to the rec parameter from the table.

    - #### reorderRecord

          void reorderRecord(DataRecord record,
                             int index)

      Moves specified record to position specified by `index` argument. `record`must belong to this table, otherwise method will throw an `IllegalStateException```

    - #### equals

          boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### getEncodedData

          java.lang.String getEncodedData(ClassicEncodingSettings settings)

    - #### getEncodedData

          java.lang.StringBuilder getEncodedData(java.lang.StringBuilder finalSB,
                                                 ClassicEncodingSettings settings,
                                                 java.lang.Boolean isTransferEncode,
                                                 java.lang.Integer encodeLevel)

    - #### encode

          java.lang.String encode()

    - #### encode

          java.lang.String encode(boolean useVisibleSeparators)

    - #### encode

          java.lang.String encode(ClassicEncodingSettings settings)

    - #### encode

          java.lang.StringBuilder encode(java.lang.StringBuilder finalSB,
                                         ClassicEncodingSettings settings,
                                         java.lang.Boolean isTransferEncode,
                                         java.lang.Integer encodeLevel)

      Specified by:
        `encode` in interface `StringEncodable`

    - #### toString

          java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getDescription

          java.lang.String getDescription()

      Returns human-readable description of the table.

    - #### toDefaultString

          java.lang.String toDefaultString()

    - #### fixRecords

          void fixRecords()

    - #### dataAsString

          java.lang.String dataAsString()

    - #### dataAsString

          java.lang.String dataAsString(boolean showFieldNames,
                                        boolean showHiddenFields)

    - #### dataAsString

          java.lang.String dataAsString(boolean showFieldNames,
                                        boolean showHiddenFields,
                                        boolean showPasswords)

    - #### isOneCellTable

          boolean isOneCellTable()

      Returns true if table has exactly one record and one field.

    - #### conform

          boolean conform(TableFormat rf)

    - #### conformMessage

          java.lang.String conformMessage(TableFormat rf)

    - #### selectAll

          java.util.List<DataRecord> selectAll(DataTableQuery query)

    - #### select

          DataRecord select(DataTableQuery query)

    - #### select

          DataRecord select(java.lang.String field,
                            java.lang.Object value)

    - #### findIndex

          java.lang.Integer findIndex(DataTableQuery query)

    - #### findIndex

          java.lang.Integer findIndex(java.lang.String field,
                                      java.lang.Object value)

    - #### findIndex

          java.lang.Integer findIndex(DataRecord record)

      Returns the index of the first occurrence of `record` in this Data Table, or null if this Data Table does not contain the specified record.

    - #### sort

          void sort(java.lang.String field,
                    boolean ascending)

    - #### sort

          void sort(DataTableSorter sorter)

    - #### sort

          void sort(java.util.Comparator<DataRecord> comparator)

    - #### rec

          DataRecord rec()

      Returns first record of the table.

    - #### get

          java.lang.Object get()

      Returns value of first field in first record of the table.

    - #### splitFormat

          void splitFormat()

    - #### joinFormats

          void joinFormats()

    - #### iterator

          java.util.Iterator<DataRecord> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<DataRecord>`

    - #### iterator

          java.util.Iterator<DataRecord> iterator(int index)

    - #### clone

          DataTable clone()

    - #### compareTo

          int compareTo(DataTable other)

    - #### append

          void append(DataTable src)

    - #### makeImmutable

          DataTable makeImmutable()

    - #### cloneIfImmutable

          DataTable cloneIfImmutable()

    - #### isImmutable

          boolean isImmutable()

    - #### isSimple

          boolean isSimple()

    - #### close

          void close()

    - #### stream

          java.util.stream.Stream<DataRecord> stream()