Class AbstractScalarTokenSequence

    • 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 capacity
        length - 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 interface ScalarTokenSequence
        Returns:
        whether all elements are null.
      • 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.
      • 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 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
      • 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​(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​(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
      • 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