Package adams.data.binning.operation
Class Split
- java.lang.Object
-
- adams.data.binning.operation.Split
-
public class Split extends Object
For splitting data according to a percentage.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description Split()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static int
calcNumItems(int total, double percentage)
Calculates the number of items the percentage represents.static <T> com.github.fracpete.javautils.struct.Struct2<List<Binnable<T>>,List<Binnable<T>>>
split(List<Binnable<T>> data, double percentage)
Splits the data into two, using the percentage for the first lot of data.static <T> com.github.fracpete.javautils.struct.Struct2<List<BinnableGroup<T>>,List<BinnableGroup<T>>>
splitGroups(List<BinnableGroup<T>> data, double percentage)
Splits the grouped data into two, using the percentage for the first lot of data.
-
-
-
Method Detail
-
calcNumItems
protected static int calcNumItems(int total, double percentage)
Calculates the number of items the percentage represents.- Parameters:
total
- the total number of itemspercentage
- the percentage to use (0-1)- Returns:
- the number of items
-
split
public static <T> com.github.fracpete.javautils.struct.Struct2<List<Binnable<T>>,List<Binnable<T>>> split(List<Binnable<T>> data, double percentage)
Splits the data into two, using the percentage for the first lot of data.- Type Parameters:
T
- the payload type- Parameters:
data
- the data to splitpercentage
- the percentage (0-1)- Returns:
- the split data
-
splitGroups
public static <T> com.github.fracpete.javautils.struct.Struct2<List<BinnableGroup<T>>,List<BinnableGroup<T>>> splitGroups(List<BinnableGroup<T>> data, double percentage)
Splits the grouped data into two, using the percentage for the first lot of data.- Type Parameters:
T
- the payload type- Parameters:
data
- the data to splitpercentage
- the percentage (0-1)- Returns:
- the split data
-
-