Interface BaseVector<T,TS,S extends BaseStream<TS,S>>

Type Parameters:
T - the type of vector elements.
TS - the type of stream elements.
S - the type of stream.
All Superinterfaces:
Serializable
All Known Subinterfaces:
BooleanVector, ByteVector, CharVector, DoubleVector, FloatVector, IntVector, LongVector, NumberVector, ShortVector, StringVector, Vector<T>

public interface BaseVector<T,TS,S extends BaseStream<TS,S>> extends Serializable
Base interface for immutable named vectors, which are sequences of elements supporting random access and sequential stream operations.
  • Method Summary

    Modifier and Type
    Method
    Description
    default T
    apply(int i)
    Returns the value at position i, which may be null.
    default BaseVector<T,TS,S>
    apply(int... index)
    Returns a new vector with selected entries.
    Returns the array that backs this vector.
    default StructField
    Returns a struct field corresponding to this vector.
    get(int i)
    Returns the value at position i, which may be null.
    get(int... index)
    Returns a new vector with selected entries.
    boolean
    getBoolean(int i)
    Returns the boolean value at position i.
    byte
    getByte(int i)
    Returns the byte value at position i.
    char
    getChar(int i)
    Returns the character value at position i.
    double
    getDouble(int i)
    Returns the double value at position i.
    float
    getFloat(int i)
    Returns the float value at position i.
    int
    getInt(int i)
    Returns the integer value at position i.
    long
    getLong(int i)
    Returns the long value at position i.
    short
    getShort(int i)
    Returns the short value at position i.
    default Measure
    Returns the (optional) level of measurements.
    Returns the (optional) name of vector.
    int
    Returns the number of elements in the vector.
    Returns a stream of vector elements.
    default double[]
    Returns a double array of this vector.
    default double[]
    toDoubleArray(double[] a)
    Copies the vector value as double to the given array.
    default int[]
    Returns an int array of this vector.
    default int[]
    toIntArray(int[] a)
    Copies the vector value as int to the given array.
    default String[]
    Returns a string array of this vector.
    default String[]
    Copies the vector value as string to the given array.
    Returns the data type of elements.
  • Method Details

    • name

      String name()
      Returns the (optional) name of vector.
      Returns:
      the (optional) name of vector.
    • type

      DataType type()
      Returns the data type of elements.
      Returns:
      the data type of elements.
    • measure

      default Measure measure()
      Returns the (optional) level of measurements. Only valid for number types.
      Returns:
      the (optional) level of measurements.
    • field

      default StructField field()
      Returns a struct field corresponding to this vector.
      Returns:
      the struct field.
    • size

      int size()
      Returns the number of elements in the vector.
      Returns:
      the number of elements in the vector.
    • array

      Object array()
      Returns the array that backs this vector. This is mostly for smile internal use for high performance. The application developers should not use this method.
      Returns:
      the array that backs this vector.
    • toDoubleArray

      default double[] toDoubleArray()
      Returns a double array of this vector.
      Returns:
      the double array.
    • toDoubleArray

      default double[] toDoubleArray(double[] a)
      Copies the vector value as double to the given array.
      Parameters:
      a - the array to copy into.
      Returns:
      the input array a.
    • toIntArray

      default int[] toIntArray()
      Returns an int array of this vector.
      Returns:
      the int array.
    • toIntArray

      default int[] toIntArray(int[] a)
      Copies the vector value as int to the given array.
      Parameters:
      a - the array to copy into.
      Returns:
      the input array a.
    • toStringArray

      default String[] toStringArray()
      Returns a string array of this vector.
      Returns:
      the string array.
    • toStringArray

      default String[] toStringArray(String[] a)
      Copies the vector value as string to the given array.
      Parameters:
      a - the array to copy into.
      Returns:
      the input array a.
    • get

      T get(int i)
      Returns the value at position i, which may be null.
      Parameters:
      i - the index.
      Returns:
      the value.
    • get

      BaseVector<T,TS,S> get(int... index)
      Returns a new vector with selected entries.
      Parameters:
      index - the index of selected entries.
      Returns:
      the new vector of selected entries.
    • getBoolean

      boolean getBoolean(int i)
      Returns the boolean value at position i.
      Parameters:
      i - the index.
      Returns:
      the value.
    • getChar

      char getChar(int i)
      Returns the character value at position i.
      Parameters:
      i - the index.
      Returns:
      the value.
    • getByte

      byte getByte(int i)
      Returns the byte value at position i.
      Parameters:
      i - the index.
      Returns:
      the value.
    • getShort

      short getShort(int i)
      Returns the short value at position i.
      Parameters:
      i - the index.
      Returns:
      the value.
    • getInt

      int getInt(int i)
      Returns the integer value at position i.
      Parameters:
      i - the index.
      Returns:
      the value.
    • getLong

      long getLong(int i)
      Returns the long value at position i.
      Parameters:
      i - the index.
      Returns:
      the value.
    • getFloat

      float getFloat(int i)
      Returns the float value at position i.
      Parameters:
      i - the index.
      Returns:
      the value.
    • getDouble

      double getDouble(int i)
      Returns the double value at position i.
      Parameters:
      i - the index.
      Returns:
      the value.
    • apply

      default T apply(int i)
      Returns the value at position i, which may be null.
      Parameters:
      i - the index.
      Returns:
      the value.
    • apply

      default BaseVector<T,TS,S> apply(int... index)
      Returns a new vector with selected entries.
      Parameters:
      index - the index of selected entries.
      Returns:
      the new vector of selected entries.
    • stream

      S stream()
      Returns a stream of vector elements.
      Returns:
      the stream of vector elements.