Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2015, Haiyang Li.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.landawn.abacus.util;
import java.io.File;
import java.io.OutputStream;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.BiPredicate;
import java.util.function.Function;
import java.util.function.IntFunction;
import java.util.function.Predicate;
import java.util.stream.Collector;
import com.landawn.abacus.annotation.Beta;
import com.landawn.abacus.exception.UncheckedIOException;
import com.landawn.abacus.util.If.OrElse;
import com.landawn.abacus.util.NoCachingNoUpdating.DisposableObjArray;
import com.landawn.abacus.util.Tuple.Tuple2;
import com.landawn.abacus.util.Tuple.Tuple3;
import com.landawn.abacus.util.u.Optional;
import com.landawn.abacus.util.function.IntObjFunction;
import com.landawn.abacus.util.function.TriFunction;
import com.landawn.abacus.util.function.TriPredicate;
import com.landawn.abacus.util.stream.Stream;
/**
* The DataSet interface represents a data structure that holds a collection of data in a tabular format.
* It provides a variety of methods for manipulating and accessing the data, such as sorting, filtering, joining, and grouping.
* It also supports operations like union, intersection, and difference between two DataSets.
* The data in a DataSet is organized into rows and columns, similar to a table in a relational database.
* Each column in a DataSet has a name(case-sensitive), and the data within a column is of a specific type.
*
* @see com.landawn.abacus.util.Builder.DataSetBuilder
* @see com.landawn.abacus.util.Sheet
* @see com.landawn.abacus.util.CSVUtil
* @see com.landawn.abacus.util.Fn.Factory
* @see com.landawn.abacus.util.Clazz
* @see com.landawn.abacus.util.N#newEmptyDataSet()
* @see com.landawn.abacus.util.N#newEmptyDataSet(Collection)
* @see com.landawn.abacus.util.N#newDataSet(Map)
* @see com.landawn.abacus.util.N#newDataSet(Collection)
* @see com.landawn.abacus.util.N#newDataSet(Collection, Collection)
* @see com.landawn.abacus.util.N#newDataSet(String, String, Map)
*/
public interface DataSet {
/**
* Returns an empty immutable {@code DataSet}.
* This method can be used when you need an empty DataSet for initialization or comparison purposes.
*
* @return an empty immutable {@code DataSet}
*/
static DataSet empty() {
return RowDataSet.EMPTY_DATA_SET;
}
/**
* Creates a new DataSet with the specified column names and rows.
*
* The DataSet is a data structure that stores data in a tabular format, similar to a table in a database.
* Each item in the columnNames collection represents a column in the DataSet.
* The rows parameter is a 2D array where each sub-array represents a row in the DataSet.
* The order of elements in each row should correspond to the order of column names.
*
* @param columnNames A collection of strings representing the names of the columns in the DataSet.
* @param rows A 2D array representing the data in the DataSet. Each sub-array is a row.
* @return A new DataSet with the specified column names and rows.
* @throws IllegalArgumentException If the provided columnNames and rows do not align properly.
* @see N#newDataSet(Collection, Object[][])
*/
static DataSet rows(final Collection columnNames, final Object[][] rows) throws IllegalArgumentException {
return N.newDataSet(columnNames, rows);
}
/**
* Creates a new DataSet with the specified column names and rows.
*
* The DataSet is a data structure that stores data in a tabular format, similar to a table in a database.
* Each item in the columnNames collection represents a column in the DataSet.
* The rows parameter is a collection of collections where each sub-collection represents a row in the DataSet.
* The order of elements in each row should correspond to the order of column names.
*
* @param columnNames A collection of strings representing the names of the columns in the DataSet.
* @param rows A collection of collections representing the data in the DataSet. Each sub-collection is a row which can be: Map/Bean/Array/List.
* @return A new DataSet with the specified column names and rows.
* @throws IllegalArgumentException If the provided columnNames and rows do not align properly.
* @see N#newDataSet(Collection, Collection)
*/
static DataSet rows(final Collection columnNames, final Collection extends Collection>> rows) throws IllegalArgumentException {
return N.newDataSet(columnNames, rows);
}
/**
* Creates a new DataSet with the specified column names and columns.
*
* The DataSet is a data structure that stores data in a tabular format, similar to a table in a database.
* Each item in the columnNames collection represents a column in the DataSet.
* The columns parameter is a 2D array where each sub-array represents a column in the DataSet.
* The order of elements in each column should correspond to the order of column names.
*
* @param columnNames A collection of strings representing the names of the columns in the DataSet.
* @param columns A 2D array representing the data in the DataSet. Each sub-array is a column.
* @return A new DataSet with the specified column names and columns.
* @throws IllegalArgumentException If the length of columnNames is not equal to the length of columns or the size of the sub-collection in columns is not equal.
*/
static DataSet columns(final Collection columnNames, final Object[][] columns) throws IllegalArgumentException {
if (N.size(columnNames) != N.len(columns)) {
throw new IllegalArgumentException("The length of 'columnNames' is not equal to the length of the sub-collections in 'columns'.");
}
final int columnCount = N.size(columnNames);
final int rowCount = N.len(N.firstOrNullIfEmpty(columns));
final List columnNameList = N.newArrayList(columnNames);
final List> columnList = new ArrayList<>(columnCount);
for (final Object[] column : columns) {
if (N.len(column) != rowCount) {
throw new IllegalArgumentException("The size of the sub-collection in 'columns' is not equal.");
}
columnList.add(Array.asList(column));
}
return new RowDataSet(columnNameList, columnList);
}
/**
* Creates a new DataSet with the specified column names and columns.
*
* The DataSet is a data structure that stores data in a tabular format, similar to a table in a database.
* Each item in the columnNames collection represents a column in the DataSet.
* The columns parameter is a collection of collections where each sub-collection represents a column in the DataSet.
*
* @param columnNames A collection of strings representing the names of the columns in the DataSet.
* @param columns A collection of collections representing the data in the DataSet. Each sub-collection is a column.
* @return A new DataSet with the specified column names and columns.
* @throws IllegalArgumentException If the length of columnNames is not equal to the length of columns or the size of the sub-collection in columns is not equal.
*/
static DataSet columns(final Collection columnNames, final Collection extends Collection>> columns) throws IllegalArgumentException {
if (N.size(columnNames) != N.size(columns)) {
throw new IllegalArgumentException("The length of 'columnNames' is not equal to the length of the sub-collections in 'columns'.");
}
final int columnCount = N.size(columnNames);
final int rowCount = N.size(N.firstOrNullIfEmpty(columns));
final List columnNameList = N.newArrayList(columnNames);
final List> columnList = new ArrayList<>(columnCount);
for (final Collection> column : columns) {
if (N.size(column) != rowCount) {
throw new IllegalArgumentException("The size of the sub-collection in 'columns' is not equal.");
}
columnList.add(N.newArrayList(column));
}
return new RowDataSet(columnNameList, columnList);
}
// /**
// * Creates a new DataSet with a single column.
// *
// * The DataSet is a data structure that stores data in a tabular format, similar to a table in a database.
// * The 'columnName' parameter represents the name of the column in the DataSet.
// * The 'column' parameter is a collection where each item represents a row in the DataSet.
// *
// * @param columnName A string representing the name of the column in the DataSet.
// * @param column A collection of objects representing the data in the DataSet. Each object is a row.
// * @return A new DataSet with the specified column name and column data.
// * @throws IllegalArgumentException If the provided columnName is empty.
// * @see #columns(Collection, Collection)
// * @see N#newDataSet(String, Collection)
// */
// static DataSet singleColumn(final String columnName, final Collection> column) throws IllegalArgumentException {
// return N.newDataSet(columnName, column);
// }
// /**
// * Returns the bean name associated with the query.
// *
// * @return
// */
// String beanName();
//
// /**
// * Returns the target bean class associated with the query.
// *
// * @return
// */
// Class rowType();
/**
* Returns an immutable list of column names in this DataSet.
* The order of the column names in the list reflects the order of the columns in the DataSet.
*
* @return an ImmutableList of column names
*/
ImmutableList columnNameList();
/**
* Returns the number of columns in this DataSet.
*
* @return the count of columns
*/
int columnCount();
/**
* Returns the column name for the specified column index.
*
* @param columnIndex the index of the column.
* @return the name of the column at the specified index.
* @throws IndexOutOfBoundsException if the specified column index is out of bounds
*/
String getColumnName(int columnIndex) throws IndexOutOfBoundsException;
/**
* Returns the index of the specified column in the DataSet.
*
* @param columnName the name(case-sensitive) of the column for which the index is required.
* @return the index of the specified column.
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet.
*/
int getColumnIndex(String columnName) throws IllegalArgumentException;
/**
* Returns an array of column indexes corresponding to the provided column names.
*
* @param columnNames the collection of column names(case-sensitive) for which indexes are required.
* @return an array of integers representing the indexes of the specified columns.
* @throws IllegalArgumentException if any of the provided column names does not exist in the DataSet.
*/
int[] getColumnIndexes(Collection columnNames) throws IllegalArgumentException;
/**
* Checks if the specified column name exists in this DataSet.
*
* @param columnName the name(case-sensitive) of the column to check.
* @return {@code true} if the column exists, {@code false} otherwise.
*/
boolean containsColumn(String columnName);
/**
* Check if this {@code DataSet} contains all the specified columns.
*
* @param columnNames the collection of column names(case-sensitive) to check.
* @return {@code true} if all the specified columns are included in the this {@code DataSet}
*/
boolean containsAllColumns(Collection columnNames);
/**
* Renames a column in the DataSet.
*
* @param columnName the current name of the column.
* @param newColumnName the new name for the column.
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet or the new column name exists in the DataSet.
*/
void renameColumn(String columnName, String newColumnName) throws IllegalArgumentException;
/**
* Renames multiple columns in the DataSet.
*
* @param oldNewNames a map where the key is the current name of the column and the value is the new name for the column.
* @throws IllegalArgumentException if any of the specified old column names does not exist in the DataSet or any of the new column names already exists in the DataSet.
*/
void renameColumns(Map oldNewNames) throws IllegalArgumentException;
// /**
// *
// * @param columnName
// * @param func
// */
// void renameColumn(String columnName, Function super String, String > func) ;
/**
* Renames multiple columns in the DataSet using a function to determine the new names.
*
* @param columnNames the collection of current column names to be renamed.
* @param func a function that takes the current column name as input and returns the new column name.
* @throws IllegalArgumentException if any of the specified old column names does not exist in the DataSet or any of the new column names already exists in the DataSet.
*/
void renameColumns(Collection columnNames, Function super String, String> func) throws IllegalArgumentException;
/**
* Renames all columns in the DataSet using a function to determine the new names.
*
* @param func a function that takes the current column name as input and returns the new column name.
* @throws IllegalArgumentException if any of the new column names already exists in the DataSet.
*/
void renameColumns(Function super String, String> func) throws IllegalArgumentException;
/**
* Moves a column in the DataSet to a new position.
*
* @param columnName the name of the column to be moved.
* @param newPosition the new position for the column.
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet or the new position is out of bounds.
*/
void moveColumn(String columnName, int newPosition) throws IllegalArgumentException;
/**
* Moves multiple columns in the DataSet to new positions.
*
* @param columnNameNewPositionMap a map where the key is the current name of the column and the value is the new position for the column.
* @throws IllegalArgumentException if any of the specified column names does not exist in the DataSet or any of the new positions are out of bounds.
*/
void moveColumns(Map columnNameNewPositionMap) throws IllegalArgumentException;
/**
* Swaps the positions of two columns in the DataSet.
*
* @param columnNameA the name of the first column to be swapped.
* @param columnNameB the name of the second column to be swapped.
* @throws IllegalArgumentException if either of the specified column names does not exist in the DataSet.
*/
void swapColumns(String columnNameA, String columnNameB) throws IllegalArgumentException;
/**
* Moves a row in the DataSet to a new position.
*
* @param rowIndex the index of the row to be moved.
* @param newRowIndex the new position for the row.
* @throws IllegalArgumentException if the specified row index is out of bounds or the new position is out of bounds.
*/
void moveRow(int rowIndex, int newRowIndex) throws IllegalArgumentException;
/**
* Swaps the positions of two rows in the DataSet.
*
* @param rowIndexA the index of the first row to be swapped.
* @param rowIndexB the index of the second row to be swapped.
* @throws IllegalArgumentException if either of the specified row indexes is out of bounds.
*/
void swapRows(int rowIndexA, int rowIndexB) throws IllegalArgumentException;
/**
* Retrieves the value at the specified row and column index in the DataSet.
*
* There is NO underline auto-conversion from column value to target type: {@code T}.
* So the column values must be the type which is assignable to target type.
*
* @param the type of the value to be returned.
* @param rowIndex the index of the row.
* @param columnIndex the index of the column.
* @return the value at the specified row and column index.
* @throws IndexOutOfBoundsException if the specified row or column index is out of bounds.
*/
T get(int rowIndex, int columnIndex) throws IndexOutOfBoundsException;
// /**
// * There is NO underline auto-conversion from column value to target type: {@code T}.
// * So the column values must be the type which is assignable to target type.
// *
// * @param rowIndex
// * @param columnIndex
// * @param targetType
// *
// * @param
// * @return
// * @throws UnsupportedOperationException
// * @deprecated may be misused because it implies there is an underline auto-conversion from column values to target return type but actually there is not.
// */
// @SuppressWarnings("unused")
// @Deprecated
// default T get(int rowIndex, int columnIndex, Class extends T> targetType) throws UnsupportedOperationException {
// throw new UnsupportedOperationException();
// }
/**
* Sets the value at the specified row and column index in the DataSet.
*
* @param rowIndex the index of the row.
* @param columnIndex the index of the column.
* @param element the new value to be set at the specified row and column index.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IndexOutOfBoundsException if the specified row or column index is out of bounds.
*/
void set(int rowIndex, int columnIndex, Object element) throws IllegalStateException, IndexOutOfBoundsException;
/**
* Checks if the value at the specified row and column index in the DataSet is {@code null}.
*
* @param rowIndex the index of the row.
* @param columnIndex the index of the column.
* @return {@code true} if the value at the specified row and column index is {@code null}, {@code false} otherwise.
* @throws IndexOutOfBoundsException if the specified row or column index is out of bounds.
*/
boolean isNull(int rowIndex, int columnIndex) throws IndexOutOfBoundsException;
/**
* Retrieves the value at the specified column index in the DataSet for the current row.
*
* There is NO underline auto-conversion from column value to target type: {@code T}.
* So the column values must be the type which is assignable to target type.
*
* @param the type of the value to be returned.
* @param columnIndex the index of the column.
* @return the value at the specified column index.
* @throws IndexOutOfBoundsException if the specified column index is out of bounds.
*/
T get(int columnIndex) throws IndexOutOfBoundsException;
/**
* Retrieves the value at the specified column in the DataSet for the current row.
*
* There is NO underline auto-conversion from column value to target type: {@code T}.
* So the column values must be the type which is assignable to target type.
*
* Using {@code get(int)} for better performance.
*
* @param the type of the value to be returned.
* @param columnName the name of the column.
* @return the value at the specified column.
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet.
* @see #get(int)
*/
T get(String columnName);
// /**
// * There is NO underline auto-conversion from column value to target type: {@code T}.
// * So the column values must be the type which is assignable to target type.
// *
// *
// * @param
// * @return
// * @throws UnsupportedOperationException
// * @deprecated may be misused because it implies there is an underline auto-conversion from column values to target return type but actually there is not.
// */
// @SuppressWarnings("unused")
// @Deprecated
// default T get(int columnIndex, Class extends T> targetType) throws UnsupportedOperationException {
// throw new UnsupportedOperationException();
// }
//
// /**
// *
// * There is NO underline auto-conversion from column value to target type: {@code T}.
// * So the column values must be the type which is assignable to target type.
// *
// * @param columnName
// * @param targetType
// *
// * @param
// * @return
// * @throws UnsupportedOperationException
// * @deprecated may be misused because it implies there is an underline auto-conversion from column values to target return type but actually there is not.
// */
// @SuppressWarnings("unused")
// @Deprecated
// default T get(String columnName, Class extends T> targetType) throws UnsupportedOperationException {
// throw new UnsupportedOperationException();
// }
//
// /**
// * Returns the value from the current row and specified column if the specified {@code columnIndex} is equal or bigger than zero,
// * or the specified {@code defaultValue} otherwise.
// *
// * There is NO underline auto-conversion from column value to target type: {@code T}.
// * So the column values must be the type which is assignable to target type.
// *
// * @param
// * @param columnIndex
// * @param defaultValue
// * @return
// * @throws UnsupportedOperationException
// * @deprecated
// */
// @SuppressWarnings("unused")
// @Deprecated
// default T getOrDefault(int columnIndex, T defaultValue) throws UnsupportedOperationException {
// throw new UnsupportedOperationException();
// }
//
// /**
// * Returns the value from the current row and specified column if the specified {@code columnName} exists,
// * or the specified {@code defaultValue} otherwise.
// *
// * There is NO underline auto-conversion from column value to target type: {@code T}.
// * So the column values must be the type which is assignable to target type.
// *
// * @param
// * @param columnName
// * @param defaultValue
// * @return
// * @throws UnsupportedOperationException
// * @deprecated
// */
// @SuppressWarnings("unused")
// @Deprecated
// default T getOrDefault(String columnName, T defaultValue) throws UnsupportedOperationException {
// throw new UnsupportedOperationException();
// }
/**
* Retrieves the boolean value at the specified column index in the DataSet for the current row.
*
* There is NO underline auto-conversion from column value to target type: {@code Boolean}.
* So the column values must be the type which is assignable to target type.
*
* Returns default value (false) if the property is {@code null}.
*
* @param columnIndex the index of the column.
* @return the boolean value at the specified column index.
* @throws IndexOutOfBoundsException if the specified column index is out of bounds.
*/
boolean getBoolean(int columnIndex) throws IndexOutOfBoundsException;
/**
* Retrieves the boolean value at the specified column in the DataSet for the current row.
*
* There is NO underline auto-conversion from column value to target type: {@code Boolean}.
* So the column values must be the type which is assignable to target type.
*
* Returns default value (false) if the property is {@code null}.
*
* Using {@code getBoolean(int)} for better performance.
*
* @param columnName the name of the column.
* @return the boolean value at the specified column.
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet.
* @see #getBoolean(int)
*/
boolean getBoolean(String columnName) throws IllegalArgumentException;
/**
* Retrieves the char value at the specified column index in the DataSet for the current row.
*
* There is NO underline auto-conversion from column value to target type: {@code Character}.
* So the column values must be the type which is assignable to target type.
*
* Returns default value (0) if the property is {@code null}.
*
* @param columnIndex the index of the column.
* @return the char value at the specified column index.
* @throws IndexOutOfBoundsException if the specified column index is out of bounds.
*/
char getChar(int columnIndex) throws IndexOutOfBoundsException;
/**
* Retrieves the char value at the specified column in the DataSet for the current row.
*
* There is NO underline auto-conversion from column value to target type: {@code Character}.
* So the column values must be the type which is assignable to target type.
*
* Returns default value (0) if the property is {@code null}.
*
* Using {@code getChar(int)} for better performance.
*
* @param columnName the name of the column.
* @return the char value at the specified column.
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet.
* @see #getChar(int)
*/
char getChar(String columnName) throws IllegalArgumentException;
/**
* Retrieves the byte value at the specified column index in the DataSet for the current row.
*
* There is NO underline auto-conversion from column value to target type: {@code Byte}.
* So the column values must be the type which is assignable to target type, or {@code Number}.
*
* Returns default value (0) if the property is {@code null}.
*
* @param columnIndex the index of the column.
* @return the byte value at the specified column index.
* @throws IndexOutOfBoundsException if the specified column index is out of bounds.
*/
byte getByte(int columnIndex) throws IndexOutOfBoundsException;
/**
* Retrieves the byte value at the specified column in the DataSet for the current row.
*
* There is NO underline auto-conversion from column value to target type: {@code Byte}.
* So the column values must be the type which is assignable to target type, or {@code Number}.
*
* Returns default value (0) if the property is {@code null}.
*
* Using {@code getByte(int)} for better performance.
*
* @param columnName the name of the column.
* @return the byte value at the specified column.
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet.
* @see #getByte(int)
*/
byte getByte(String columnName) throws IllegalArgumentException;
/**
* Retrieves the short value at the specified column index in the DataSet for the current row.
*
* There is NO underline auto-conversion from column value to target type: {@code Short}.
* So the column values must be the type which is assignable to target type, or {@code Number}.
*
* Returns default value (0) if the property is {@code null}.
*
* @param columnIndex the index of the column.
* @return the short value at the specified column index.
* @throws IndexOutOfBoundsException if the specified column index is out of bounds.
*/
short getShort(int columnIndex) throws IndexOutOfBoundsException;
/**
* Retrieves the short value at the specified column in the DataSet for the current row.
*
* There is NO underline auto-conversion from column value to target type: {@code Short}.
* So the column values must be the type which is assignable to target type, or {@code Number}.
*
* Returns default value (0) if the property is {@code null}.
*
* Using {@code getShort(int)} for better performance.
*
* @param columnName the name of the column.
* @return the short value at the specified column.
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet.
* @see #getShort(int)
*/
short getShort(String columnName) throws IllegalArgumentException;
/**
* Retrieves the integer value at the specified column index in the DataSet for the current row.
*
* There is NO underline auto-conversion from column value to target type: {@code Integer}.
* So the column values must be the type which is assignable to target type, or {@code Number}.
*
* Returns default value (0) if the property is {@code null}.
*
* @param columnIndex the index of the column.
* @return the integer value at the specified column index.
* @throws IndexOutOfBoundsException if the specified column index is out of bounds.
*/
int getInt(int columnIndex) throws IndexOutOfBoundsException;
/**
* Retrieves the integer value at the specified column in the DataSet for the current row.
*
* There is NO underline auto-conversion from column value to target type: {@code Integer}.
* So the column values must be the type which is assignable to target type, or {@code Number}.
*
* Returns default value (0) if the property is {@code null}.
*
* Using {@code getInt(int)} for better performance.
*
*
* @param columnName the name of the column.
* @return the integer value at the specified column.
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet.
* @see #getInt(int)
*/
int getInt(String columnName) throws IllegalArgumentException;
/**
* Retrieves the long value at the specified column index in the DataSet for the current row.
*
* There is NO underline auto-conversion from column value to target type: {@code Long}.
* So the column values must be the type which is assignable to target type, or {@code Number}.
*
* Returns default value (0) if the property is {@code null}.
*
* @param columnIndex the index of the column.
* @return the long value at the specified column index.
* @throws IndexOutOfBoundsException if the specified column index is out of bounds.
*/
long getLong(int columnIndex) throws IndexOutOfBoundsException;
/**
* Retrieves the long value at the specified column in the DataSet for the current row.
*
* There is NO underline auto-conversion from column value to target type: {@code Long}.
* So the column values must be the type which is assignable to target type, or {@code Number}.
*
* Returns default value (0) if the property is {@code null}.
*
* Using {@code getLong(int)} for better performance.
*
* @param columnName the name of the column.
* @return the long value at the specified column.
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet.
* @see #getLong(int)
*/
long getLong(String columnName) throws IllegalArgumentException;
/**
* Retrieves the float value at the specified column index in the DataSet for the current row.
*
* There is NO underline auto-conversion from column value to target type: {@code Float}.
* So the column values must be the type which is assignable to target type, or {@code Number}.
*
* Returns default value (0f) if the property is {@code null}.
*
* @param columnIndex the index of the column.
* @return the float value at the specified column index.
* @throws IndexOutOfBoundsException if the specified column index is out of bounds.
*/
float getFloat(int columnIndex) throws IndexOutOfBoundsException;
/**
* Retrieves the float value at the specified column in the DataSet for the current row.
*
* There is NO underline auto-conversion from column value to target type: {@code Float}.
* So the column values must be the type which is assignable to target type, or {@code Number}.
*
* Returns default value (0f) if the property is {@code null}.
*
* Using {@code getFloat(int)} for better performance.
*
* @param columnName the name of the column.
* @return the float value at the specified column.
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet.
* @see #getFloat(int)
*/
float getFloat(String columnName) throws IllegalArgumentException;
/**
* Retrieves the double value at the specified column index in the DataSet for the current row.
*
* There is NO underline auto-conversion from column value to target type: {@code Double}.
* So the column values must be the type which is assignable to target type, or {@code Number}.
*
* Returns default value (0d) if the property is {@code null}.
*
* @param columnIndex the index of the column.
* @return the double value at the specified column index.
* @throws IndexOutOfBoundsException if the specified column index is out of bounds.
*/
double getDouble(int columnIndex) throws IndexOutOfBoundsException;
/**
* Retrieves the double value at the specified column in the DataSet for the current row.
*
* There is NO underline auto-conversion from column value to target type: {@code Double}.
* So the column values must be the type which is assignable to target type, or {@code Number}.
*
* Returns default value (0d) if the property is {@code null}.
*
* Using {@code getDouble(int)} for better performance.
*
* @param columnName the name of the column.
* @return the double value at the specified column.
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet.
* @see #getDouble(int)
*/
double getDouble(String columnName) throws IllegalArgumentException;
/**
* Checks if the value at the specified column index in the DataSet for the current row is {@code null}.
*
* This method can be used to validate the data before performing operations that do not support {@code null} values.
*
* @param columnIndex the index of the column.
* @return {@code true} if the value at the specified column index is {@code null}, {@code false} otherwise.
* @throws IndexOutOfBoundsException if the specified column index is out of bounds.
*/
boolean isNull(int columnIndex) throws IndexOutOfBoundsException;
/**
* Checks if the value at the specified column in the DataSet for the current row is {@code null}.
*
* This method can be used to validate the data before performing operations that do not support {@code null} values.
*
* Using {@code isNull(int)} for better performance.
*
* @param columnName the name of the column.
* @return {@code true} if the value at the specified column is {@code null}, {@code false} otherwise.
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet.
* @see #isNull(int)
*/
boolean isNull(String columnName) throws IllegalArgumentException;
/**
* Sets the value at the specified column index in the DataSet for the current row.
*
* @param columnIndex the index of the column.
* @param value the new value to be set at the specified column index.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IndexOutOfBoundsException if the specified column index is out of bounds.
*/
void set(int columnIndex, Object value) throws IllegalStateException, IndexOutOfBoundsException;
/**
* Sets the value at the specified column in the DataSet for the current row.
*
* Using {@code set(int, Object)} for better performance.
*
* @param columnName the name of the column.
* @param value the new value to be set at the specified column.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet.
* @see #set(int, Object)
*/
void set(String columnName, Object value) throws IllegalStateException, IndexOutOfBoundsException;
/**
* Retrieves the values of the specified column index in the DataSet as an ImmutableList.
*
* The returned list is immutable and any attempt to modify it will result in an UnsupportedOperationException.
*
* The type of the values in the list will be the same as the type of the column.
*
* The order of the values in the list reflects the order of the rows in the DataSet.
*
* @param the type of the values to be returned.
* @param columnIndex the index of the column.
* @return an ImmutableList of values at the specified column index.
* @throws IndexOutOfBoundsException if the specified column index is out of bounds.
*/
ImmutableList getColumn(int columnIndex) throws IndexOutOfBoundsException;
/**
* Retrieves the values of the specified column in the DataSet as an ImmutableList.
*
* The returned list is immutable and any attempt to modify it will result in an UnsupportedOperationException.
*
* The type of the values in the list will be the same as the type of the column.
*
* The order of the values in the list reflects the order of the rows in the DataSet.
*
* @param the type of the values to be returned.
* @param columnName the name of the column.
* @return an ImmutableList of values at the specified column.
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet.
*/
ImmutableList getColumn(String columnName) throws IllegalArgumentException;
/**
* Retrieves the values of the specified column in the DataSet as a List.
*
* The returned list is a copy and modifications to it will not affect the original DataSet.
*
* The type of the values in the list will be the same as the type of the column.
*
* @param the type of the values to be returned.
* @param columnName the name of the column.
* @return a List of values at the specified column.
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet.
*/
List copyColumn(String columnName) throws IllegalArgumentException;
/**
* Adds a new column to the DataSet.
*
* The new column is added at the end of the existing columns.
* The size of this list should match the number of rows in the DataSet.
*
* @param newColumnName The name of the new column to be added. It should not be a name that already exists in the DataSet.
* @param column The data for the new column. It should be a list where each element represents a row in the column.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if the new column name already exists in the DataSet or the provided collection is not empty and its size does not match the number of rows in the DataSet.
*/
void addColumn(String newColumnName, Collection> column) throws IllegalStateException, IllegalArgumentException;
/**
* Adds a new column to the DataSet at the specified position.
*
* The new column is added at the position specified by newColumnPosition. Existing columns at and after this position are shifted to the right.
* The size of the list provided should match the number of rows in the DataSet.
*
* @param newColumnPosition The position at which the new column should be added. It should be a valid index within the current column range.
* @param newColumnName The name of the new column to be added. It should not be a name that already exists in the DataSet.
* @param column The data for the new column. It should be a collection where each element represents a row in the column.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if the specified {@code newColumnPosition} is less than zero or bigger than column size or the new column name already exists in the DataSet,
* or if the provided collection is not empty and its size does not match the number of rows in the DataSet, or the newColumnPosition is out of bounds.
*/
void addColumn(int newColumnPosition, String newColumnName, Collection> column) throws IllegalStateException, IllegalArgumentException;
/**
* Adds a new column to the DataSet.
*
* The new column is generated by applying a function to an existing column. The function takes the value of the existing column for each row and returns the value for the new column for that row.
*
* The new column is added at the end of the existing columns.
*
* @param newColumnName The name of the new column to be added. It should not be a name that already exists in the DataSet.
* @param fromColumnName The name of the existing column to be used as input for the function.
* @param func The function to generate the values for the new column. It takes the value of the existing column for each row and returns the value for the new column for that row.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if the new column name already exists in the DataSet or the existing column name does not exist in the DataSet.
*/
void addColumn(String newColumnName, String fromColumnName, Function, ?> func) throws IllegalStateException, IllegalArgumentException;
/**
* Adds a new column to the DataSet at the specified position.
*
* The new column is generated by applying a function to an existing column. The function takes the value of the existing column for each row and returns the value for the new column for that row.
*
* The new column is added at the position specified by newColumnPosition. Existing columns at and after this position are shifted to the right.
*
* @param newColumnPosition The position at which the new column should be added. It should be a valid index within the current column range.
* @param newColumnName The name of the new column to be added. It should not be a name that already exists in the DataSet.
* @param fromColumnName The name of the existing column to be used as input for the function.
* @param func The function to generate the values for the new column. It takes the value of the existing column for each row and returns the value for the new column for that row.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if the specified {@code newColumnPosition} is less than zero or bigger than column size or the new column name already exists in the DataSet, or if the existing column name does not exist in the DataSet.
*/
void addColumn(int newColumnPosition, String newColumnName, String fromColumnName, Function, ?> func)
throws IllegalStateException, IllegalArgumentException;
/**
* Adds a new column to the DataSet.
*
* The new column is generated by applying a function to multiple existing columns. The function takes the values of the existing columns for each row and returns the value for the new column for that row.
*
* The new column is added at the end of the existing columns.
*
* @param newColumnName The name of the new column to be added. It should not be a name that already exists in the DataSet.
* @param fromColumnNames The names of the existing columns to be used as input for the function.
* @param func The function to generate the values for the new column. It takes the values of the existing columns for each row and returns the value for the new column for that row. The input to the function is a DisposableObjArray containing the values of the existing columns for a particular row.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if the new column name already exists in the DataSet or any of the existing column names does not exist in the DataSet.
*/
void addColumn(String newColumnName, Collection fromColumnNames, Function super DisposableObjArray, ?> func)
throws IllegalStateException, IllegalArgumentException;
/**
* Adds a new column to the DataSet at the specified position.
*
* The new column is generated by applying a function to multiple existing columns. The function takes the values of the existing columns for each row and returns the value for the new column for that row.
*
* The new column is added at the position specified by newColumnPosition. Existing columns at and after this position are shifted to the right.
*
* @param newColumnPosition The position at which the new column should be added. It should be a valid index within the current column range.
* @param newColumnName The name of the new column to be added. It should not be a name that already exists in the DataSet.
* @param fromColumnNames The names of the existing columns to be used as input for the function.
* @param func The function to generate the values for the new column. It takes the values of the existing columns for each row and returns the value for the new column for that row. The input to the function is a DisposableObjArray containing the values of the existing columns for a particular row.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if the specified {@code newColumnPosition} is less than zero or bigger than column size or the new column name already exists in the DataSet, or if any of the existing column names does not exist in the DataSet.
*/
void addColumn(int newColumnPosition, String newColumnName, Collection fromColumnNames, Function super DisposableObjArray, ?> func)
throws IllegalStateException, IllegalArgumentException;
/**
* Adds a new column to the DataSet.
*
* The new column is generated by applying a BiFunction to two existing columns. The BiFunction takes the values of the existing columns for each row and returns the value for the new column for that row.
*
* The new column is added at the end of the existing columns.
*
* @param newColumnName The name of the new column to be added. It should not be a name that already exists in the DataSet.
* @param fromColumnNames A Tuple2 containing the names of the two existing columns to be used as input for the BiFunction.
* @param func The BiFunction to generate the values for the new column. It takes the values of the two existing columns for each row and returns the value for the new column for that row.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if the new column name already exists in the DataSet or any of the existing column names does not exist in the DataSet.
*/
void addColumn(String newColumnName, Tuple2 fromColumnNames, BiFunction, ?, ?> func)
throws IllegalStateException, IllegalArgumentException;
/**
* Adds a new column to the DataSet at the specified position.
*
* The new column is generated by applying a BiFunction to two existing columns. The BiFunction takes the values of the two existing columns for each row and returns the value for the new column for that row.
*
* The new column is added at the position specified by newColumnPosition. Existing columns at and after this position are shifted to the right.
*
* @param newColumnPosition The position at which the new column should be added. It should be a valid index within the current column range.
* @param newColumnName The name of the new column to be added. It should not be a name that already exists in the DataSet.
* @param fromColumnNames A Tuple2 containing the names of the two existing columns to be used as input for the BiFunction.
* @param func The BiFunction to generate the values for the new column. It takes the values of the two existing columns for each row and returns the value for the new column for that row.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if the specified {@code newColumnPosition} is less than zero or bigger than column size or the new column name already exists in the DataSet, or if any of the existing column names does not exist in the DataSet.
*/
void addColumn(int newColumnPosition, String newColumnName, Tuple2 fromColumnNames, BiFunction, ?, ?> func)
throws IllegalStateException, IllegalArgumentException;
/**
* Adds a new column to the DataSet.
*
* The new column is generated by applying a TriFunction to three existing columns. The TriFunction takes the values of the three existing columns for each row and returns the value for the new column for that row.
*
* The new column is added at the end of the existing columns.
*
* @param newColumnName The name of the new column to be added. It should not be a name that already exists in the DataSet.
* @param fromColumnNames A Tuple3 containing the names of the three existing columns to be used as input for the TriFunction.
* @param func The TriFunction to generate the values for the new column. It takes the values of the three existing columns for each row and returns the value for the new column for that row.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if the new column name already exists in the DataSet or any of the existing column names does not exist in the DataSet.
*/
void addColumn(String newColumnName, Tuple3 fromColumnNames, TriFunction, ?, ?, ?> func)
throws IllegalStateException, IllegalArgumentException;
/**
* Adds a new column to the DataSet at the specified position.
*
* The new column is generated by applying a TriFunction to three existing columns. The TriFunction takes the values of the three existing columns for each row and returns the value for the new column for that row.
*
* The new column is added at the position specified by newColumnPosition. Existing columns at and after this position are shifted to the right.
*
* @param newColumnPosition The position at which the new column should be added. It should be a valid index within the current column range.
* @param newColumnName The name of the new column to be added. It should not be a name that already exists in the DataSet.
* @param fromColumnNames A Tuple3 containing the names of the three existing columns to be used as input for the TriFunction.
* @param func The TriFunction to generate the values for the new column. It takes the values of the three existing columns for each row and returns the value for the new column for that row.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if the specified {@code newColumnPosition} is less than zero or bigger than column size or the new column name already exists in the DataSet, or if any of the existing column names does not exist in the DataSet.
*/
void addColumn(int newColumnPosition, String newColumnName, Tuple3 fromColumnNames, TriFunction, ?, ?, ?> func)
throws IllegalStateException, IllegalArgumentException;
/**
* Removes a column from the DataSet.
*
* The column is identified by its name. All data in the column is removed and returned as a List.
*
* The order of the values in the returned list reflects the order of the rows in the DataSet.
*
* @param The type of the values in the column.
* @param columnName The name of the column to be removed. It should be a name that exists in the DataSet.
* @return A List containing the values of the removed column.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet.
*/
List removeColumn(String columnName) throws IllegalStateException, IllegalArgumentException;
/**
* Removes multiple columns from the DataSet.
*
* The columns are identified by their names provided in the collection. All data in these columns are removed.
*
* @param columnNames A collection containing the names of the columns to be removed. These should be names that exist in the DataSet.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if any of the specified column names does not exist in the DataSet or {@code columnNames} is empty.
*/
void removeColumns(Collection columnNames) throws IllegalStateException, IllegalArgumentException;
/**
* Removes multiple columns from the DataSet.
*
* The columns to be removed are identified by a Predicate function. The function is applied to each column name, and if it returns {@code true}, the column is removed.
*
* @param filter A Predicate function to determine which columns should be removed. It should return {@code true} for column names that should be removed, and {@code false} for those that should be kept.
* @throws IllegalStateException if the DataSet is frozen (read-only).
*/
void removeColumns(Predicate super String> filter) throws IllegalStateException;
// /**
// * Remove the column(s) whose name matches the specified {@code filter}.
// *
// * @param filter column name filter
// * @deprecated replaced by {@code removeColumns}.
// */
// @Deprecated
// void removeColumnsIf(Predicate super String> filter);
/**
* Updates the values in a specified column of the DataSet.
*
* The update is performed by applying a function to each value in the column. The function takes the current value and returns the new value.
*
* @param columnName The name of the column to be updated. It should be a name that exists in the DataSet.
* @param func The function to be applied to each value in the column. It takes the current value and returns the new value.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet.
*/
void updateColumn(String columnName, Function, ?> func) throws IllegalStateException, IllegalArgumentException;
/**
* Updates the values in multiple specified columns of the DataSet.
*
* The update is performed by applying a function to each value in the specified columns. The function takes the current value and returns the new value.
*
* @param columnNames A collection containing the names of the columns to be updated. These should be names that exist in the DataSet.
* @param func The function to be applied to each value in the columns. It takes the current value and returns the new value.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if any of the specified column names does not exist in the DataSet or {@code columnNames} is empty.
*/
void updateColumns(Collection columnNames, Function, ?> func) throws IllegalStateException, IllegalArgumentException;
/**
* Converts the values in a specified column of the DataSet to a specified target type.
*
* @param columnName The name of the column to be converted. It should be a name that exists in the DataSet.
* @param targetType The Class object representing the target type to which the column values should be converted.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet or a value cannot be cast to the target type.
* @throws NumberFormatException if string value of the column cannot be parsed to the target(Number) type.
* @throws RuntimeException if any other error occurs during the conversion.
* @see N#convert(Object, Class)
*/
void convertColumn(String columnName, Class> targetType) throws IllegalStateException, IllegalArgumentException, NumberFormatException, RuntimeException;
/**
* Converts the values in multiple specified columns of the DataSet to their respective target types.
*
* @param columnTargetTypes A map where the key is the column name and the value is the Class object representing the target type to which the column values should be converted. The column names should exist in the DataSet.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if any of the specified column names does not exist in the DataSet or {@code columnTargetTypes} is empty or a value cannot be cast to the target type.
* @throws NumberFormatException if string value of the column cannot be parsed to the target(Number) type.
* @throws RuntimeException if any other error occurs during the conversion.
* @see N#convert(Object, Class)
*/
void convertColumns(Map> columnTargetTypes)
throws IllegalStateException, IllegalArgumentException, NumberFormatException, RuntimeException;
//
// /**
// * convert the specified columns to target types.
// *
// * @param targetColumnTypes fill the element with {@code null} if don't wan to convert the target column.
// */
// void convertColumn(Class>[] targetColumnTypes);
/**
* Combines multiple columns into a new column in the DataSet.
*
* The new column is created by combining the values of the specified columns for each row. The type of the new column is specified by the newColumnType parameter.
*
* @param columnNames A collection containing the names of the columns to be combined. These should be names that exist in the DataSet.
* @param newColumnName The name of the new column to be created. It should not be a name that already exists in the DataSet.
* @param newColumnType The Class object representing the type of the new column.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if any of the specified column names does not exist in the DataSet or {@code columnNames} is empty or the new column name already exists in the DataSet.
*/
void combineColumns(Collection columnNames, String newColumnName, Class> newColumnType) throws IllegalStateException, IllegalArgumentException;
/**
* Combines multiple columns into a new column in the DataSet.
*
* The new column is created by applying a function to the values of the specified columns for each row. The function takes a DisposableObjArray of the values in the existing columns for a particular row and returns the value for the new column for that row.
*
* @param columnNames A collection containing the names of the columns to be combined. These should be names that exist in the DataSet.
* @param newColumnName The name of the new column to be created. It should not be a name that already exists in the DataSet.
* @param combineFunc The function to generate the values for the new column. It takes a DisposableObjArray of the values in the existing columns for a particular row and returns the value for the new column for that row.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if any of the specified column names does not exist in the DataSet or {@code columnNames} is empty or the new column name already exists in the DataSet.
*/
void combineColumns(Collection columnNames, String newColumnName, Function super DisposableObjArray, ?> combineFunc)
throws IllegalStateException, IllegalArgumentException;
/**
* Combines two columns into a new column in the DataSet.
*
* The new column is created by applying a BiFunction to the values of the specified columns for each row.
* The BiFunction takes the values of the two existing columns for a particular row and returns the value for the new column for that row.
*
* @param columnNames A Tuple2 containing the names of the two columns to be combined. These should be names that exist in the DataSet.
* @param newColumnName The name of the new column to be created. It should not be a name that already exists in the DataSet.
* @param combineFunc The BiFunction to generate the values for the new column. It takes the values of the two existing columns for a particular row and returns the value for the new column for that row.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if any of the specified column names does not exist in the DataSet or the new column name already exists in the DataSet.
*/
void combineColumns(Tuple2 columnNames, String newColumnName, BiFunction, ?, ?> combineFunc)
throws IllegalStateException, IllegalArgumentException;
/**
* Combines three columns into a new column in the DataSet.
*
* The new column is created by applying a TriFunction to the values of the specified columns for each row.
* The TriFunction takes the values of the three existing columns for a particular row and returns the value for the new column for that row.
*
* @param columnNames A Tuple3 containing the names of the three columns to be combined. These should be names that exist in the DataSet.
* @param newColumnName The name of the new column to be created. It should not be a name that already exists in the DataSet.
* @param combineFunc The TriFunction to generate the values for the new column. It takes the values of the three existing columns for a particular row and returns the value for the new column for that row.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if any of the specified column names does not exist in the DataSet is empty or the new column name already exists in the DataSet.
*/
void combineColumns(Tuple3 columnNames, String newColumnName, TriFunction, ?, ?, ?> combineFunc)
throws IllegalStateException, IllegalArgumentException;
/**
* Combines multiple columns into a new column in the DataSet based on a column name filter.
*
* The new column is created by combining the values of the specified columns for each row. The type of the new column is specified by the newColumnType parameter.
*
* The columns to be combined are determined by the columnNameFilter. If the columnNameFilter returns {@code true} for a column name, that column is included in the combination.
*
* @param columnNameFilter A Predicate function to determine which columns should be combined. It should return {@code true} for column names that should be combined, and {@code false} for those that should be kept.
* @param newColumnName The name of the new column to be created. It should not be a name that already exists in the DataSet.
* @param newColumnType The Class object representing the type of the new column.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if none of column name matches the specified {@code columnNameFilter} or the new column name already exists in the DataSet.
*/
void combineColumns(Predicate super String> columnNameFilter, String newColumnName, Class> newColumnType)
throws IllegalStateException, IllegalArgumentException;
/**
* Combines multiple columns into a new column in the DataSet based on a column name filter.
*
* The new column is created by applying a function to the values of the specified columns for each row. The function takes a DisposableObjArray of the values in the existing columns for a particular row and returns the value for the new column for that row.
*
* The columns to be combined are determined by the columnNameFilter. If the columnNameFilter returns {@code true} for a column name, that column is included in the combination.
*
* @param columnNameFilter A Predicate function to determine which columns should be combined. It should return {@code true} for column names that should be combined, and {@code false} for those that should be kept.
* @param newColumnName The name of the new column to be created. It should not be a name that already exists in the DataSet.
* @param combineFunc The function to generate the values for the new column. It takes a DisposableObjArray of the values in the existing columns for a particular row and returns the value for the new column for that row.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if none of column name matches the specified {@code columnNameFilter} or the new column name already exists in the DataSet.
*/
void combineColumns(Predicate super String> columnNameFilter, String newColumnName, Function super DisposableObjArray, ?> combineFunc)
throws IllegalStateException, IllegalArgumentException;
/**
* Divides a column into multiple new columns in the DataSet.
*
* The division is performed by applying a function to each value in the specified column. The function takes the current value and returns a List of new values, each of which will be a value in one of the new columns.
*
* The new columns are added at the end of the existing columns.
*
* @param columnName The name of the column to be divided. It should be a name that exists in the DataSet.
* @param newColumnNames A collection containing the names of the new columns to be created. These should not be names that already exist in the DataSet. The size of this collection should match the size of the Lists returned by the divideFunc.
* @param divideFunc The function to be applied to each value in the column. It takes the current value and returns a List of new values. The size of this List should match the size of the newColumnNames collection.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet, any of the new column names already exist in the DataSet, or {@code newColumnNames} is empty, or the size of the Lists returned by the divideFunc does not match the size of the newColumnNames collection.
*/
void divideColumn(String columnName, Collection newColumnNames, Function, ? extends List>> divideFunc)
throws IllegalStateException, IllegalArgumentException;
/**
* Divides a column into multiple new columns in the DataSet.
*
* The division is performed by applying a BiConsumer to each value in the specified column. The BiConsumer takes the current value and an Object array, and it should populate the array with the new values for the new columns.
*
* The new columns are added at the end of the existing columns.
*
* @param columnName The name of the column to be divided. It should be a name that exists in the DataSet.
* @param newColumnNames A collection containing the names of the new columns to be created. These should not be names that already exist in the DataSet. The size of this collection should match the size of the Object array populated by the output BiConsumer.
* @param output The BiConsumer to be applied to each value in the column. It takes the current value and an Object array, and it should populate the array with the new values for the new columns.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet, any of the new column names already exist in the DataSet, or {@code newColumnNames} is empty.
*/
void divideColumn(String columnName, Collection newColumnNames, BiConsumer, Object[]> output)
throws IllegalStateException, IllegalArgumentException;
/**
* Divides a column into two new columns in the DataSet.
*
* The division is performed by applying a BiConsumer to each value in the specified column. The BiConsumer takes the current value and a Pair object, and it should populate the Pair with the new values for the new columns.
*
* The new columns are added at the end of the existing columns.
*
* @param columnName The name of the column to be divided. It should be a name that exists in the DataSet.
* @param newColumnNames A Tuple2 containing the names of the two new columns to be created. These should not be names that already exist in the DataSet.
* @param output The BiConsumer to be applied to each value in the column. It takes the current value and a Pair object, and it should populate the Pair with the new values for the new columns.
* @throws IllegalStateException if the DataSet is frozen (read-only).
* @throws IllegalArgumentException if the specified column name does not exist in the DataSet, any of the new column names already exist in the DataSet.
*/
void divideColumn(String columnName, Tuple2 newColumnNames, BiConsumer, Pair