java.lang.Object
ai.timefold.solver.core.preview.api.neighborhood.stream.joiner.NeighborhoodsJoiners

@NullMarked public final class NeighborhoodsJoiners extends Object
  • Method Details

    • equal

      public static <A> BiNeighborhoodsJoiner<A,A> equal()
      As defined by equal(Function) with Function.identity() as the argument.
      Type Parameters:
      A - the type of both objects
    • equal

      public static <A, Property_> BiNeighborhoodsJoiner<A,A> equal(Function<A,Property_> mapping)
      As defined by equal(Function, Function) with both arguments using the same mapping.
      Type Parameters:
      A - the type of both objects
      Property_ - the type of the property to compare
      Parameters:
      mapping - mapping function to apply to both A and B
    • equal

      public static <A, B, Property_> BiNeighborhoodsJoiner<A,B> equal(Function<A,Property_> leftMapping, Function<B,Property_> rightMapping)
      Joins every A and B that share a property. These are exactly the pairs where leftMapping.apply(A).equals(rightMapping.apply(B)). For example, on a cartesian product of list [Ann(age = 20), Beth(age = 25), Eric(age = 20)] with both leftMapping and rightMapping being Person::getAge, this joiner will produce pairs (Ann, Ann), (Ann, Eric), (Beth, Beth), (Eric, Ann), (Eric, Eric).
      Type Parameters:
      B - the type of object on the right
      Property_ - the type of the property to compare
      Parameters:
      leftMapping - mapping function to apply to A
      rightMapping - mapping function to apply to B
    • lessThan

      public static <A, Property_ extends Comparable<Property_>> BiNeighborhoodsJoiner<A,A> lessThan(Function<A,Property_> mapping)
      As defined by lessThan(Function, Function) with both arguments using the same mapping.
      Type Parameters:
      A - the type of both objects
      Property_ - the type of the property to compare
      Parameters:
      mapping - mapping function to apply
    • lessThan

      public static <A, B, Property_ extends Comparable<Property_>> BiNeighborhoodsJoiner<A,B> lessThan(Function<A,Property_> leftMapping, Function<B,Property_> rightMapping)
      Joins every A and B where a value of property on A is less than the value of a property on B. These are exactly the pairs where leftMapping.apply(A).compareTo(rightMapping.apply(B)) < 0. For example, on a cartesian product of list [Ann(age = 20), Beth(age = 25), Eric(age = 20)] with both leftMapping and rightMapping being Person::getAge, this joiner will produce pairs (Ann, Beth), (Eric, Beth).
      Type Parameters:
      A - the type of object on the left
      B - the type of object on the right
      Property_ - the type of the property to compare
      Parameters:
      leftMapping - mapping function to apply to A
      rightMapping - mapping function to apply to B
    • lessThanOrEqual

      public static <A, Property_ extends Comparable<Property_>> BiNeighborhoodsJoiner<A,A> lessThanOrEqual(Function<A,Property_> mapping)
      As defined by lessThanOrEqual(Function, Function) with both arguments using the same mapping.
      Type Parameters:
      A - the type of both objects
      Property_ - the type of the property to compare
      Parameters:
      mapping - mapping function to apply
    • lessThanOrEqual

      public static <A, B, Property_ extends Comparable<Property_>> BiNeighborhoodsJoiner<A,B> lessThanOrEqual(Function<A,Property_> leftMapping, Function<B,Property_> rightMapping)
      Joins every A and B where a value of property on A is less than or equal to the value of a property on B. These are exactly the pairs where leftMapping.apply(A).compareTo(rightMapping.apply(B)) <= 0. For example, on a cartesian product of list [Ann(age = 20), Beth(age = 25), Eric(age = 20)] with both leftMapping and rightMapping being Person::getAge, this joiner will produce pairs (Ann, Ann), (Ann, Beth), (Ann, Eric), (Beth, Beth), (Eric, Ann), (Eric, Beth), (Eric, Eric).
      Type Parameters:
      A - the type of object on the left
      B - the type of object on the right
      Property_ - the type of the property to compare
      Parameters:
      leftMapping - mapping function to apply to A
      rightMapping - mapping function to apply to B
    • greaterThan

      public static <A, Property_ extends Comparable<Property_>> BiNeighborhoodsJoiner<A,A> greaterThan(Function<A,Property_> mapping)
      As defined by greaterThan(Function, Function) with both arguments using the same mapping.
      Type Parameters:
      A - the type of both objects
      Property_ - the type of the property to compare
      Parameters:
      mapping - mapping function to apply
    • greaterThan

      public static <A, B, Property_ extends Comparable<Property_>> BiNeighborhoodsJoiner<A,B> greaterThan(Function<A,Property_> leftMapping, Function<B,Property_> rightMapping)
      Joins every A and B where a value of property on A is greater than the value of a property on B. These are exactly the pairs where leftMapping.apply(A).compareTo(rightMapping.apply(B)) > 0. For example, on a cartesian product of list [Ann(age = 20), Beth(age = 25), Eric(age = 20)] with both leftMapping and rightMapping being Person::getAge, this joiner will produce pairs (Beth, Ann), (Beth, Eric).
      Type Parameters:
      A - the type of object on the left
      B - the type of object on the right
      Property_ - the type of the property to compare
      Parameters:
      leftMapping - mapping function to apply to A
      rightMapping - mapping function to apply to B
    • greaterThanOrEqual

      public static <A, Property_ extends Comparable<Property_>> BiNeighborhoodsJoiner<A,A> greaterThanOrEqual(Function<A,Property_> mapping)
      As defined by greaterThanOrEqual(Function, Function) with both arguments using the same mapping.
      Type Parameters:
      A - the type of both objects
      Property_ - the type of the property to compare
      Parameters:
      mapping - mapping function to apply
    • greaterThanOrEqual

      public static <A, B, Property_ extends Comparable<Property_>> BiNeighborhoodsJoiner<A,B> greaterThanOrEqual(Function<A,Property_> leftMapping, Function<B,Property_> rightMapping)
      Joins every A and B where a value of property on A is greater than or equal to the value of a property on B. These are exactly the pairs where leftMapping.apply(A).compareTo(rightMapping.apply(B)) >= 0. For example, on a cartesian product of list [Ann(age = 20), Beth(age = 25), Eric(age = 20)] with both leftMapping and rightMapping being Person::getAge, this joiner will produce pairs (Ann, Ann), (Ann, Eric), (Beth, Ann), (Beth, Beth), (Beth, Eric), (Eric, Ann), (Eric, Eric).
      Type Parameters:
      A - the type of object on the left
      B - the type of object on the right
      Property_ - the type of the property to compare
      Parameters:
      leftMapping - mapping function to apply to A
      rightMapping - mapping function to apply to B
    • filtering

      public static <Solution_, A, B> BiNeighborhoodsJoiner<A,B> filtering(BiNeighborhoodsPredicate<Solution_,A,B> filter)
      Applies a filter to the joined tuple, with the semantics of BiConstraintStream.filter(BiPredicate). For example, on a cartesian product of list [Ann(age = 20), Beth(age = 25), Eric(age = 20)] with filter being age == 20, this joiner will produce pairs (Ann, Ann), (Ann, Eric), (Eric, Ann), (Eric, Eric).
      Type Parameters:
      A - type of the first fact in the tuple
      B - type of the second fact in the tuple
      Parameters:
      filter - filter to apply
    • overlapping

      public static <A, Property_ extends Comparable<Property_>> BiNeighborhoodsJoiner<A,A> overlapping(Function<A,Property_> startMapping, Function<A,Property_> endMapping)
      Joins every A and B that overlap for an interval which is specified by a start and end property on both A and B. These are exactly the pairs where A.start < B.end and A.end > B.start. For example, on a cartesian product of list [Ann(start=08:00, end=14:00), Beth(start=12:00, end=18:00), Eric(start=16:00, end=22:00)] with startMapping being Person::getStart and endMapping being Person::getEnd, this joiner will produce pairs (Ann, Ann), (Ann, Beth), (Beth, Ann), (Beth, Beth), (Beth, Eric), (Eric, Beth), (Eric, Eric).
      Type Parameters:
      A - the type of both the first and second argument
      Property_ - the type used to define the interval, comparable
      Parameters:
      startMapping - maps the argument to the start point of its interval (inclusive)
      endMapping - maps the argument to the end point of its interval (exclusive)
    • overlapping

      public static <A, B, Property_ extends Comparable<Property_>> BiNeighborhoodsJoiner<A,B> overlapping(Function<A,Property_> leftStartMapping, Function<A,Property_> leftEndMapping, Function<B,Property_> rightStartMapping, Function<B,Property_> rightEndMapping)
      Type Parameters:
      A - the type of the first argument
      B - the type of the second argument
      Property_ - the type used to define the interval, comparable
      Parameters:
      leftStartMapping - maps the first argument to its interval start point (inclusive)
      leftEndMapping - maps the first argument to its interval end point (exclusive)
      rightStartMapping - maps the second argument to its interval start point (inclusive)
      rightEndMapping - maps the second argument to its interval end point (exclusive)