Class SequenceVector.Longs

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

static final class SequenceVector.Longs extends SequenceVector
A vector which is a sequence of increasing or decreasing long values.
  • Field Details

    • serialVersionUID

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

      private final long first
      The value at index 0.
    • increment

      private final long increment
      The difference between the values at two adjacent indexes. May be positive, negative or zero.
  • Constructor Details

    • Longs

      Longs(Class<? extends Number> type, Number first, Number increment, int length)
      Creates a sequence of numbers in a given range of values using the given increment.
      Parameters:
      type - the type of elements in the sequence.
      first - the first value, inclusive.
      increment - the difference between the values at two adjacent indexes.
      length - the length of the vector.
  • Method Details

    • createSubSampling

      Vector createSubSampling(int offset, int step, int n)
      Creates a new sequence for a subrange of this vector.
      Overrides:
      createSubSampling in class Vector
    • isInteger

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

      public boolean isNaN(int index)
      Returns false since this vector never return NaN values.
      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.
    • doubleValue

      public double doubleValue(int index)
      Computes 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)
      Computes 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)
      Computes 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.
    • stringValue

      public String stringValue(int index)
      Returns the string representation of the value 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)
      Computes 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).
    • increment

      public Number increment(double tolerance)
      Returns the increment between all consecutive values
      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.
      Overrides:
      range in class Vector
      Returns:
      minimal and maximal values found in this vector.