Class ConcatenatedVector

All Implemented Interfaces:
Serializable, Iterable<Number>, Collection<Number>, List<Number>, RandomAccess, SequencedCollection<Number>

final class ConcatenatedVector extends Vector implements Serializable
A vector which is the concatenation of two other vectors.
Since:
0.8
Version:
1.1
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
    • first

      private final Vector first
      The vectors to concatenate.
    • second

      private final Vector second
      The vectors to concatenate.
    • limit

      private final int limit
      The length of the first vector.
  • Constructor Details

    • ConcatenatedVector

      public ConcatenatedVector(Vector first, Vector second)
      Creates a concatenated vector.
      Parameters:
      first - the vector for the lower indices.
      second - the vector for the higher indices.
  • Method Details

    • getElementType

      public Class<? extends Number> getElementType()
      Returns the parent type of the two vectors.
      Specified by:
      getElementType in class Vector
      Returns:
      the type of elements in this vector.
      See Also:
    • isInteger

      public boolean isInteger()
      Returns true if this vector contains only integer values.
      Overrides:
      isInteger in class Vector
      Returns:
      true if this vector contains only integer values.
    • isUnsigned

      public boolean isUnsigned()
      Returns true only if both vectors are unsigned.
      Overrides:
      isUnsigned in class Vector
      Returns:
      true if the integer values shall be interpreted as unsigned values.
    • size

      public int size()
      Returns the length of this vector.
      Specified by:
      size in interface Collection<Number>
      Specified by:
      size in interface List<Number>
      Specified by:
      size in class Vector
      Returns:
      the number of elements in this vector.
    • isEmptyOrNaN

      public boolean isEmptyOrNaN()
      Returns true if this vector is empty or contains only NaN values.
      Overrides:
      isEmptyOrNaN in class Vector
      Returns:
      whether this vector is empty or contains only NaN values.
    • isNaN

      public boolean isNaN(int index) throws IndexOutOfBoundsException
      Returns true if the value at the given index is NaN.
      Specified by:
      isNaN in class Vector
      Parameters:
      index - the index in the [0 … size-1] range.
      Returns:
      true if the value at the given index is NaN.
      Throws:
      IndexOutOfBoundsException - if the given index is out of bounds.
    • doubleValue

      public double doubleValue(int index)
      Returns the value at the given index.
      Specified by:
      doubleValue in class Vector
      Parameters:
      index - the index in the [0 … size-1] range.
      Returns:
      the value at the given index.
      See Also:
    • floatValue

      public float floatValue(int index)
      Returns the value at the given index.
      Overrides:
      floatValue in class Vector
      Parameters:
      index - the index in the [0 … size-1] range.
      Returns:
      the value at the given index.
      See Also:
    • longValue

      public long longValue(int index)
      Returns the value at the given index.
      Overrides:
      longValue in class Vector
      Parameters:
      index - the index in the [0 … size-1] range.
      Returns:
      the value at the given index.
    • intValue

      public int intValue(int index)
      Returns the value at the given index.
      Overrides:
      intValue in class Vector
      Parameters:
      index - the index in the [0 … size-1] range.
      Returns:
      the value at the given index.
    • shortValue

      public short shortValue(int index)
      Returns the value at the given index.
      Overrides:
      shortValue in class Vector
      Parameters:
      index - the index in the [0 … size-1] range.
      Returns:
      the value at the given index.
    • byteValue

      public byte byteValue(int index)
      Returns the value at the given index.
      Overrides:
      byteValue in class Vector
      Parameters:
      index - the index in the [0 … size-1] range.
      Returns:
      the value at the given index.
    • stringValue

      public String stringValue(int index)
      Returns the string representation at the given index.
      Specified by:
      stringValue in class Vector
      Parameters:
      index - the index in the [0 … size-1] range.
      Returns:
      a string representation of the value at the given index (may be null).
      See Also:
    • get

      public Number get(int index)
      Returns the value at the given index.
      Specified by:
      get in interface List<Number>
      Specified by:
      get in class Vector
      Parameters:
      index - the index in the [0 … size-1] range.
      Returns:
      the value at the given index (may be null).
      Throws:
      ArrayIndexOutOfBoundsException - if the given index is out of bounds.
    • set

      public Number set(int index, Number value)
      Sets the value at the given index.
      Specified by:
      set in interface List<Number>
      Specified by:
      set in class Vector
      Parameters:
      index - the index in the [0 … size-1] range.
      value - the value to set at the given index.
      Returns:
      the value previously stored at the given index.
    • fill

      public void fill(int fromIndex, int toIndex, Number value)
      Sets a range of elements to the given number.
      Overrides:
      fill in class Vector
      Parameters:
      fromIndex - index of the first element (inclusive) to be filled with the specified value.
      toIndex - index of the last element (exclusive) to be filled with the specified value.
      value - the value to be stored in elements of the vector.
    • increment

      public Number increment(double tolerance)
      Returns the increment between all consecutive values if this increment is constant, or null otherwise.
      Overrides:
      increment in class Vector
      Parameters:
      tolerance - the tolerance threshold for verifying if the increment is constant.
      Returns:
      the increment as a signed value, or null if the increment is not constant.
    • range

      public NumberRange<?> range()
      Computes the minimal and maximal values in this vector. This is the union of the range of the two concatenated vectors.
      Overrides:
      range in class Vector
      Returns:
      minimal and maximal values found in this vector.
    • createSubSampling

      Vector createSubSampling(int first, int step, int length)
      Delegates to the backing vectors if possible.
      Overrides:
      createSubSampling in class Vector
    • createConcatenate

      Vector createConcatenate(Vector toAppend)
      Delegates to the backing vectors since there is a chance that they override their concatenate method with a more efficient implementation.
      Overrides:
      createConcatenate in class Vector
    • createTransform

      Vector createTransform(double scale, double offset)
      Delegates to the backing vectors since there is a chance that they override their transform method with a more efficient implementation.
      Overrides:
      createTransform in class Vector