public class CompositeTokenSequence extends Object
There is no guarantee of immutability for these objects.
While no mutators are provided on CompositeTokenSequence
, the
underlying columns may refer to mutable objects.
Modifier and Type | Class and Description |
---|---|
protected static class |
RecordTokenSequenceBase.CompositeComparator |
Constructor and Description |
---|
CompositeTokenSequence(RecordTokenType type,
ScalarTokenSequence[] columns)
Create a new sequence backed with the specified scalar token
sequences containing the field values for each record element.
|
Modifier and Type | Method and Description |
---|---|
int |
columns()
Gets the number of columns in a record.
|
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.
|
int |
compareElements(int lhsIndex,
int rhsIndex)
Compares the values of the tokens at the specified
positions.
|
boolean |
containsNull(int index)
Determines if any column in the specified row is null valued.
|
ScalarTokenSequence |
getColumn(int i)
Gets the
ScalarTokenSequence containing the specified
column data. |
ElementComparator |
getElementComparator(SortKey... sortKeys)
Gets an
ElementComparator for the token array for the
fields with the given names and the given token orders. |
ElementComparator |
getElementComparator(TokenOrder... sortOrder)
Gets an ElementComparator for the token array and given ordering.
|
ElementComparator |
getElementComparator(TokenOrder sortOrder)
Gets an ElementComparator for the token array and given ordering.
|
RecordValued |
getToken(int index)
Gets the value at the specified position.
|
RecordTokenType |
getType()
Gets the type of data tokens handled by the implementor.
|
int |
hashCode(int index)
Gets the hash code for the token at the specified position.
|
boolean |
isNull(int index)
Indicates whether the specified token has a null value.
|
RecordValuedIterator |
newValueIterator()
Creates an iterator over the non-null values of this sequence.
|
int |
size()
Gets the length of the sequence.
|
String |
toString() |
String |
toString(int index)
Gets the string representation of the token at the specified
position.
|
public CompositeTokenSequence(RecordTokenType type, ScalarTokenSequence[] columns)
type
- the record schemacolumns
- the ScalarTokenArray
objects containing
the column data.IllegalArgumentException
- if not all columns are of the
same lengthpublic final int columns()
RecordTokenSequence
columns
in interface RecordTokenSequence
public ScalarTokenSequence getColumn(int i)
RecordTokenSequence
ScalarTokenSequence
containing the specified
column data.getColumn
in interface RecordTokenSequence
i
- the column sequence to get. Indexes are zero-based
and ordered identically to the fields in the
RecordTokenType
for this array.ScalarTokenSequence
containing the token
values for the column.public final int size()
TokenSequence
size
in interface TokenSequence
public final RecordTokenType getType()
TokenTyped
getType
in interface RecordTyped
getType
in interface TokenTyped
public final boolean isNull(int index)
TokenSequence
isNull
in interface TokenSequence
index
- the index of the tokentrue
if the element is null,
false
otherwisepublic final boolean containsNull(int index)
RecordTokenSequence
containsNull
in interface RecordTokenSequence
index
- the row to checktrue
if at least one column is null
valued, false
if none arepublic final int compareElement(int index, TokenValued value)
RecordTokenSequence
The source sequence must be composite and have the same number of columns as this sequence. All columns must be of comparable types.
compareElement
in interface RecordTokenSequence
compareElement
in interface TokenSequence
index
- the index of the tokenvalue
- the input port positioned at the token for
comparison0
if the values are equal,
1
if the sequence token value is greater,
-1
if the sequence token value is lesser.
A null value is greater than any other non-null;
two null values compare as equal.public final int compareElements(int lhsIndex, int rhsIndex)
TokenSequence
compareElements
in interface RecordTokenSequence
compareElements
in interface TokenSequence
lhsIndex
- the index of the left-hand elementrhsIndex
- the index of the right-hand element0
if the values are equal,
1
if the left hand value is greater,
-1
if the left hand value is lesser.
A null value is greater than any other non-null;
two null values compare as equal.public final ElementComparator getElementComparator(TokenOrder sortOrder)
RecordTokenSequence
getElementComparator
in interface RecordTokenSequence
getElementComparator
in interface TokenSequence
sortOrder
- the desired orderingpublic final ElementComparator getElementComparator(TokenOrder... sortOrder)
RecordTokenSequence
getElementComparator
in interface RecordTokenSequence
sortOrder
- the desired orderingElementComparator
on this sequencepublic final ElementComparator getElementComparator(SortKey... sortKeys)
RecordTokenSequence
ElementComparator
for the token array for the
fields with the given names and the given token orders.getElementComparator
in interface RecordTokenSequence
sortKeys
- list of key fields and sort order for eachElementComparator
on this sequencepublic final RecordValued getToken(int index)
TokenSequence
getToken
in interface RecordTokenSequence
getToken
in interface TokenSequence
index
- the index of the tokenpublic final int hashCode(int index)
TokenSequence
hashCode
in interface TokenSequence
index
- the index of the tokenpublic final String toString(int index)
TokenSequence
toString
in interface TokenSequence
index
- the index of the tokenpublic RecordValuedIterator newValueIterator()
TokenSequence
newValueIterator
in interface RecordTokenSequence
newValueIterator
in interface TokenSequence
Copyright © 2020 Actian Corporation. All rights reserved.