Class ObjectVector<T>
java.lang.Object
smile.data.vector.AbstractVector
smile.data.vector.ObjectVector<T>
- Type Parameters:
T- the data type of vector elements.
- All Implemented Interfaces:
Serializable, ValueVector
- Direct Known Subclasses:
NumberVector, StringVector
-
Constructor Summary
ConstructorsConstructorDescriptionObjectVector(String name, T[] vector) Constructor.ObjectVector(StructField field, T[] vector) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiondistinct()Returns the distinct values.get(int i) Returns the value at position i, which may be null.Returns a new vector with selected entries.booleangetBoolean(int i) Returns the boolean value at position i.bytegetByte(int i) Returns the byte value at position i.chargetChar(int i) Returns the character value at position i.doublegetDouble(int i) Returns the double value at position i.floatgetFloat(int i) Returns the float value at position i.intgetInt(int i) Returns the integer value at position i.longgetLong(int i) Returns the long value at position i.intReturns the number of null/missing values in this vector.shortgetShort(int i) Returns the short value at position i.booleanReturns true if the values of vector may be null.booleanisNullAt(int i) Returns true if the value at the given index is null/missing.static ObjectVector<boolean[]> Creates a boolean array vector.static ObjectVector<byte[]> Creates a byte array vector.static ObjectVector<char[]> Creates a char array vector.static ObjectVector<double[]> Creates a double array vector.static ObjectVector<float[]> Creates a float array vector.static ObjectVector<int[]> Creates an integer array vector.static ObjectVector<long[]> Creates a long integer array vector.static ObjectVector<short[]> Creates a short integer array vector.voidSets the value at position i.intsize()Returns the number of elements in the vector.stream()Returns a stream consisting of the elements of this vector.Returns the vector with the new name.Methods inherited from class AbstractVector
field, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ValueVector
anyNull, apply, apply, doubleStream, dtype, eq, ge, get, getScale, getString, gt, intStream, isin, isNull, le, longStream, lt, measure, name, ne, slice, slice, toDoubleArray, toIntArray, toLongArray, toStringArray, toStringArray, update
-
Constructor Details
-
ObjectVector
-
ObjectVector
Constructor.- Parameters:
field- the struct field of vector.vector- the elements of vector.
-
-
Method Details
-
of
Creates a boolean array vector.- Parameters:
name- the name of vector.vector- the data of vector.- Returns:
- the vector.
-
of
Creates a char array vector.- Parameters:
name- the name of vector.vector- the data of vector.- Returns:
- the vector.
-
of
Creates a byte array vector.- Parameters:
name- the name of vector.vector- the data of vector.- Returns:
- the vector.
-
of
Creates a short integer array vector.- Parameters:
name- the name of vector.vector- the data of vector.- Returns:
- the vector.
-
of
Creates an integer array vector.- Parameters:
name- the name of vector.vector- the data of vector.- Returns:
- the vector.
-
of
Creates a long integer array vector.- Parameters:
name- the name of vector.vector- the data of vector.- Returns:
- the vector.
-
of
Creates a float array vector.- Parameters:
name- the name of vector.vector- the data of vector.- Returns:
- the vector.
-
of
Creates a double array vector.- Parameters:
name- the name of vector.vector- the data of vector.- Returns:
- the vector.
-
withName
Description copied from interface:ValueVectorReturns the vector with the new name.- Parameters:
name- the new name.- Returns:
- the vector with the new name.
-
stream
Description copied from interface:ValueVectorReturns a stream consisting of the elements of this vector.- Returns:
- a stream consisting of the elements of this vector.
-
distinct
-
size
public int size()Description copied from interface:ValueVectorReturns the number of elements in the vector.- Returns:
- the number of elements in the vector.
-
set
Description copied from interface:ValueVectorSets the value at position i.- Parameters:
i- the index.value- the new value.
-
get
Description copied from interface:ValueVectorReturns a new vector with selected entries.- Parameters:
index- the index of selected entries.- Returns:
- the new vector of selected entries.
-
get
Description copied from interface:ValueVectorReturns the value at position i, which may be null.- Parameters:
i- the index.- Returns:
- the value.
-
getBoolean
public boolean getBoolean(int i) Description copied from interface:ValueVectorReturns the boolean value at position i.- Parameters:
i- the index.- Returns:
- the value.
-
getChar
public char getChar(int i) Description copied from interface:ValueVectorReturns the character value at position i.- Parameters:
i- the index.- Returns:
- the value.
-
getByte
public byte getByte(int i) Description copied from interface:ValueVectorReturns the byte value at position i.- Parameters:
i- the index.- Returns:
- the value.
-
getShort
public short getShort(int i) Description copied from interface:ValueVectorReturns the short value at position i.- Parameters:
i- the index.- Returns:
- the value.
-
getInt
public int getInt(int i) Description copied from interface:ValueVectorReturns the integer value at position i.- Parameters:
i- the index.- Returns:
- the value.
-
getLong
public long getLong(int i) Description copied from interface:ValueVectorReturns the long value at position i.- Parameters:
i- the index.- Returns:
- the value.
-
getFloat
public float getFloat(int i) Description copied from interface:ValueVectorReturns the float value at position i.- Parameters:
i- the index.- Returns:
- the value.
-
getDouble
public double getDouble(int i) Description copied from interface:ValueVectorReturns the double value at position i.- Parameters:
i- the index.- Returns:
- the value.
-
isNullable
public boolean isNullable()Description copied from interface:ValueVectorReturns true if the values of vector may be null.- Returns:
- true if the values of vector may be null.
-
isNullAt
public boolean isNullAt(int i) Description copied from interface:ValueVectorReturns true if the value at the given index is null/missing.- Parameters:
i- the index.- Returns:
- true if the value at the given index is null/missing.
-
getNullCount
public int getNullCount()Description copied from interface:ValueVectorReturns the number of null/missing values in this vector.- Returns:
- the number of null/missing values in this vector.
-