Package jslx.tabularfiles
Interface RowSetterIfc
-
- All Superinterfaces:
RowIfc
- All Known Implementing Classes:
Row
public interface RowSetterIfc extends RowIfc
An abstraction for getting information and setting data for a row within a tabular file. The access to the columns is 0-based. Why? Because most if not all of java's data containers (arrays, lists, etc.) are 0-based. The the first column has index 0, 2nd column has index 1, etc.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
setElement(int colNum, java.lang.Object element)
void
setElements(java.lang.Object[] elements)
The row is filled with the elements.int
setNumeric(double[] data)
Sets the numeric columns according to the data in the array.default void
setNumeric(int colNum, boolean value)
void
setNumeric(int colNum, double value)
void
setNumeric(java.lang.String columnName, double value)
void
setText(int colNum, java.lang.String value)
int
setText(java.lang.String[] data)
Sets the text columns according to the data in the array.void
setText(java.lang.String columnName, java.lang.String value)
int
setText(java.util.List<java.lang.String> data)
Sets the text columns according to the data in the list.-
Methods inherited from interface jslx.tabularfiles.RowIfc
getBytes, getColumn, getColumnName, getColumnNames, getColumnTypes, getDataType, getDataTypes, getNumberColumns, getNumNumericColumns, getNumTextColumns, getType, isAllNumeric, isAllText, isNumeric, isText
-
-
-
-
Method Detail
-
setNumeric
void setNumeric(int colNum, double value)
- Parameters:
colNum
- the index into the row (0 based)value
- the value to set, will throw an exception of the cell is not NUMERIC
-
setNumeric
default void setNumeric(int colNum, boolean value)
- Parameters:
colNum
- the index into the row (0 based)value
- the value to set, will throw an exception of the cell is not NUMERIC
-
setText
void setText(int colNum, java.lang.String value)
- Parameters:
colNum
- the index into the row (0 based)value
- the value to set, will throw an exception of the cell is not TEXT
-
setNumeric
int setNumeric(double[] data)
Sets the numeric columns according to the data in the array. If the array has more elements than the number of columns, then the columns are filled with first elements of the array up to the number of columns. If the array has less elements than the number of columns, then only the first data.length columns are set.- Parameters:
data
- an array of data for the numeric rows. The array must not be null.- Returns:
- the number of columns that were set
-
setText
int setText(java.lang.String[] data)
Sets the text columns according to the data in the array. If the array has more elements than the number of columns, then the columns are filled with first elements of the array up to the number of columns. If the array has less elements than the number of columns, then only the first data.length columns are set.- Parameters:
data
- an array of data for the text rows. The array must not be null.- Returns:
- the number of columns that were set
-
setText
int setText(java.util.List<java.lang.String> data)
Sets the text columns according to the data in the list. If the list has more elements than the number of columns, then the columns are filled with first elements of the list up to the number of columns. If the list has less elements than the number of columns, then only the first data.size() columns are set.- Parameters:
data
- a list of data for the text rows. The list must not be null.- Returns:
- the number of columns that were set
-
setNumeric
void setNumeric(java.lang.String columnName, double value)
- Parameters:
columnName
- the name of the column to setvalue
- the value to set
-
setText
void setText(java.lang.String columnName, java.lang.String value)
- Parameters:
columnName
- the name of the column to setvalue
- the value to set
-
setElements
void setElements(java.lang.Object[] elements)
The row is filled with the elements. Numeric elements are saved in numeric columns in the order presented. Non-numeric elements are all converted to strings and stored in the order presented. Numeric elements are of types {Double, Long, Integer, Boolean, Float, Short, Byte}. Any other type is converted to text via toString().The order and types of the elements must match the order and types associated with the columns.
- Parameters:
elements
- the elements to add to the row. The number of elements must be equal to the number of columns
-
setElement
void setElement(int colNum, java.lang.Object element)
- Parameters:
colNum
- the column number to setelement
- the element to set
-
-