Class StringVector

All Implemented Interfaces:
Serializable, ValueVector

public class StringVector extends ObjectVector<String>
A string vector.
See Also:
  • Constructor Details

    • StringVector

      public StringVector(String name, String[] vector)
      Constructor.
      Parameters:
      name - the name of vector.
      vector - the elements of vector.
    • StringVector

      public StringVector(StructField field, String[] vector)
      Constructor.
      Parameters:
      field - the struct field of vector.
      vector - the elements of vector.
  • Method Details

    • nominal

      public NominalScale nominal()
      Returns a nominal scale of measure based on distinct values in the vector.
      Returns:
      the nominal scale.
    • factorize

      public ValueVector factorize(CategoricalMeasure scale)
      Converts strings to discrete measured values. Depending on how many levels in the nominal scale, the type of returned vector may be byte, short or integer. The missing values/nulls will be converted to -1.
      Parameters:
      scale - the categorical measure.
      Returns:
      the factorized vector.
    • get

      public StringVector get(Index index)
      Description copied from interface: ValueVector
      Returns a new vector with selected entries.
      Specified by:
      get in interface ValueVector
      Overrides:
      get in class ObjectVector<String>
      Parameters:
      index - the index of selected entries.
      Returns:
      the new vector of selected entries.
    • withName

      public StringVector withName(String name)
      Description copied from interface: ValueVector
      Returns the vector with the new name.
      Specified by:
      withName in interface ValueVector
      Overrides:
      withName in class ObjectVector<String>
      Parameters:
      name - the new name.
      Returns:
      the vector with the new name.
    • intStream

      public IntStream intStream()
      Description copied from interface: ValueVector
      Returns an IntStream consisting of the elements of this vector, converted to integer.
      Returns:
      an IntStream consisting of the elements of this vector.
    • longStream

      public LongStream longStream()
      Description copied from interface: ValueVector
      Returns a LongStream consisting of the elements of this vector, converted to long.
      Returns:
      a LongStream consisting of the elements of this vector.
    • doubleStream

      public DoubleStream doubleStream()
      Description copied from interface: ValueVector
      Returns a DoubleStream consisting of the elements of this vector, converted to double.
      Returns:
      a DoubleStream consisting of the elements of this vector.
    • getBoolean

      public boolean getBoolean(int i)
      Description copied from interface: ValueVector
      Returns the boolean value at position i.
      Specified by:
      getBoolean in interface ValueVector
      Overrides:
      getBoolean in class ObjectVector<String>
      Parameters:
      i - the index.
      Returns:
      the value.
    • getChar

      public char getChar(int i)
      Description copied from interface: ValueVector
      Returns the character value at position i.
      Specified by:
      getChar in interface ValueVector
      Overrides:
      getChar in class ObjectVector<String>
      Parameters:
      i - the index.
      Returns:
      the value.
    • getByte

      public byte getByte(int i)
      Description copied from interface: ValueVector
      Returns the byte value at position i.
      Specified by:
      getByte in interface ValueVector
      Overrides:
      getByte in class ObjectVector<String>
      Parameters:
      i - the index.
      Returns:
      the value.
    • getShort

      public short getShort(int i)
      Description copied from interface: ValueVector
      Returns the short value at position i.
      Specified by:
      getShort in interface ValueVector
      Overrides:
      getShort in class ObjectVector<String>
      Parameters:
      i - the index.
      Returns:
      the value.
    • getInt

      public int getInt(int i)
      Description copied from interface: ValueVector
      Returns the integer value at position i.
      Specified by:
      getInt in interface ValueVector
      Overrides:
      getInt in class ObjectVector<String>
      Parameters:
      i - the index.
      Returns:
      the value.
    • getLong

      public long getLong(int i)
      Description copied from interface: ValueVector
      Returns the long value at position i.
      Specified by:
      getLong in interface ValueVector
      Overrides:
      getLong in class ObjectVector<String>
      Parameters:
      i - the index.
      Returns:
      the value.
    • getFloat

      public float getFloat(int i)
      Description copied from interface: ValueVector
      Returns the float value at position i.
      Specified by:
      getFloat in interface ValueVector
      Overrides:
      getFloat in class ObjectVector<String>
      Parameters:
      i - the index.
      Returns:
      the value.
    • getDouble

      public double getDouble(int i)
      Description copied from interface: ValueVector
      Returns the double value at position i.
      Specified by:
      getDouble in interface ValueVector
      Overrides:
      getDouble in class ObjectVector<String>
      Parameters:
      i - the index.
      Returns:
      the value.