Module datarush.library
Interface RecordTokenSequence
-
- All Superinterfaces:
RecordTyped,TokenSequence,TokenTyped
- All Known Subinterfaces:
MutableRecordTokenSequence
- All Known Implementing Classes:
CompositeTokenSequence,RecordTokenList,SparseRecordTokenList
public interface RecordTokenSequence extends TokenSequence, RecordTyped
ATokenSequenceof composite tokens, representing record data. ARecordTokenSequencecan be thought of as rows of tokens or, equivalently, as a table of tokens. Tokens can be accessed column-wise, as independent sequences, or row-wise, as elements.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intcolumns()Gets the number of columns in a record.intcompareElement(int index, TokenValued value)Compares the values of the specified row of tokens to the tokens at which the given port is positioned.intcompareElements(int lhsIndex, int rhsIndex)Compares the values of the tokens at the specified positions.booleancontainsNull(int index)Determines if any column in the specified row is null valued.ScalarTokenSequencegetColumn(int index)Gets theScalarTokenSequencecontaining the specified column data.ElementComparatorgetElementComparator(SortKey... sortKeys)Gets anElementComparatorfor the token array for the fields with the given names and the given token orders.ElementComparatorgetElementComparator(TokenOrder sortOrder)Gets an ElementComparator for the token array and given ordering.ElementComparatorgetElementComparator(TokenOrder... sortOrder)Gets an ElementComparator for the token array and given ordering.RecordValuedgetToken(int index)Gets the value at the specified position.RecordValuedIteratornewValueIterator()Creates an iterator over the non-null values of this sequence.-
Methods inherited from interface com.pervasive.datarush.types.RecordTyped
getType
-
Methods inherited from interface com.pervasive.datarush.sequences.TokenSequence
hashCode, isNull, size, toString
-
-
-
-
Method Detail
-
containsNull
boolean containsNull(int index)
Determines if any column in the specified row is null valued.- Parameters:
index- the row to check- Returns:
trueif at least one column is null valued,falseif none are
-
compareElement
int compareElement(int index, TokenValued value)Compares the values of the specified row of tokens to the tokens at which the given port is positioned. Tokens in a row are compared to the token of the subport in the same position as the token's column. Comparison starts with the first column and progresses until the tokens compare unequal or there are no more columns.The source sequence must be composite and have the same number of columns as this sequence. All columns must be of comparable types.
- Specified by:
compareElementin interfaceTokenSequence- Parameters:
index- the index of the tokenvalue- the input port positioned at the token for comparison- Returns:
0if the values are equal,1if the sequence token value is greater,-1if the sequence token value is lesser. A null value is greater than any other non-null; two null values compare as equal.
-
compareElements
int compareElements(int lhsIndex, int rhsIndex)Description copied from interface:TokenSequenceCompares the values of the tokens at the specified positions.- Specified by:
compareElementsin interfaceTokenSequence- Parameters:
lhsIndex- the index of the left-hand elementrhsIndex- the index of the right-hand element- Returns:
0if the values are equal,1if the left hand value is greater,-1if the left hand value is lesser. A null value is greater than any other non-null; two null values compare as equal.
-
getElementComparator
ElementComparator getElementComparator(TokenOrder sortOrder)
Gets an ElementComparator for the token array and given ordering. All columns will by sorted in the given order.- Specified by:
getElementComparatorin interfaceTokenSequence- Parameters:
sortOrder- the desired ordering- Returns:
- an ElementComparator on the CompositeTokenArray.
-
getElementComparator
ElementComparator getElementComparator(TokenOrder... sortOrder)
Gets an ElementComparator for the token array and given ordering. Each column will be sorted by the order specified in the matching position in the ordering array. An ordering must be specified for each column.- Parameters:
sortOrder- the desired ordering- Returns:
- an
ElementComparatoron this sequence - Throws:
IllegalArgumentException- if the ordering does not contain the same number of values as there are columns.
-
getElementComparator
ElementComparator getElementComparator(SortKey... sortKeys)
Gets anElementComparatorfor the token array for the fields with the given names and the given token orders.- Parameters:
sortKeys- list of key fields and sort order for each- Returns:
- an
ElementComparatoron this sequence - Throws:
IllegalArgumentException- if the key field list does not contain the same number of values as the sort order list.
-
getToken
RecordValued getToken(int index)
Description copied from interface:TokenSequenceGets the value at the specified position.- Specified by:
getTokenin interfaceTokenSequence- Parameters:
index- the index of the token- Returns:
- the value
-
columns
int columns()
Gets the number of columns in a record.- Returns:
- the number of columns in a record.
-
getColumn
ScalarTokenSequence getColumn(int index)
Gets theScalarTokenSequencecontaining the specified column data.- Parameters:
index- the column sequence to get. Indexes are zero-based and ordered identically to the fields in theRecordTokenTypefor this array.- Returns:
- a
ScalarTokenSequencecontaining the token values for the column.
-
newValueIterator
RecordValuedIterator newValueIterator()
Description copied from interface:TokenSequenceCreates an iterator over the non-null values of this sequence. The iterator will automatically be reset as modifications are made to the sequence.- Specified by:
newValueIteratorin interfaceTokenSequence- Returns:
- an newly-created iterator over the non-null values of this sequence.
-
-