Class CartesianProduct

java.lang.Object
ca.phon.alignedTypesDatabase.CartesianProduct

public final class CartesianProduct extends Object
Some helpful array methods used by the database
  • Constructor Details

    • CartesianProduct

      public CartesianProduct()
  • Method Details

    • stringArrayProduct

      public static String[][] stringArrayProduct(String[][] arrays)
      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

      public static <T> T[][] product(Class<T> clazz, T[][] arrays)
      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 value
      arrays - array of arrays of type T
      Returns:
    • product

      public static <T> T[][] product(Class<T> clazz, T[][] arrays, Function<T[],Boolean> includeSet)
      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 T
      includeSet - used to filter sets returned by the product
      Returns: