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
ATokenSequencecontaining scalar typed tokens. The scalar token types are enumerated inTokenTypeConstant.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractScalarTokenSequence(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 voidappend(TokenSequence data)Appends all tokens in the specified sequence to this sequence.voidappend(TokenSequence data, int start, int length)Appends a subsequence of tokens in the specified sequence to this sequence.voidappend(TokenValued in)Appends the specified token value to this sequence.voidappend(TokenValued in, long count)Appends the specified token value to this sequence multiple times.voidappendNull()Append a null value to this sequence.voidappendNull(int count)Append a null value to this sequence.voidappendZero()Appends a zero value to this sequence.voidappendZero(int count)Appends the specified number of zero values to this sequence.intcapacity()Gets the maximum capacity of the sequence.intcompareElement(int index, TokenValued value)Compares the value of the specified token to the token at which the given port is positioned.intcompareElements(int lhsIndex, int rhsIndex)Compares the values of the tokens at the specified positions.voidensureCanonical()Ensures that the internal representation is in a canonical form such that it can be read safely by multiple threads.ElementComparatorgetElementComparator(TokenOrder sortOrder)Gets anElementComparatorfor this sequence using the specified ordering.longgetModificationCount()Returns the current modification count.inthashCode(int index)Gets the hash code for the token at the specified position.booleanisNull()Returns whether all elements are null.booleanisNull(int i)Indicates whether the specified token has a null value.voidmap(int[] sortOrder)Remaps the sequence according to the specified ordering.intremaining()Gets the remaining capacity of the sequence.voidreset()Removes all elements from the sequence.intsize()Gets the length of the sequence.StringtoString()StringtoString(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:ScalarTokenSequenceReturns whether all elements are null.- Specified by:
isNullin interfaceScalarTokenSequence- Returns:
- whether all elements are null.
-
getModificationCount
public final long getModificationCount()
Description copied from interface:MutableScalarTokenSequenceReturns the current modification count. Modification count must be strictly increasing.- Specified by:
getModificationCountin interfaceMutableScalarTokenSequence- Returns:
- the current change sequence number
-
size
public final int size()
Description copied from interface:TokenSequenceGets the length of the sequence.- Specified by:
sizein interfaceTokenSequence- Returns:
- the number of tokens in the sequence.
-
isNull
public final boolean isNull(int i)
Description copied from interface:TokenSequenceIndicates whether the specified token has a null value.- Specified by:
isNullin interfaceTokenSequence- Parameters:
i- the index of the token- Returns:
trueif the element is null,falseotherwise
-
compareElement
public final int compareElement(int index, TokenValued value)Description copied from interface:TokenSequenceCompares the value of the specified token to the token at which the given port is positioned.- 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
public final 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
public final ElementComparator getElementComparator(TokenOrder sortOrder)
Description copied from interface:TokenSequenceGets anElementComparatorfor this sequence using the specified ordering.- Specified by:
getElementComparatorin interfaceTokenSequence- Parameters:
sortOrder- the desired ordering- Returns:
- an
ElementComparatorfor this sequence.
-
hashCode
public final int hashCode(int index)
Description copied from interface:TokenSequenceGets the hash code for the token at the specified position.- Specified by:
hashCodein 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:TokenSequenceGets the string representation of the token at the specified position.- Specified by:
toStringin interfaceTokenSequence- Parameters:
index- the index of the token- Returns:
- the string representation of the token
-
ensureCanonical
public final void ensureCanonical()
Description copied from interface:MutableScalarTokenSequenceEnsures that the internal representation is in a canonical form such that it can be read safely by multiple threads.- Specified by:
ensureCanonicalin 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:
appendNullin interfaceMutableTokenSequence
-
appendNull
public void appendNull(int count)
Append a null value to this sequence.- Specified by:
appendNullin interfaceMutableTokenSequence- Parameters:
count- the number of null values to append
-
appendZero
public final void appendZero()
Description copied from interface:MutableTokenSequenceAppends a zero value to this sequence.- Specified by:
appendZeroin interfaceMutableTokenSequence
-
appendZero
public final void appendZero(int count)
Description copied from interface:MutableTokenSequenceAppends the specified number of zero values to this sequence.- Specified by:
appendZeroin interfaceMutableTokenSequence- Parameters:
count- the number of zero values to append
-
reset
public void reset()
Description copied from interface:MutableTokenSequenceRemoves all elements from the sequence.- Specified by:
resetin interfaceMutableTokenSequence
-
append
public void append(TokenValued in)
Description copied from interface:TokenAppendableAppends 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:
appendin interfaceTokenAppendable- Parameters:
in- the token value to append
-
append
public void append(TokenValued in, long count)
Description copied from interface:TokenAppendableAppends 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:
appendin interfaceTokenAppendable- Parameters:
in- the token value to appendcount- the number of copies to append
-
append
public void append(TokenSequence data)
Description copied from interface:TokenAppendableAppends 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:
appendin interfaceTokenAppendable- Parameters:
data- the sequence to append
-
append
public void append(TokenSequence data, int start, int length)
Description copied from interface:TokenAppendableAppends 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:
appendin 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
-
-