Interface Header<T>
- Type Parameters:
T- The type managed by theHeader.
- All Superinterfaces:
Clearable, Collection<Column<? extends T>>, ColumnRow<T, Column<? extends T>>, HeaderRow<T, Column<? extends T>>, Iterable<Column<? extends T>>, Keys<String, Column<? extends T>>, Keys.MutableKeys<String, Column<? extends T>>, List<Column<? extends T>>, SequencedCollection<Column<? extends T>>
- All Known Implementing Classes:
HeaderImpl, StringHeader
A list of
Column instances, for example describing the elements of a
CSV file (visually speaking the of the CSV file's header line), is
represented by the Header. The
Header preserves an order for a list of
Column instances. A
Header provides the semantics for related
Row instances.
The Keys.keySet() method must provide a predictable order as ensured by
the LinkedHashSet class as of the ordered nature of the
Header.
-
Nested Class Summary
Nested classes/interfaces inherited from interface Keys
Keys.MutableKeys<K,V>, Keys.MutableValues<K, V> -
Method Summary
Modifier and TypeMethodDescriptiondefault Tdefault booleanisEqualWith(Record<?> aRecord) default booleanisEqualWith(Row<?> aRow) default booleanisSubsetOf(Record<?> aRecord) default booleanisSubsetOf(Row<?> aRow) default booleanisSupersetOf(Record<?> aRecord) default booleanisSupersetOf(Row<?> aRow) default <REC> Record<REC> toIntersection(Record<REC> aRecord) default String[]toKeys()Returns the keys of theHeaderin the intended order.default <REC> Record<REC> toType()default T[]Returns an array of the values stored by theRecordin the order as defined by the header.Methods inherited from interface Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface ColumnRow
containsValue, withColumnsMethods inherited from interface HeaderRow
fromStorageString, fromStorageString, fromStorageStringRecord, fromStorageStringRow, fromStorageStrings, fromStorageStrings, fromStorageStringsRecord, fromStorageStringsRow, indexOf, toPrintable, toPrintable, toPrintableRecord, toPrintableRow, toRecord, toRecord, toRecordIgnoreType, toRow, toRowIgnoreType, toStorageString, toStorageString, toStorageStringRecord, toStorageStringRow, toStorageStrings, toStorageStrings, toStorageStringsRecord, toStorageStringsRowMethods inherited from interface Keys.MutableKeys
deleteMethods inherited from interface List
add, add, addAll, addAll, addFirst, addLast, clear, contains, containsAll, equals, get, getFirst, getLast, hashCode, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, set, size, sort, spliterator, subList, toArray, toArray
-
Method Details
-
get
This method retrieves a value from theRowby taking the index of the according column of thisHeaderof the given key (the one with the given key) and returns that value. This is possible as the values in the row and in the header have an order. This method is a convenience delegate toRow.get(Header, String).- Parameters:
aRow- TheRowcontaining the value of the given key.aKey- The key for which to retrieve the value.- Returns:
- The value in the row representing the key in the header.
- Throws:
HeaderMismatchException- Thrown in case there is a mismatch between the givenHeaderMismatchExceptionand theRow, i.e. the index for the given key in the header may be out of index of the given row or the given key does not exist in theHeader.ColumnMismatchException- in case the type defined in the column for that key does not match the type in the row identified by the given key.
-
toKeys
-
toValues
-
toType
-
isSubsetOf
Tests whether the given potential subset ofHeaderelements is matching theRecord's elements in terms of matching the same relevant attributes of theColumninstances with the elements in theRecord. I.e. allColumninstances in the subset must match the elements, even if this has more elements. The test also fails (returns false) in case the types of the instances in theRecorddo not match the according key's type in theHeaderColumninstance or vice versa.- Parameters:
aRecord- TheRecordto be used for testing.- Returns:
- true in case all columns in the subset match this' elements or the argument passed was null.
-
isEqualWith
Tests whether the given potential equal set ofHeaderis matching theRecord's elements in terms of matching the same relevant attributes of the columns with the elements in theRecord. I.e. allHeaderin the subset must match the elements, and the number ofHeadermust be the same as the number of elements in theRecord. The test also fails (returns false) in case the types of the instances in theRecorddo not match the according key's type in theHeaderColumninstance or vice versa.- Parameters:
aRecord- TheRecordto be used for testing.- Returns:
- True in case all columns in the subset match this' elements and the number of elements matches the number of columns or the argument passed was null.
-
isSupersetOf
Tests whether theRecord's elements is matching the given potential superset ofHeaderelements in terms of matching the same relevant attributes of the columns with the elements in theRecord. I.e. all elements in theRecordmust match theHeaderin the superset, even if the superset has more elements. The test also fails (returns false) in case the types of the instances in theRecorddo not match the according key's type in theHeaderColumninstance or vice versa.- Parameters:
aRecord- TheRecordto be used for testing.- Returns:
- True in case all elements in this instance match the columns in the superset or the argument passed was null.
-
isSubsetOf
Tests whether thisHeaderis a subset of theRow's elements in terms of matching the same relevant attributes of theHeaderwith the elements in theRow. I.e. allColumninstances in the subset must match the elements, even if this has more elements. The test also fails (returns false) in case the types of the instances in theRowdo not match the according key's type in theHeaderColumninstance or vice versa.- Parameters:
aRow- TheRowto be used for testing.- Returns:
- true in case all columns in the subset match this' elements or the argument passed was null.
-
isEqualWith
Tests whether the given potentialHeaderequal set is matching theRow's elements in terms of matching the same relevant attributes of theHeaderwith the elements in theRow. I.e. allColumninstances in the subset must match the elements, and the number of columns must be the same as the number of elements in theRow. The test also fails (returns false) in case the types of the instances in theRowdo not match the according key's type in theHeaderColumninstance or vice versa.- Parameters:
aRow- TheRowto be used for testing.- Returns:
- True in case all columns in the subset match this' elements and the number of elements matches the number of columns or the argument passed was null.
-
isSupersetOf
Tests whether theRow's elements is matching the given potentialHeadersuperset in terms of matching the same relevant attributes of theHeaderwith the elements in theRow. I.e. all elements in theRowmust match theColumninstances in the superset, even if the superset has more elements. The test also fails (returns false) in case the types of the instances in theRowdo not match the according key's type in theHeaderColumninstance or vice versa.- Parameters:
aRow- TheRowto be used for testing.- Returns:
- True in case all elements in this instance match the columns in the superset or the argument passed was null.
-
toIntersection
-
toSubset
-