Module datarush.library
Class AbstractScalarTokenSequence
- java.lang.Object
-
- com.pervasive.datarush.sequences.scalar.AbstractScalarTokenSequence
-
- All Implemented Interfaces:
MutableTokenSequence
,MutableScalarTokenSequence
,ScalarTokenAppendable
,ScalarTokenSequence
,TokenAppendable
,TokenSequence
,ScalarTyped
,TokenTyped
- Direct Known Subclasses:
BinaryTokenList
,BooleanTokenList
,CharTokenList
,DateTokenList
,DoubleTokenList
,DurationTokenList
,FloatTokenList
,IntTokenList
,Ip4AddressTokenList
,Ip6AddressTokenList
,LongTokenList
,MoneyTokenList
,NumericTokenList
,ObjectTokenList
,PeriodTokenList
,StringTokenList
,TimestampTokenList
,TimeTokenList
public abstract class AbstractScalarTokenSequence extends Object implements MutableScalarTokenSequence
ATokenSequence
containing scalar typed tokens. The scalar token types are enumerated inTokenTypeConstant
.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractScalarTokenSequence(boolean[] nullFlags, int capacity, int length)
Create a ScalarTokenSequence backed with the specified data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
append(TokenSequence data)
Appends all tokens in the specified sequence to this sequence.void
append(TokenSequence data, int start, int length)
Appends a subsequence of tokens in the specified sequence to this sequence.void
append(TokenValued in)
Appends the specified token value to this sequence.void
append(TokenValued in, long count)
Appends the specified token value to this sequence multiple times.void
appendNull()
Append a null value to this sequence.void
appendNull(int count)
Append a null value to this sequence.void
appendZero()
Appends a zero value to this sequence.void
appendZero(int count)
Appends the specified number of zero values to this sequence.int
capacity()
Gets the maximum capacity of the sequence.int
compareElement(int index, TokenValued value)
Compares the value of the specified token to the token at which the given port is positioned.int
compareElements(int lhsIndex, int rhsIndex)
Compares the values of the tokens at the specified positions.void
ensureCanonical()
Ensures that the internal representation is in a canonical form such that it can be read safely by multiple threads.ElementComparator
getElementComparator(TokenOrder sortOrder)
Gets anElementComparator
for this sequence using the specified ordering.long
getModificationCount()
Returns the current modification count.int
hashCode(int index)
Gets the hash code for the token at the specified position.boolean
isNull()
Returns whether all elements are null.boolean
isNull(int i)
Indicates whether the specified token has a null value.void
map(int[] sortOrder)
Remaps the sequence according to the specified ordering.int
remaining()
Gets the remaining capacity of the sequence.void
reset()
Removes all elements from the 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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.pervasive.datarush.sequences.scalar.MutableScalarTokenSequence
getTokenSetter
-
Methods inherited from interface com.pervasive.datarush.sequences.MutableTokenSequence
fillValue, setNull, setNull, setValue, setValues, setZero, setZero
-
Methods inherited from interface com.pervasive.datarush.sequences.scalar.ScalarTokenSequence
getToken, getType, isZero, newValueIterator
-
-
-
-
Constructor Detail
-
AbstractScalarTokenSequence
protected AbstractScalarTokenSequence(boolean[] nullFlags, int capacity, int length)
Create a ScalarTokenSequence backed with the specified data.- Parameters:
nullFlags
- the null flags for array elements;capacity
- the capacitylength
- the number of elements in the array
-
-
Method Detail
-
isNull
public boolean isNull()
Description copied from interface:ScalarTokenSequence
Returns whether all elements are null.- Specified by:
isNull
in interfaceScalarTokenSequence
- Returns:
- whether all elements are null.
-
getModificationCount
public final long getModificationCount()
Description copied from interface:MutableScalarTokenSequence
Returns the current modification count. Modification count must be strictly increasing.- Specified by:
getModificationCount
in interfaceMutableScalarTokenSequence
- Returns:
- the current change sequence number
-
size
public final int size()
Description copied from interface:TokenSequence
Gets the length of the sequence.- Specified by:
size
in interfaceTokenSequence
- Returns:
- the number of tokens in the sequence.
-
isNull
public final boolean isNull(int i)
Description copied from interface:TokenSequence
Indicates whether the specified token has a null value.- Specified by:
isNull
in interfaceTokenSequence
- Parameters:
i
- the index of the token- Returns:
true
if the element is null,false
otherwise
-
compareElement
public final int compareElement(int index, TokenValued value)
Description copied from interface:TokenSequence
Compares the value of the specified token to the token at which the given port is positioned.- Specified by:
compareElement
in interfaceTokenSequence
- Parameters:
index
- the index of the tokenvalue
- the input port positioned at the token for comparison- Returns:
0
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.
-
compareElements
public final int compareElements(int lhsIndex, int rhsIndex)
Description copied from interface:TokenSequence
Compares the values of the tokens at the specified positions.- Specified by:
compareElements
in interfaceTokenSequence
- Parameters:
lhsIndex
- the index of the left-hand elementrhsIndex
- the index of the right-hand element- Returns:
0
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.
-
getElementComparator
public final ElementComparator getElementComparator(TokenOrder sortOrder)
Description copied from interface:TokenSequence
Gets anElementComparator
for this sequence using the specified ordering.- Specified by:
getElementComparator
in interfaceTokenSequence
- Parameters:
sortOrder
- the desired ordering- Returns:
- an
ElementComparator
for this sequence.
-
hashCode
public final int hashCode(int index)
Description copied from interface:TokenSequence
Gets the hash code for the token at the specified position.- Specified by:
hashCode
in interfaceTokenSequence
- Parameters:
index
- the index of the token- Returns:
- the hash code for the token
-
toString
public final String toString(int index)
Description copied from interface:TokenSequence
Gets the string representation of the token at the specified position.- Specified by:
toString
in interfaceTokenSequence
- Parameters:
index
- the index of the token- Returns:
- the string representation of the token
-
ensureCanonical
public final void ensureCanonical()
Description copied from interface:MutableScalarTokenSequence
Ensures that the internal representation is in a canonical form such that it can be read safely by multiple threads.- Specified by:
ensureCanonical
in interfaceMutableScalarTokenSequence
-
remaining
public final int remaining()
Gets the remaining capacity of the sequence.- Returns:
- the number of tokens which can be appended.
-
capacity
public final int capacity()
Gets the maximum capacity of the sequence.- Returns:
- the maximum number of tokens which can be in the sequence
-
appendNull
public void appendNull()
Append a null value to this sequence.- Specified by:
appendNull
in interfaceMutableTokenSequence
-
appendNull
public void appendNull(int count)
Append a null value to this sequence.- Specified by:
appendNull
in interfaceMutableTokenSequence
- Parameters:
count
- the number of null values to append
-
appendZero
public final void appendZero()
Description copied from interface:MutableTokenSequence
Appends a zero value to this sequence.- Specified by:
appendZero
in interfaceMutableTokenSequence
-
appendZero
public final void appendZero(int count)
Description copied from interface:MutableTokenSequence
Appends the specified number of zero values to this sequence.- Specified by:
appendZero
in interfaceMutableTokenSequence
- Parameters:
count
- the number of zero values to append
-
reset
public void reset()
Description copied from interface:MutableTokenSequence
Removes all elements from the sequence.- Specified by:
reset
in interfaceMutableTokenSequence
-
append
public void append(TokenValued in)
Description copied from interface:TokenAppendable
Appends the specified token value to this sequence.The data types of the sequence and the value must be compatible. If the types are not identical, appropriate coercion will be attempted.
- Specified by:
append
in interfaceTokenAppendable
- Parameters:
in
- the token value to append
-
append
public void append(TokenValued in, long count)
Description copied from interface:TokenAppendable
Appends the specified token value to this sequence multiple times.The data types of the sequence and the value must be compatible. If the types are not identical, appropriate coercion will be attempted.
- Specified by:
append
in interfaceTokenAppendable
- Parameters:
in
- the token value to appendcount
- the number of copies to append
-
append
public void append(TokenSequence data)
Description copied from interface:TokenAppendable
Appends all tokens in the specified sequence to this sequence.The data types of the sequences must be compatible. If not identical, appropriate coercion will be attempted.
- Specified by:
append
in interfaceTokenAppendable
- Parameters:
data
- the sequence to append
-
append
public void append(TokenSequence data, int start, int length)
Description copied from interface:TokenAppendable
Appends a subsequence of tokens in the specified sequence to this sequence.The data types of the sequences must be compatible. If not identical, appropriate coercion will be attempted.
- Specified by:
append
in interfaceTokenAppendable
- Parameters:
data
- the sequence containing tokens to appendstart
- the starting index of the subsequence in the sourcelength
- the length of the subsequence
-
map
public final void map(int[] sortOrder)
Remaps the sequence according to the specified ordering.- Parameters:
sortOrder
- the reording of the sequence
-
-