Class SequenceVector.Doubles

All Implemented Interfaces:
Serializable, Iterable<Number>, Collection<Number>, List<Number>, RandomAccess
Direct Known Subclasses:
SequenceVector.Floats
Enclosing class:
SequenceVector

static class SequenceVector.Doubles extends SequenceVector
A vector which is a sequence of increasing or decreasing double values.
  • Field Details

    • serialVersionUID

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

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

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

    • Doubles

      Doubles(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 final 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.
    • isNaN

      public final boolean isNaN(int index)
      Returns true if this vector returns 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 final 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:
    • 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 final 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 final 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.