Package ca.phon.alignedTypesDatabase
Class CartesianProduct
java.lang.Object
ca.phon.alignedTypesDatabase.CartesianProduct
Some helpful array methods used by the database
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T[][]
Calculate and return cartesian product of arrays E.g., Given:static <T> T[][]
Calculate and return cartesian product of arrays E.g., Given:static String[][]
stringArrayProduct
(String[][] arrays) Calculate cartesian set of provided string arraysstatic String[][]
stringArrayProduct
(String[][] arrays, Function<String[], Boolean> includeSet) Calculate cartesian set of provided string arrays
-
Constructor Details
-
CartesianProduct
public CartesianProduct()
-
-
Method Details
-
stringArrayProduct
Calculate cartesian set of provided string arrays- Parameters:
arrays
-- Returns:
- cartestian product of arrays, no null values are returned
-
stringArrayProduct
public static String[][] stringArrayProduct(String[][] arrays, Function<String[], Boolean> includeSet) Calculate cartesian set of provided string arrays- Parameters:
arrays
-includeSet
-- Returns:
- cartestian product of arrays, no null values are returned
-
product
Calculate and return cartesian product of arrays E.g., Given:String[][] arrays = new String[3][]; arrays[0] = new String[]{ "v1", "v2" }; arrays[1] = new String[]{ "v3", "v4" }; arrays[2] = new String[]{ "v5", "v6" };
return[v1, v3, v5] [v1, v3, v6] [v1, v4, v5] [v1, v4, v6] [v2, v3, v5] [v2, v3, v6] [v2, v4, v5] [v2, v4, v6]
- Parameters:
clazz
- type of array for return valuearrays
- array of arrays of type T- Returns:
-
product
Calculate and return cartesian product of arrays E.g., Given:String[][] arrays = new String[3][]; arrays[0] = new String[]{ "v1", "v2" }; arrays[1] = new String[]{ "v3", "v4" }; arrays[2] = new String[]{ "v5", "v6" };
return[v1, v3, v5] [v1, v3, v6] [v1, v4, v5] [v1, v4, v6] [v2, v3, v5] [v2, v3, v6] [v2, v4, v5] [v2, v4, v6]
- Parameters:
clazz
-arrays
- array of arrays of type TincludeSet
- used to filter sets returned by the product- Returns:
-