Class NeighborhoodsJoiners
java.lang.Object
ai.timefold.solver.core.preview.api.neighborhood.stream.joiner.NeighborhoodsJoiners
Creates an
BiNeighborhoodsJoiner, ... instance
for use in UniEnumeratingStream.join(Class, BiNeighborhoodsJoiner[]), ...-
Method Summary
Modifier and TypeMethodDescriptionstatic <A> BiNeighborhoodsJoiner<A,A> equal()As defined byequal(Function)withFunction.identity()as the argument.static <A,Property_>
BiNeighborhoodsJoiner<A,A> As defined byequal(Function, Function)with both arguments using the same mapping.static <A,B, Property_>
BiNeighborhoodsJoiner<A,B> Joins every A and B that share a property.static <Solution_,A, B>
BiNeighborhoodsJoiner<A,B> filtering(BiNeighborhoodsPredicate<Solution_, A, B> filter) Applies a filter to the joined tuple, with the semantics ofBiConstraintStream.filter(BiPredicate).static <A,Property_ extends Comparable<Property_>>
BiNeighborhoodsJoiner<A,A> greaterThan(Function<A, Property_> mapping) As defined bygreaterThan(Function, Function)with both arguments using the same mapping.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.static <A,Property_ extends Comparable<Property_>>
BiNeighborhoodsJoiner<A,A> greaterThanOrEqual(Function<A, Property_> mapping) As defined bygreaterThanOrEqual(Function, Function)with both arguments using the same mapping.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.static <A,Property_ extends Comparable<Property_>>
BiNeighborhoodsJoiner<A,A> As defined bylessThan(Function, Function)with both arguments using the same mapping.static <A,B, Property_ extends Comparable<Property_>>
BiNeighborhoodsJoiner<A,B> Joins every A and B where a value of property on A is less than the value of a property on B.static <A,Property_ extends Comparable<Property_>>
BiNeighborhoodsJoiner<A,A> lessThanOrEqual(Function<A, Property_> mapping) As defined bylessThanOrEqual(Function, Function)with both arguments using the same mapping.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.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.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) As defined byoverlapping(Function, Function).
-
Method Details
-
equal
As defined byequal(Function)withFunction.identity()as the argument.- Type Parameters:
A- the type of both objects
-
equal
As defined byequal(Function, Function)with both arguments using the same mapping.- Type Parameters:
A- the type of both objectsProperty_- the type of the property to compare- Parameters:
mapping- mapping function to apply to both A and B
-
equal
public static <A,B, BiNeighborhoodsJoiner<A,Property_> B> equal(Function<A, Property_> leftMapping, Function<B, Property_> rightMapping) Joins every A and B that share a property. These are exactly the pairs whereleftMapping.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 beingPerson::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 rightProperty_- the type of the property to compare- Parameters:
leftMapping- mapping function to apply to ArightMapping- mapping function to apply to B
-
lessThan
public static <A,Property_ extends Comparable<Property_>> BiNeighborhoodsJoiner<A,A> lessThan(Function<A, Property_> mapping) As defined bylessThan(Function, Function)with both arguments using the same mapping.- Type Parameters:
A- the type of both objectsProperty_- the type of the property to compare- Parameters:
mapping- mapping function to apply
-
lessThan
public static <A,B, BiNeighborhoodsJoiner<A,Property_ extends Comparable<Property_>> 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 whereleftMapping.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 beingPerson::getAge, this joiner will produce pairs(Ann, Beth), (Eric, Beth).- Type Parameters:
A- the type of object on the leftB- the type of object on the rightProperty_- the type of the property to compare- Parameters:
leftMapping- mapping function to apply to ArightMapping- mapping function to apply to B
-
lessThanOrEqual
public static <A,Property_ extends Comparable<Property_>> BiNeighborhoodsJoiner<A,A> lessThanOrEqual(Function<A, Property_> mapping) As defined bylessThanOrEqual(Function, Function)with both arguments using the same mapping.- Type Parameters:
A- the type of both objectsProperty_- the type of the property to compare- Parameters:
mapping- mapping function to apply
-
lessThanOrEqual
public static <A,B, BiNeighborhoodsJoiner<A,Property_ extends Comparable<Property_>> 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 whereleftMapping.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 beingPerson::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 leftB- the type of object on the rightProperty_- the type of the property to compare- Parameters:
leftMapping- mapping function to apply to ArightMapping- mapping function to apply to B
-
greaterThan
public static <A,Property_ extends Comparable<Property_>> BiNeighborhoodsJoiner<A,A> greaterThan(Function<A, Property_> mapping) As defined bygreaterThan(Function, Function)with both arguments using the same mapping.- Type Parameters:
A- the type of both objectsProperty_- the type of the property to compare- Parameters:
mapping- mapping function to apply
-
greaterThan
public static <A,B, BiNeighborhoodsJoiner<A,Property_ extends Comparable<Property_>> 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 whereleftMapping.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 beingPerson::getAge, this joiner will produce pairs(Beth, Ann), (Beth, Eric).- Type Parameters:
A- the type of object on the leftB- the type of object on the rightProperty_- the type of the property to compare- Parameters:
leftMapping- mapping function to apply to ArightMapping- mapping function to apply to B
-
greaterThanOrEqual
public static <A,Property_ extends Comparable<Property_>> BiNeighborhoodsJoiner<A,A> greaterThanOrEqual(Function<A, Property_> mapping) As defined bygreaterThanOrEqual(Function, Function)with both arguments using the same mapping.- Type Parameters:
A- the type of both objectsProperty_- the type of the property to compare- Parameters:
mapping- mapping function to apply
-
greaterThanOrEqual
public static <A,B, BiNeighborhoodsJoiner<A,Property_ extends Comparable<Property_>> 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 whereleftMapping.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 beingPerson::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 leftB- the type of object on the rightProperty_- the type of the property to compare- Parameters:
leftMapping- mapping function to apply to ArightMapping- mapping function to apply to B
-
filtering
public static <Solution_,A, BiNeighborhoodsJoiner<A,B> B> filtering(BiNeighborhoodsPredicate<Solution_, A, B> filter) Applies a filter to the joined tuple, with the semantics ofBiConstraintStream.filter(BiPredicate). For example, on a cartesian product of list[Ann(age = 20), Beth(age = 25), Eric(age = 20)]with filter beingage == 20, this joiner will produce pairs(Ann, Ann), (Ann, Eric), (Eric, Ann), (Eric, Eric).- Type Parameters:
A- type of the first fact in the tupleB- 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 whereA.start < B.endandA.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 beingPerson::getStartand endMapping beingPerson::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 argumentProperty_- 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, BiNeighborhoodsJoiner<A,Property_ extends Comparable<Property_>> B> overlapping(Function<A, Property_> leftStartMapping, Function<A, Property_> leftEndMapping, Function<B, Property_> rightStartMapping, Function<B, Property_> rightEndMapping) As defined byoverlapping(Function, Function).- Type Parameters:
A- the type of the first argumentB- the type of the second argumentProperty_- 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)
-