Class ArrayVector<E extends Number>

Type Parameters:
E - the base type of elements in the vector.
All Implemented Interfaces:
Serializable, Iterable<Number>, Collection<Number>, List<Number>, RandomAccess, CheckedContainer<E>
Direct Known Subclasses:
ArrayVector.ASCII, ArrayVector.Bytes, ArrayVector.Doubles, ArrayVector.Floats, ArrayVector.Integers, ArrayVector.Longs, ArrayVector.Raw, ArrayVector.Shorts, PackedVector

abstract class ArrayVector<E extends Number> extends Vector implements CheckedContainer<E>, Serializable
A vector backed by an array of a primitive type. This class does not copy the array, so changes in the underlying array is reflected in this vector and vice-versa.
Since:
0.8
Version:
1.2
  • Field Details

    • serialVersionUID

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

    • ArrayVector

      ArrayVector()
      For sub-classes constructor.
  • Method Details

    • newInstance

      static Vector newInstance(Object array, boolean isUnsigned) throws IllegalArgumentException
      Creates a new instance.
      Throws:
      IllegalArgumentException - if the type of the given object is not recognized by the method.
    • compress

      static Vector compress(Vector source, long min, long max)
      Returns a vector with the same data than the given vector but encoded in a more compact way, or null if this method cannot do better than the given Vector instance. This method shall be invoked only for vector of integer values (this is not verified).
    • compress

      static Vector compress(Vector source, double tolerance)
      Returns a vector with the same data than the given vector but encoded in a more compact way, or null if this method cannot do better than the given Vector instance. This method shall be invoked only for vector of floating point values (this is not verified).
    • isNaN

      public boolean isNaN(int index)
      Default implementation for the convenience of wrapper of integer types.
      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.
    • verifyType

      void verifyType(Number value, byte expected)
      Verifies that the given value can be casted to the expected type. The expected type must be one of the Numbers constants.