Package smile.data

Record Class Row

Record Components:
df - the data frame that the row belongs to.
index - the row index.
All Implemented Interfaces:
Serializable, Tuple

public record Row(DataFrame df, int index) extends Record implements Tuple
A row in data frame.
See Also:
  • Constructor Details

    • Row

      public Row(DataFrame df, int index)
      Creates an instance of a Row record class.
      Parameters:
      df - the value for the df record component
      index - the value for the index record component
  • Method Details

    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • schema

      public StructType schema()
      Description copied from interface: Tuple
      Returns the schema of tuple.
      Specified by:
      schema in interface Tuple
      Returns:
      the schema of tuple.
    • isNullAt

      public boolean isNullAt(int j)
      Description copied from interface: Tuple
      Checks whether the value at the given position is null.
      Specified by:
      isNullAt in interface Tuple
      Parameters:
      j - the index of field.
      Returns:
      true if the field value is null.
    • isNullAt

      public boolean isNullAt(String field)
      Description copied from interface: Tuple
      Checks whether the field value is null.
      Specified by:
      isNullAt in interface Tuple
      Parameters:
      field - the name of field.
      Returns:
      true if the field value is null.
    • get

      public Object get(int j)
      Description copied from interface: Tuple
      Returns the value at position i. The value may be null.
      Specified by:
      get in interface Tuple
      Parameters:
      j - the index of field.
      Returns:
      the field value.
    • getBoolean

      public boolean getBoolean(int j)
      Description copied from interface: Tuple
      Returns the value at position i as a primitive boolean.
      Specified by:
      getBoolean in interface Tuple
      Parameters:
      j - the index of field.
      Returns:
      the field value.
    • getChar

      public char getChar(int j)
      Description copied from interface: Tuple
      Returns the value at position i as a primitive byte.
      Specified by:
      getChar in interface Tuple
      Parameters:
      j - the index of field.
      Returns:
      the field value.
    • getByte

      public byte getByte(int j)
      Description copied from interface: Tuple
      Returns the value at position i as a primitive byte.
      Specified by:
      getByte in interface Tuple
      Parameters:
      j - the index of field.
      Returns:
      the field value.
    • getShort

      public short getShort(int j)
      Description copied from interface: Tuple
      Returns the value at position i as a primitive short.
      Specified by:
      getShort in interface Tuple
      Parameters:
      j - the index of field.
      Returns:
      the field value.
    • getInt

      public int getInt(int j)
      Description copied from interface: Tuple
      Returns the value at position i as a primitive int.
      Specified by:
      getInt in interface Tuple
      Parameters:
      j - the index of field.
      Returns:
      the field value.
    • getLong

      public long getLong(int j)
      Description copied from interface: Tuple
      Returns the value at position i as a primitive long.
      Specified by:
      getLong in interface Tuple
      Parameters:
      j - the index of field.
      Returns:
      the field value.
    • getFloat

      public float getFloat(int j)
      Description copied from interface: Tuple
      Returns the value at position i as a primitive float. Throws an exception if the type mismatches or if the value is null.
      Specified by:
      getFloat in interface Tuple
      Parameters:
      j - the index of field.
      Returns:
      the field value.
    • getDouble

      public double getDouble(int j)
      Description copied from interface: Tuple
      Returns the value at position i as a primitive double.
      Specified by:
      getDouble in interface Tuple
      Parameters:
      j - the index of field.
      Returns:
      the field value.
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • df

      public DataFrame df()
      Returns the value of the df record component.
      Returns:
      the value of the df record component
    • index

      public int index()
      Returns the value of the index record component.
      Returns:
      the value of the index record component