Package tech.tablesaw.api
Class Row
java.lang.Object
tech.tablesaw.api.Row
Represents a row in a Relation (either a Table or TableSlice), allowing iteration over the
relation. During iteration, the Row slides over the table row-wise, exposing data as it advances,
acting as a cursor into the table. There is only one Row object for the entire table during
iteration.
Implementation Note: The row is always implemented over a TableSlice. If the constructor argument is a table, it is wrapped by a slice over the whole table.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a Row object for the given tableConstructs a Row object for the given Table, with the Row positioned at the given 0-based indexRow
(TableSlice tableSlice) Constructs a Row object for the given TableSliceRow
(TableSlice tableSlice, int rowNumber) Constructs a Row object for the given TableSlice, with the Row positioned at the given 0-based index -
Method Summary
Modifier and TypeMethodDescriptionvoid
at
(int rowNumber) Moves this Row to the given 0-based row indexint
Returns the number of columns in this RowReturns a list containing the names of each column in the rowgetBoolean
(int columnIndex) Returns a Boolean value from this Row at the given column index.getBoolean
(String columnName) Returns a Boolean value from this Row at the column of the given name.byte
getBooleanAsByte
(int columnIndex) Returns an element from a Boolean column in its internal byte form, avoiding boxingbyte
getBooleanAsByte
(String columnName) Returns an element from a Boolean column in its internal byte form, avoiding boxinggetColumnType
(int columnIndex) getColumnType
(String columnName) Returns the type of the named columngetDate
(int columnIndex) Returns a LocalDate value from this Row at the column with the given index.Returns a LocalDate value from this Row at the column of the given name.getDateTime
(int columnIndex) Returns a LocalDateTime from this Row at the column with the given index.getDateTime
(String columnName) Returns a LocalDateTime value from this Row at the column of the given name.double
getDouble
(int columnIndex) Returns a double from this Row at the column with the given index.double
Returns a double from this Row at the column of the given name.float
getFloat
(int columnIndex) Returns a float from this Row at the column with the given index.float
Returns a float from this Row at the column of the given name.getInstant
(int columnIndex) Returns an Instant from this Row at the column with the given index.getInstant
(String columnName) Returns an Instant value from this Row at the column of the given name.int
getInt
(int columnIndex) Returns an int from this Row at the column with the given index.int
Returns an int from this Row at the column of the given name.long
getLong
(int columnIndex) Returns a long from this Row at the column with the given index.long
Returns a long from this Row at the column of the given name.double
Returns a double representing the value held in the column with the given name at this row, for any numeric column typegetObject
(int columnIndex) Returns an Object representing the LocalTime from this Row at the column with the given index.Returns an Object representing the value from this Row at the column of the given name.int
getPackedDate
(int columnIndex) Returns an int representing the LocalTime from this Row at the column with the given index.int
getPackedDate
(String columnName) Returns an int representing the LocalDate from this Row at the column of the given name.long
getPackedDateTime
(int columnIndex) Returns an long representing the LocalTime from this Row at the column with the given index.long
getPackedDateTime
(String columnName) Returns a long representing the LocalDateTime from this Row at the column of the given name.long
getPackedInstant
(int columnIndex) Returns an long representing the LocalTime from this Row at the column with the given index.long
getPackedInstant
(String columnName) Returns a long representing the Instant from this Row at the column of the given name.int
getPackedTime
(int columnIndex) Returns an int representing the LocalTime from this Row at the column with the given index.int
getPackedTime
(String columnName) Returns an int representing the LocalTime from this Row at the column of the given name.int
Returns the zero-based index of the current position of this Rowshort
getShort
(int columnIndex) Returns a short value from this Row at the column with the given index.short
Returns a short from this Row at the column of the given name.getString
(int columnIndex) Returns a String value from this Row at the column with the given index.Returns a String from this Row at the column of the given name.getText
(int columnIndex) Returns a String value from this Row at the column with the given index.Returns a String representing the text from this Row at the column of the given name.getTime
(int columnIndex) Returns a LocalTime value from this Row at the column with the given index.Returns a LocalTime value from this Row at the column of the given name.boolean
hasNext()
Returns true if there's at least one more row beyond the current one.boolean
Returns true if the value at columnName is missing, and false otherwisenext()
Increments the row pointer, making the next row's data accessibleint
rowHash()
Returns a hash computed on the values in the backing table at this rowvoid
setBoolean
(int columnIndex, boolean value) Sets the value of the column at the given index and this Row to the given value.void
setBoolean
(String columnName, boolean value) Sets the value of the column with the given name at this Row to the given value.void
Sets the value of the column at the given index and this Row to the given value.void
Sets the value of the column with the given name at this Row to the given value.void
setDateTime
(int columnIndex, LocalDateTime value) Sets the value of the column at the given index and this Row to the given value.void
setDateTime
(String columnName, LocalDateTime value) Sets the value of the column with the given name at this Row to the given value.void
setDouble
(int columnIndex, double value) Sets the value of the column at the given index and this Row to the given value.void
Sets the value of the column with the given name at this Row to the given value.void
setFloat
(int columnIndex, float value) Sets the value of the column at the given index and this Row to the given value.void
Sets the value of the column with the given name at this Row to the given value.void
setInstant
(int columnIndex, Instant value) Sets the value of the column at the given index and this Row to the given value.void
setInstant
(String columnName, Instant value) Sets the value of the column with the given name at this Row to the given value.void
setInt
(int columnIndex, int value) Sets the value of the column at the given index and this Row to the given value.void
Sets the value of the column with the given name at this Row to the given value.void
setLong
(int columnIndex, long value) Sets the value of the column at the given index and this Row to the given value.void
Sets the value of the column with the given name at this Row to the given value.void
setMissing
(int columnIndex) Sets the value of the given column at this Row to the appropriate missing-value indicator for the column type.void
setMissing
(String columnName) Sets the value of the given column at this Row to the appropriate missing-value indicator for the column type.void
setShort
(int columnIndex, short value) Sets the value of the column at the given index and this Row to the given value.void
Sets the value of the column with the given name at this Row to the given value.void
Sets the value of the column at the given index and this Row to the given value.void
Sets the value of the column with the given name at this Row to the given value.void
Sets the value of the column at the given index and this Row to the given value.void
Sets the value of the column with the given name at this Row to the given value.void
Sets the value of the column at the given index and this Row to the given value.void
Sets the value of the column with the given name at this Row to the given value.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
Row
Constructs a Row object for the given table -
Row
Constructs a Row object for the given TableSlice -
Row
Constructs a Row object for the given Table, with the Row positioned at the given 0-based index -
Row
Constructs a Row object for the given TableSlice, with the Row positioned at the given 0-based index
-
-
Method Details
-
at
public void at(int rowNumber) Moves this Row to the given 0-based row index -
columnCount
public int columnCount()Returns the number of columns in this Row -
columnNames
Returns a list containing the names of each column in the row -
getBoolean
Returns a Boolean value from this Row at the given column index. -
getBooleanAsByte
public byte getBooleanAsByte(int columnIndex) Returns an element from a Boolean column in its internal byte form, avoiding boxing -
getBooleanAsByte
Returns an element from a Boolean column in its internal byte form, avoiding boxing -
getBoolean
Returns a Boolean value from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an * IllegalArgumentException is thrown if the column has a different type -
getDate
Returns a LocalDate value from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if the column has a different type -
getDate
Returns a LocalDate value from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if the column has a different type -
getDateTime
Returns a LocalDateTime from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
getDateTime
Returns a LocalDateTime value from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
getInstant
Returns an Instant from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
getInstant
Returns an Instant value from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
getDouble
public double getDouble(int columnIndex) Returns a double from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
getDouble
Returns a double from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
getFloat
public float getFloat(int columnIndex) Returns a float from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
getFloat
Returns a float from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
getInt
public int getInt(int columnIndex) Returns an int from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
getInt
Returns an int from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
getLong
public long getLong(int columnIndex) Returns a long from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
getLong
Returns a long from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
getObject
Returns an Object representing the value from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row. -
getObject
Returns an Object representing the LocalTime from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row -
getPackedDate
Returns an int representing the LocalDate from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
getPackedDate
public int getPackedDate(int columnIndex) Returns an int representing the LocalTime from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type type -
getPackedInstant
public long getPackedInstant(int columnIndex) Returns an long representing the LocalTime from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type type -
getPackedInstant
Returns a long representing the Instant from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
getPackedDateTime
Returns a long representing the LocalDateTime from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
getPackedDateTime
public long getPackedDateTime(int columnIndex) Returns an long representing the LocalTime from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type type -
getPackedTime
Returns an int representing the LocalTime from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
getPackedTime
public int getPackedTime(int columnIndex) Returns an int representing the LocalTime from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type type -
getShort
public short getShort(int columnIndex) Returns a short value from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type type -
getRowNumber
public int getRowNumber()Returns the zero-based index of the current position of this Row -
getString
Returns a String value from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type type -
getShort
Returns a short from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
getText
Returns a String representing the text from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
getText
Returns a String value from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type type -
getTime
Returns a LocalTime value from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type type -
getTime
Returns a LocalTime value from this Row at the column with the given index. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type type -
getString
Returns a String from this Row at the column of the given name. An IllegalStateException is thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type -
isMissing
Returns true if the value at columnName is missing, and false otherwise -
hasNext
public boolean hasNext()Returns true if there's at least one more row beyond the current one. -
next
Increments the row pointer, making the next row's data accessible -
setMissing
public void setMissing(int columnIndex) Sets the value of the given column at this Row to the appropriate missing-value indicator for the column type. -
setMissing
Sets the value of the given column at this Row to the appropriate missing-value indicator for the column type. -
setBoolean
public void setBoolean(int columnIndex, boolean value) Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setBoolean
Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setDate
Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setDate
Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setDateTime
Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setDateTime
Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setInstant
Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setInstant
Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setDouble
public void setDouble(int columnIndex, double value) Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setDouble
Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setFloat
public void setFloat(int columnIndex, float value) Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setFloat
Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setInt
public void setInt(int columnIndex, int value) Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setInt
Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setLong
public void setLong(int columnIndex, long value) Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setLong
Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setShort
public void setShort(int columnIndex, short value) Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setShort
Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setString
Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setString
Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setText
Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setText
Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
setTime
Sets the value of the column at the given index and this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature -
getNumber
Returns a double representing the value held in the column with the given name at this row, for any numeric column type -
getColumnType
Returns the type of the named column -
getColumnType
-
rowHash
public int rowHash()Returns a hash computed on the values in the backing table at this row -
toString
-
setTime
Sets the value of the column with the given name at this Row to the given value. An IllegalStateException is * thrown if the column is not present in the Row and an IllegalArgumentException is thrown if it has a different type to that named in the method signature
-