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
A TokenSequence containing scalar typed tokens. The scalar token types are enumerated in TokenTypeConstant.
  • Constructor Details

    • 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 capacity
      length - the number of elements in the array
  • Method Details

    • isNull

      public boolean isNull()
      Description copied from interface: ScalarTokenSequence
      Returns whether all elements are null.
      Specified by:
      isNull in interface ScalarTokenSequence
      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 interface MutableScalarTokenSequence
      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 interface TokenSequence
      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 interface TokenSequence
      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 interface TokenSequence
      Parameters:
      index - the index of the token
      value - 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 interface TokenSequence
      Parameters:
      lhsIndex - the index of the left-hand element
      rhsIndex - 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 an ElementComparator for this sequence using the specified ordering.
      Specified by:
      getElementComparator in interface TokenSequence
      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 interface TokenSequence
      Parameters:
      index - the index of the token
      Returns:
      the hash code for the token
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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 interface TokenSequence
      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 interface MutableScalarTokenSequence
    • 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 interface MutableTokenSequence
    • appendNull

      public void appendNull(int count)
      Append a null value to this sequence.
      Specified by:
      appendNull in interface MutableTokenSequence
      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 interface MutableTokenSequence
    • 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 interface MutableTokenSequence
      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 interface MutableTokenSequence
    • 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 interface TokenAppendable
      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 interface TokenAppendable
      Parameters:
      in - the token value to append
      count - 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 interface TokenAppendable
      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 interface TokenAppendable
      Parameters:
      data - the sequence containing tokens to append
      start - the starting index of the subsequence in the source
      length - 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