Class Groupings

java.lang.Object
org.moeaframework.analysis.stream.Groupings

public class Groupings extends Object
Collection of grouping functions, to be used with DataStream.groupBy(Function) or Partition.groupBy(Function).
  • Method Details

    • pair

      public static <T, L, R> Function<T,org.apache.commons.lang3.tuple.Pair<L,R>> pair(Function<T,L> left, Function<T,R> right)
      Group items by combining two grouping functions.
      Type Parameters:
      T - the type of each value
      L - the type of the left key
      R - the type of the right key
      Parameters:
      left - the left grouping function
      right - the right grouping function
      Returns:
      the grouping function
    • exactValue

      public static <T> Function<Sample,T> exactValue(Parameter<T> parameter)
      Groups items by their exact parameter value.
      Type Parameters:
      T - the type of the parameter
      Parameters:
      parameter - the parameter
      Returns:
      the grouping function
    • exactValue

      public static <T> Function<T,T> exactValue()
      Groups items by their exact value.
      Type Parameters:
      T - the type of each value
      Returns:
      the grouping function
    • bucket

      public static Function<Sample,Integer> bucket(Parameter<Integer> parameter, int width)
      Buckets an integer-valued parameter into groups with similar values.
      Parameters:
      parameter - the integer-valued parameter
      width - the width of the bucket
      Returns:
      the grouping function
    • bucket

      public static Function<Sample,Long> bucket(Parameter<Long> parameter, long width)
      Buckets a long-valued parameter into groups with similar values.
      Parameters:
      parameter - the long-valued parameter
      width - the width of the bucket
      Returns:
      the grouping function
    • bucket

      public static Function<Sample,Double> bucket(Parameter<Double> parameter, double width)
      Buckets an decimal-valued parameter into groups with similar values.
      Parameters:
      parameter - the decimal-valued parameter
      width - the width of the bucket
      Returns:
      the grouping function
    • bucket

      public static Function<Integer,Integer> bucket(int width)
      Buckets an integer stream into groups with similar values.
      Parameters:
      width - the width of the bucket
      Returns:
      the grouping function
    • bucket

      public static Function<Long,Long> bucket(long width)
      Buckets a long stream into groups with similar values.
      Parameters:
      width - the width of the bucket
      Returns:
      the grouping function
    • bucket

      public static Function<Double,Double> bucket(double width)
      Buckets a decimal stream into groups with similar values.
      Parameters:
      width - the width of the bucket
      Returns:
      the grouping function
    • round

      public static Function<Sample,Integer> round(Parameter<Double> parameter)
      Groups numeric values by their rounded value.
      Parameters:
      parameter - the parameter
      Returns:
      the grouping function
    • round

      public static Function<Double,Integer> round()
      Groups numeric values by their rounded value.
      Returns:
      the grouping function