Interface UniConstraintStream<A>
-
- Type Parameters:
A
- the type of the first and only fact in the tuple.
- All Superinterfaces:
ConstraintStream
- All Known Subinterfaces:
InnerUniConstraintStream<A>
- All Known Implementing Classes:
BavetAbstractUniConstraintStream
,BavetFilterUniConstraintStream
,BavetFromUniConstraintStream
,BavetGroupBridgeUniConstraintStream
,BavetJoinBridgeUniConstraintStream
,BavetScoringUniConstraintStream
,DroolsAbstractUniConstraintStream
,DroolsExistsUniConstraintStream
,DroolsFilterUniConstraintStream
,DroolsFlatteningUniConstraintStream
,DroolsFromUniConstraintStream
,DroolsGroupingUniConstraintStream
,DroolsMappingUniConstraintStream
public interface UniConstraintStream<A> extends ConstraintStream
AConstraintStream
that matches one fact.- See Also:
ConstraintStream
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description UniConstraintStream<A>
distinct()
Transforms the stream in such a way that all the tuples going through it are distinct.UniConstraintStream<A>
filter(Predicate<A> predicate)
Exhaustively test each fact against thePredicate
and match ifPredicate.test(Object)
returns true.<ResultA_> UniConstraintStream<ResultA_>
flattenLast(Function<A,Iterable<ResultA_>> mapping)
Takes each tuple and applies a mapping on it, which turns the tuple into aIterable
.<GroupKey_>
UniConstraintStream<GroupKey_>groupBy(Function<A,GroupKey_> groupKeyMapping)
Convert theUniConstraintStream
to a differentUniConstraintStream
, containing the set of tuples resulting from applying the group key mapping function on all tuples of the original stream.<GroupKey_,ResultContainer_,Result_>
BiConstraintStream<GroupKey_,Result_>groupBy(Function<A,GroupKey_> groupKeyMapping, UniConstraintCollector<A,ResultContainer_,Result_> collector)
Convert theUniConstraintStream
to aBiConstraintStream
, consisting of unique tuples with two facts.<GroupKey_,ResultContainerB_,ResultB_,ResultContainerC_,ResultC_>
TriConstraintStream<GroupKey_,ResultB_,ResultC_>groupBy(Function<A,GroupKey_> groupKeyMapping, UniConstraintCollector<A,ResultContainerB_,ResultB_> collectorB, UniConstraintCollector<A,ResultContainerC_,ResultC_> collectorC)
Convert theUniConstraintStream
to aTriConstraintStream
, consisting of unique tuples with three facts.<GroupKey_,ResultContainerB_,ResultB_,ResultContainerC_,ResultC_,ResultContainerD_,ResultD_>
QuadConstraintStream<GroupKey_,ResultB_,ResultC_,ResultD_>groupBy(Function<A,GroupKey_> groupKeyMapping, UniConstraintCollector<A,ResultContainerB_,ResultB_> collectorB, UniConstraintCollector<A,ResultContainerC_,ResultC_> collectorC, UniConstraintCollector<A,ResultContainerD_,ResultD_> collectorD)
Convert theUniConstraintStream
to aQuadConstraintStream
, consisting of unique tuples with four facts.<GroupKeyA_,GroupKeyB_>
BiConstraintStream<GroupKeyA_,GroupKeyB_>groupBy(Function<A,GroupKeyA_> groupKeyAMapping, Function<A,GroupKeyB_> groupKeyBMapping)
Convert theUniConstraintStream
to aBiConstraintStream
, consisting of unique tuples with two facts.<GroupKeyA_,GroupKeyB_,GroupKeyC_>
TriConstraintStream<GroupKeyA_,GroupKeyB_,GroupKeyC_>groupBy(Function<A,GroupKeyA_> groupKeyAMapping, Function<A,GroupKeyB_> groupKeyBMapping, Function<A,GroupKeyC_> groupKeyCMapping)
Convert theUniConstraintStream
to aTriConstraintStream
, consisting of unique tuples with three facts.<GroupKeyA_,GroupKeyB_,GroupKeyC_,GroupKeyD_>
QuadConstraintStream<GroupKeyA_,GroupKeyB_,GroupKeyC_,GroupKeyD_>groupBy(Function<A,GroupKeyA_> groupKeyAMapping, Function<A,GroupKeyB_> groupKeyBMapping, Function<A,GroupKeyC_> groupKeyCMapping, Function<A,GroupKeyD_> groupKeyDMapping)
Convert theUniConstraintStream
to aQuadConstraintStream
, consisting of unique tuples with four facts.<GroupKeyA_,GroupKeyB_,GroupKeyC_,ResultContainerD_,ResultD_>
QuadConstraintStream<GroupKeyA_,GroupKeyB_,GroupKeyC_,ResultD_>groupBy(Function<A,GroupKeyA_> groupKeyAMapping, Function<A,GroupKeyB_> groupKeyBMapping, Function<A,GroupKeyC_> groupKeyCMapping, UniConstraintCollector<A,ResultContainerD_,ResultD_> collectorD)
Combines the semantics ofgroupBy(Function, Function)
andgroupBy(UniConstraintCollector)
.<GroupKeyA_,GroupKeyB_,ResultContainer_,Result_>
TriConstraintStream<GroupKeyA_,GroupKeyB_,Result_>groupBy(Function<A,GroupKeyA_> groupKeyAMapping, Function<A,GroupKeyB_> groupKeyBMapping, UniConstraintCollector<A,ResultContainer_,Result_> collector)
Combines the semantics ofgroupBy(Function, Function)
andgroupBy(UniConstraintCollector)
.<GroupKeyA_,GroupKeyB_,ResultContainerC_,ResultC_,ResultContainerD_,ResultD_>
QuadConstraintStream<GroupKeyA_,GroupKeyB_,ResultC_,ResultD_>groupBy(Function<A,GroupKeyA_> groupKeyAMapping, Function<A,GroupKeyB_> groupKeyBMapping, UniConstraintCollector<A,ResultContainerC_,ResultC_> collectorC, UniConstraintCollector<A,ResultContainerD_,ResultD_> collectorD)
Combines the semantics ofgroupBy(Function, Function)
andgroupBy(UniConstraintCollector)
.<ResultContainer_,Result_>
UniConstraintStream<Result_>groupBy(UniConstraintCollector<A,ResultContainer_,Result_> collector)
Convert theUniConstraintStream
to a differentUniConstraintStream
, containing only a single tuple, the result of applyingUniConstraintCollector
.<ResultContainerA_,ResultA_,ResultContainerB_,ResultB_>
BiConstraintStream<ResultA_,ResultB_>groupBy(UniConstraintCollector<A,ResultContainerA_,ResultA_> collectorA, UniConstraintCollector<A,ResultContainerB_,ResultB_> collectorB)
Convert theUniConstraintStream
to aBiConstraintStream
, containing only a single tuple, the result of applying twoUniConstraintCollector
s.<ResultContainerA_,ResultA_,ResultContainerB_,ResultB_,ResultContainerC_,ResultC_>
TriConstraintStream<ResultA_,ResultB_,ResultC_>groupBy(UniConstraintCollector<A,ResultContainerA_,ResultA_> collectorA, UniConstraintCollector<A,ResultContainerB_,ResultB_> collectorB, UniConstraintCollector<A,ResultContainerC_,ResultC_> collectorC)
Convert theUniConstraintStream
to aTriConstraintStream
, containing only a single tuple, the result of applying threeUniConstraintCollector
s.<ResultContainerA_,ResultA_,ResultContainerB_,ResultB_,ResultContainerC_,ResultC_,ResultContainerD_,ResultD_>
QuadConstraintStream<ResultA_,ResultB_,ResultC_,ResultD_>groupBy(UniConstraintCollector<A,ResultContainerA_,ResultA_> collectorA, UniConstraintCollector<A,ResultContainerB_,ResultB_> collectorB, UniConstraintCollector<A,ResultContainerC_,ResultC_> collectorC, UniConstraintCollector<A,ResultContainerD_,ResultD_> collectorD)
Convert theUniConstraintStream
to aQuadConstraintStream
, containing only a single tuple, the result of applying fourUniConstraintCollector
s.default <B> UniConstraintStream<A>
ifExists(Class<B> otherClass, BiJoiner<A,B> joiner)
Create a newUniConstraintStream
for every A where B exists for which theBiJoiner
is true (for the properties it extracts from both facts).<B> UniConstraintStream<A>
ifExists(Class<B> otherClass, BiJoiner<A,B>... joiners)
As defined byifExists(Class, BiJoiner)
.default <B> UniConstraintStream<A>
ifExists(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2)
As defined byifExists(Class, BiJoiner)
.default <B> UniConstraintStream<A>
ifExists(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3)
As defined byifExists(Class, BiJoiner)
.default <B> UniConstraintStream<A>
ifExists(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3, BiJoiner<A,B> joiner4)
As defined byifExists(Class, BiJoiner)
.default <B> UniConstraintStream<A>
ifExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B> joiner)
Create a newUniConstraintStream
for every A where B exists for which theBiJoiner
is true (for the properties it extracts from both facts).<B> UniConstraintStream<A>
ifExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B>... joiners)
As defined byifExistsIncludingNullVars(Class, BiJoiner)
.default <B> UniConstraintStream<A>
ifExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2)
As defined byifExistsIncludingNullVars(Class, BiJoiner)
.default <B> UniConstraintStream<A>
ifExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3)
As defined byifExistsIncludingNullVars(Class, BiJoiner)
.default <B> UniConstraintStream<A>
ifExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3, BiJoiner<A,B> joiner4)
As defined byifExistsIncludingNullVars(Class, BiJoiner)
.default UniConstraintStream<A>
ifExistsOther(Class<A> otherClass)
Create a newUniConstraintStream
for every A, if another A exists that does notObject.equals(Object)
the first.default UniConstraintStream<A>
ifExistsOther(Class<A> otherClass, BiJoiner<A,A> joiner)
Create a newUniConstraintStream
for every A, if another A exists that does notObject.equals(Object)
the first, and for which theBiJoiner
is true (for the properties it extracts from both facts).default UniConstraintStream<A>
ifExistsOther(Class<A> otherClass, BiJoiner<A,A>... joiners)
As defined byifExistsOther(Class, BiJoiner)
.default UniConstraintStream<A>
ifExistsOther(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2)
As defined byifExistsOther(Class, BiJoiner)
.default UniConstraintStream<A>
ifExistsOther(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3)
As defined byifExistsOther(Class, BiJoiner)
.default UniConstraintStream<A>
ifExistsOther(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3, BiJoiner<A,A> joiner4)
As defined byifExistsOther(Class, BiJoiner)
.default UniConstraintStream<A>
ifExistsOtherIncludingNullVars(Class<A> otherClass)
Create a newUniConstraintStream
for every A, if another A exists that does notObject.equals(Object)
the first.default UniConstraintStream<A>
ifExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A> joiner)
Create a newUniConstraintStream
for every A, if another A exists that does notObject.equals(Object)
the first, and for which theBiJoiner
is true (for the properties it extracts from both facts).default UniConstraintStream<A>
ifExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A>... joiners)
As defined byifExistsOtherIncludingNullVars(Class, BiJoiner)
.default UniConstraintStream<A>
ifExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2)
As defined byifExistsOther(Class, BiJoiner)
.default UniConstraintStream<A>
ifExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3)
As defined byifExistsOtherIncludingNullVars(Class, BiJoiner)
.default UniConstraintStream<A>
ifExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3, BiJoiner<A,A> joiner4)
As defined byifExistsOtherIncludingNullVars(Class, BiJoiner)
.default <B> UniConstraintStream<A>
ifNotExists(Class<B> otherClass, BiJoiner<A,B> joiner)
Create a newUniConstraintStream
for every A where B does not exist for which theBiJoiner
is true (for the properties it extracts from both facts).<B> UniConstraintStream<A>
ifNotExists(Class<B> otherClass, BiJoiner<A,B>... joiners)
As defined byifNotExists(Class, BiJoiner)
.default <B> UniConstraintStream<A>
ifNotExists(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2)
As defined byifNotExists(Class, BiJoiner)
.default <B> UniConstraintStream<A>
ifNotExists(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3)
As defined byifNotExists(Class, BiJoiner)
.default <B> UniConstraintStream<A>
ifNotExists(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3, BiJoiner<A,B> joiner4)
As defined byifNotExists(Class, BiJoiner)
.default <B> UniConstraintStream<A>
ifNotExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B> joiner)
Create a newUniConstraintStream
for every A where B does not exist for which theBiJoiner
is true (for the properties it extracts from both facts).<B> UniConstraintStream<A>
ifNotExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B>... joiners)
As defined byifNotExistsIncludingNullVars(Class, BiJoiner)
.default <B> UniConstraintStream<A>
ifNotExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2)
As defined byifNotExistsIncludingNullVars(Class, BiJoiner)
.default <B> UniConstraintStream<A>
ifNotExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3)
As defined byifNotExistsIncludingNullVars(Class, BiJoiner)
.default <B> UniConstraintStream<A>
ifNotExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3, BiJoiner<A,B> joiner4)
As defined byifNotExistsIncludingNullVars(Class, BiJoiner)
.default UniConstraintStream<A>
ifNotExistsOther(Class<A> otherClass)
Create a newUniConstraintStream
for every A, if no other A exists that does notObject.equals(Object)
the first.default UniConstraintStream<A>
ifNotExistsOther(Class<A> otherClass, BiJoiner<A,A> joiner)
Create a newUniConstraintStream
for every A, if no other A exists that does notObject.equals(Object)
the first, and for which theBiJoiner
is true (for the properties it extracts from both facts).default UniConstraintStream<A>
ifNotExistsOther(Class<A> otherClass, BiJoiner<A,A>... joiners)
As defined byifNotExistsOther(Class, BiJoiner)
.default UniConstraintStream<A>
ifNotExistsOther(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2)
As defined byifNotExistsOther(Class, BiJoiner)
.default UniConstraintStream<A>
ifNotExistsOther(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3)
As defined byifNotExistsOther(Class, BiJoiner)
.default UniConstraintStream<A>
ifNotExistsOther(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3, BiJoiner<A,A> joiner4)
As defined byifNotExistsOther(Class, BiJoiner)
.default UniConstraintStream<A>
ifNotExistsOtherIncludingNullVars(Class<A> otherClass)
Create a newUniConstraintStream
for every A, if no other A exists that does notObject.equals(Object)
the first.default UniConstraintStream<A>
ifNotExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A> joiner)
Create a newUniConstraintStream
for every A, if no other A exists that does notObject.equals(Object)
the first, and for which theBiJoiner
is true (for the properties it extracts from both facts).default UniConstraintStream<A>
ifNotExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A>... joiners)
As defined byifNotExistsOtherIncludingNullVars(Class, BiJoiner)
.default UniConstraintStream<A>
ifNotExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2)
As defined byifNotExistsOtherIncludingNullVars(Class, BiJoiner)
.default UniConstraintStream<A>
ifNotExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3)
As defined byifNotExistsOtherIncludingNullVars(Class, BiJoiner)
.default UniConstraintStream<A>
ifNotExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3, BiJoiner<A,A> joiner4)
As defined byifNotExistsOtherIncludingNullVars(Class, BiJoiner)
.Constraint
impact(String constraintPackage, String constraintName, Score<?> constraintWeight, ToIntFunction<A> matchWeigher)
As defined byimpact(String, Score, ToIntFunction)
.default Constraint
impact(String constraintName, Score<?> constraintWeight, ToIntFunction<A> matchWeigher)
Positively or negatively impact theScore
by the constraintWeight multiplied by the match weight.Constraint
impactBigDecimal(String constraintPackage, String constraintName, Score<?> constraintWeight, Function<A,BigDecimal> matchWeigher)
As defined byimpactBigDecimal(String, Score, Function)
.default Constraint
impactBigDecimal(String constraintName, Score<?> constraintWeight, Function<A,BigDecimal> matchWeigher)
Positively or negatively impact theScore
by the constraintWeight multiplied by the match weight.Constraint
impactConfigurable(String constraintPackage, String constraintName, ToIntFunction<A> matchWeigher)
As defined byimpactConfigurable(String, ToIntFunction)
.default Constraint
impactConfigurable(String constraintName, ToIntFunction<A> matchWeigher)
Positively or negatively impact theScore
by theConstraintWeight
multiplied by the match weight.Constraint
impactConfigurableBigDecimal(String constraintPackage, String constraintName, Function<A,BigDecimal> matchWeigher)
As defined byimpactConfigurableBigDecimal(String, Function)
.default Constraint
impactConfigurableBigDecimal(String constraintName, Function<A,BigDecimal> matchWeigher)
Positively or negatively impact theScore
by theConstraintWeight
multiplied by the match weight.Constraint
impactConfigurableLong(String constraintPackage, String constraintName, ToLongFunction<A> matchWeigher)
As defined byimpactConfigurableLong(String, ToLongFunction)
.default Constraint
impactConfigurableLong(String constraintName, ToLongFunction<A> matchWeigher)
Positively or negatively impact theScore
by theConstraintWeight
multiplied by the match weight.Constraint
impactLong(String constraintPackage, String constraintName, Score<?> constraintWeight, ToLongFunction<A> matchWeigher)
As defined byimpactLong(String, Score, ToLongFunction)
.default Constraint
impactLong(String constraintName, Score<?> constraintWeight, ToLongFunction<A> matchWeigher)
Positively or negatively impact theScore
by the constraintWeight multiplied by the match weight.default <B> BiConstraintStream<A,B>
join(Class<B> otherClass)
Create a newBiConstraintStream
for every combination of A and B.default <B> BiConstraintStream<A,B>
join(Class<B> otherClass, BiJoiner<A,B> joiner)
Create a newBiConstraintStream
for every combination of A and B for which theBiJoiner
is true (for the properties it extracts from both facts).<B> BiConstraintStream<A,B>
join(Class<B> otherClass, BiJoiner<A,B>... joiners)
As defined byjoin(Class, BiJoiner)
.default <B> BiConstraintStream<A,B>
join(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2)
As defined byjoin(Class, BiJoiner)
.default <B> BiConstraintStream<A,B>
join(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3)
As defined byjoin(Class, BiJoiner)
.default <B> BiConstraintStream<A,B>
join(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3, BiJoiner<A,B> joiner4)
As defined byjoin(Class, BiJoiner)
.default <B> BiConstraintStream<A,B>
join(UniConstraintStream<B> otherStream)
Create a newBiConstraintStream
for every combination of A and B.<B> BiConstraintStream<A,B>
join(UniConstraintStream<B> otherStream, BiJoiner<A,B> joiner)
Create a newBiConstraintStream
for every combination of A and B for which theBiJoiner
is true (for the properties it extracts from both facts).<B> BiConstraintStream<A,B>
join(UniConstraintStream<B> otherStream, BiJoiner<A,B>... joiners)
As defined byjoin(UniConstraintStream, BiJoiner)
.default <B> BiConstraintStream<A,B>
join(UniConstraintStream<B> otherStream, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2)
As defined byjoin(UniConstraintStream, BiJoiner)
.default <B> BiConstraintStream<A,B>
join(UniConstraintStream<B> otherStream, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3)
As defined byjoin(UniConstraintStream, BiJoiner)
.default <B> BiConstraintStream<A,B>
join(UniConstraintStream<B> otherStream, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3, BiJoiner<A,B> joiner4)
As defined byjoin(UniConstraintStream, BiJoiner)
.<ResultA_> UniConstraintStream<ResultA_>
map(Function<A,ResultA_> mapping)
Transforms the stream in such a way that tuples are remapped using the given function.Constraint
penalize(String constraintPackage, String constraintName, Score<?> constraintWeight, ToIntFunction<A> matchWeigher)
As defined bypenalize(String, Score, ToIntFunction)
.default Constraint
penalize(String constraintName, Score<?> constraintWeight, ToIntFunction<A> matchWeigher)
Negatively impact theScore
: subtract the constraintWeight multiplied by the match weight.Constraint
penalizeBigDecimal(String constraintPackage, String constraintName, Score<?> constraintWeight, Function<A,BigDecimal> matchWeigher)
As defined bypenalizeBigDecimal(String, Score, Function)
.default Constraint
penalizeBigDecimal(String constraintName, Score<?> constraintWeight, Function<A,BigDecimal> matchWeigher)
Negatively impact theScore
: subtract the constraintWeight multiplied by the match weight.Constraint
penalizeConfigurable(String constraintPackage, String constraintName, ToIntFunction<A> matchWeigher)
As defined bypenalizeConfigurable(String, ToIntFunction)
.default Constraint
penalizeConfigurable(String constraintName, ToIntFunction<A> matchWeigher)
Negatively impact theScore
: subtract theConstraintWeight
multiplied by the match weight.Constraint
penalizeConfigurableBigDecimal(String constraintPackage, String constraintName, Function<A,BigDecimal> matchWeigher)
As defined bypenalizeConfigurableBigDecimal(String, Function)
.default Constraint
penalizeConfigurableBigDecimal(String constraintName, Function<A,BigDecimal> matchWeigher)
Negatively impact theScore
: subtract theConstraintWeight
multiplied by the match weight.Constraint
penalizeConfigurableLong(String constraintPackage, String constraintName, ToLongFunction<A> matchWeigher)
As defined bypenalizeConfigurableLong(String, ToLongFunction)
.default Constraint
penalizeConfigurableLong(String constraintName, ToLongFunction<A> matchWeigher)
Negatively impact theScore
: subtract theConstraintWeight
multiplied by the match weight.Constraint
penalizeLong(String constraintPackage, String constraintName, Score<?> constraintWeight, ToLongFunction<A> matchWeigher)
As defined bypenalizeLong(String, Score, ToLongFunction)
.default Constraint
penalizeLong(String constraintName, Score<?> constraintWeight, ToLongFunction<A> matchWeigher)
Negatively impact theScore
: subtract the constraintWeight multiplied by the match weight.Constraint
reward(String constraintPackage, String constraintName, Score<?> constraintWeight, ToIntFunction<A> matchWeigher)
As defined byreward(String, Score, ToIntFunction)
.default Constraint
reward(String constraintName, Score<?> constraintWeight, ToIntFunction<A> matchWeigher)
Positively impact theScore
: add the constraintWeight multiplied by the match weight.Constraint
rewardBigDecimal(String constraintPackage, String constraintName, Score<?> constraintWeight, Function<A,BigDecimal> matchWeigher)
As defined byrewardBigDecimal(String, Score, Function)
.default Constraint
rewardBigDecimal(String constraintName, Score<?> constraintWeight, Function<A,BigDecimal> matchWeigher)
Positively impact theScore
: add the constraintWeight multiplied by the match weight.Constraint
rewardConfigurable(String constraintPackage, String constraintName, ToIntFunction<A> matchWeigher)
As defined byrewardConfigurable(String, ToIntFunction)
.default Constraint
rewardConfigurable(String constraintName, ToIntFunction<A> matchWeigher)
Positively impact theScore
: add theConstraintWeight
multiplied by the match weight.Constraint
rewardConfigurableBigDecimal(String constraintPackage, String constraintName, Function<A,BigDecimal> matchWeigher)
As defined byrewardConfigurableBigDecimal(String, Function)
.default Constraint
rewardConfigurableBigDecimal(String constraintName, Function<A,BigDecimal> matchWeigher)
Positively impact theScore
: add theConstraintWeight
multiplied by the match weight.Constraint
rewardConfigurableLong(String constraintPackage, String constraintName, ToLongFunction<A> matchWeigher)
As defined byrewardConfigurableLong(String, ToLongFunction)
.default Constraint
rewardConfigurableLong(String constraintName, ToLongFunction<A> matchWeigher)
Positively impact theScore
: add theConstraintWeight
multiplied by the match weight.Constraint
rewardLong(String constraintPackage, String constraintName, Score<?> constraintWeight, ToLongFunction<A> matchWeigher)
As defined byrewardLong(String, Score, ToLongFunction)
.default Constraint
rewardLong(String constraintName, Score<?> constraintWeight, ToLongFunction<A> matchWeigher)
Positively impact theScore
: add the constraintWeight multiplied by the match weight.-
Methods inherited from interface org.optaplanner.core.api.score.stream.ConstraintStream
getConstraintFactory, impact, impact, penalize, penalize, penalizeConfigurable, penalizeConfigurable, reward, reward, rewardConfigurable, rewardConfigurable
-
-
-
-
Method Detail
-
filter
UniConstraintStream<A> filter(Predicate<A> predicate)
Exhaustively test each fact against thePredicate
and match ifPredicate.test(Object)
returns true.- Parameters:
predicate
- never null- Returns:
- never null
-
join
default <B> BiConstraintStream<A,B> join(UniConstraintStream<B> otherStream)
Create a newBiConstraintStream
for every combination of A and B.Important:
Filtering
this is slower and less scalable than ajoin(UniConstraintStream, BiJoiner)
, because it doesn't apply hashing and/or indexing on the properties, so it creates and checks every combination of A and B.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherStream
- never null- Returns:
- never null, a stream that matches every combination of A and B
-
join
<B> BiConstraintStream<A,B> join(UniConstraintStream<B> otherStream, BiJoiner<A,B> joiner)
Create a newBiConstraintStream
for every combination of A and B for which theBiJoiner
is true (for the properties it extracts from both facts).Important: This is faster and more scalable than a
join
followed by afilter
, because it applies hashing and/or indexing on the properties, so it doesn't create nor checks every combination of A and B.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherStream
- never nulljoiner
- never null- Returns:
- never null, a stream that matches every combination of A and B for which the
BiJoiner
is true
-
join
default <B> BiConstraintStream<A,B> join(UniConstraintStream<B> otherStream, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2)
As defined byjoin(UniConstraintStream, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherStream
- never nulljoiner1
- never nulljoiner2
- never null- Returns:
- never null, a stream that matches every combination of A and B for which all the
joiners
are true
-
join
default <B> BiConstraintStream<A,B> join(UniConstraintStream<B> otherStream, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3)
As defined byjoin(UniConstraintStream, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherStream
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never null- Returns:
- never null, a stream that matches every combination of A and B for which all the
joiners
are true
-
join
default <B> BiConstraintStream<A,B> join(UniConstraintStream<B> otherStream, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3, BiJoiner<A,B> joiner4)
As defined byjoin(UniConstraintStream, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherStream
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never nulljoiner4
- never null- Returns:
- never null, a stream that matches every combination of A and B for which all the
joiners
are true
-
join
<B> BiConstraintStream<A,B> join(UniConstraintStream<B> otherStream, BiJoiner<A,B>... joiners)
As defined byjoin(UniConstraintStream, BiJoiner)
. If multipleBiJoiner
s are provided, for performance reasons, the indexing joiners must be placed before filtering joiners.This method causes Unchecked generics array creation for varargs parameter warnings, but we can't fix it with a
SafeVarargs
annotation because it's an interface method. Therefore, there are overloaded methods with up to 4BiJoiner
parameters.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherStream
- never nulljoiners
- never null- Returns:
- never null, a stream that matches every combination of A and B for which all the
joiners
are true
-
join
default <B> BiConstraintStream<A,B> join(Class<B> otherClass)
Create a newBiConstraintStream
for every combination of A and B.Important:
Filtering
this is slower and less scalable than ajoin(Class, BiJoiner)
, because it doesn't apply hashing and/or indexing on the properties, so it creates and checks every combination of A and B.Important: This is faster and more scalable than a
join
followed by afilter
, because it applies hashing and/or indexing on the properties, so it doesn't create nor checks every combination of A and B.Note that, if a legacy constraint stream uses
ConstraintFactory.from(Class)
as opposed toConstraintFactory.forEach(Class)
, a different range of B may be selected. (SeeConstraintFactory.from(Class)
Javadoc.)This method is syntactic sugar for
join(UniConstraintStream)
.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never null- Returns:
- never null, a stream that matches every combination of A and B
-
join
default <B> BiConstraintStream<A,B> join(Class<B> otherClass, BiJoiner<A,B> joiner)
Create a newBiConstraintStream
for every combination of A and B for which theBiJoiner
is true (for the properties it extracts from both facts).Important: This is faster and more scalable than a
join
followed by afilter
, because it applies hashing and/or indexing on the properties, so it doesn't create nor checks every combination of A and B.Note that, if a legacy constraint stream uses
ConstraintFactory.from(Class)
as opposed toConstraintFactory.forEach(Class)
, a different range of B may be selected. (SeeConstraintFactory.from(Class)
Javadoc.)This method is syntactic sugar for
join(UniConstraintStream, BiJoiner)
.This method has overloaded methods with multiple
BiJoiner
parameters.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner
- never null- Returns:
- never null, a stream that matches every combination of A and B for which the
BiJoiner
is true
-
join
default <B> BiConstraintStream<A,B> join(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2)
As defined byjoin(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never null- Returns:
- never null, a stream that matches every combination of A and B for which all the
joiners
are true
-
join
default <B> BiConstraintStream<A,B> join(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3)
As defined byjoin(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never null- Returns:
- never null, a stream that matches every combination of A and B for which all the
joiners
are true
-
join
default <B> BiConstraintStream<A,B> join(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3, BiJoiner<A,B> joiner4)
As defined byjoin(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never nulljoiner4
- never null- Returns:
- never null, a stream that matches every combination of A and B for which all the
joiners
are true
-
join
<B> BiConstraintStream<A,B> join(Class<B> otherClass, BiJoiner<A,B>... joiners)
As defined byjoin(Class, BiJoiner)
. For performance reasons, the indexing joiners must be placed before filtering joiners.This method causes Unchecked generics array creation for varargs parameter warnings, but we can't fix it with a
SafeVarargs
annotation because it's an interface method. Therefore, there are overloaded methods with up to 4BiJoiner
parameters.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiners
- never null- Returns:
- never null, a stream that matches every combination of A and B for which all the
joiners
are true
-
ifExists
default <B> UniConstraintStream<A> ifExists(Class<B> otherClass, BiJoiner<A,B> joiner)
Create a newUniConstraintStream
for every A where B exists for which theBiJoiner
is true (for the properties it extracts from both facts).This method has overloaded methods with multiple
BiJoiner
parameters.Note that, if a legacy constraint stream uses
ConstraintFactory.from(Class)
as opposed toConstraintFactory.forEach(Class)
, a different definition of exists applies. (SeeConstraintFactory.from(Class)
Javadoc.)- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner
- never null- Returns:
- never null, a stream that matches every A where B exists for which the
BiJoiner
is true
-
ifExists
default <B> UniConstraintStream<A> ifExists(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2)
As defined byifExists(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never null- Returns:
- never null, a stream that matches every A where B exists for which all the
BiJoiner
s are true
-
ifExists
default <B> UniConstraintStream<A> ifExists(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3)
As defined byifExists(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never null- Returns:
- never null, a stream that matches every A where B exists for which all the
BiJoiner
s are true
-
ifExists
default <B> UniConstraintStream<A> ifExists(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3, BiJoiner<A,B> joiner4)
As defined byifExists(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never nulljoiner4
- never null- Returns:
- never null, a stream that matches every A where B exists for which all the
BiJoiner
s are true
-
ifExists
<B> UniConstraintStream<A> ifExists(Class<B> otherClass, BiJoiner<A,B>... joiners)
As defined byifExists(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.This method causes Unchecked generics array creation for varargs parameter warnings, but we can't fix it with a
SafeVarargs
annotation because it's an interface method. Therefore, there are overloaded methods with up to 4BiJoiner
parameters.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiners
- never null- Returns:
- never null, a stream that matches every A where B exists for which all the
BiJoiner
s are true
-
ifExistsIncludingNullVars
default <B> UniConstraintStream<A> ifExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B> joiner)
Create a newUniConstraintStream
for every A where B exists for which theBiJoiner
is true (for the properties it extracts from both facts). For classes annotated withPlanningEntity
, this method also includes instances with null variables.This method has overloaded methods with multiple
BiJoiner
parameters.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner
- never null- Returns:
- never null, a stream that matches every A where B exists for which the
BiJoiner
is true
-
ifExistsIncludingNullVars
default <B> UniConstraintStream<A> ifExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2)
As defined byifExistsIncludingNullVars(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never null- Returns:
- never null, a stream that matches every A where B exists for which all the
BiJoiner
s are true
-
ifExistsIncludingNullVars
default <B> UniConstraintStream<A> ifExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3)
As defined byifExistsIncludingNullVars(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never null- Returns:
- never null, a stream that matches every A where B exists for which all the
BiJoiner
s are true
-
ifExistsIncludingNullVars
default <B> UniConstraintStream<A> ifExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3, BiJoiner<A,B> joiner4)
As defined byifExistsIncludingNullVars(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never nulljoiner4
- never null- Returns:
- never null, a stream that matches every A where B exists for which all the
BiJoiner
s are true
-
ifExistsIncludingNullVars
<B> UniConstraintStream<A> ifExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B>... joiners)
As defined byifExistsIncludingNullVars(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.This method causes Unchecked generics array creation for varargs parameter warnings, but we can't fix it with a
SafeVarargs
annotation because it's an interface method. Therefore, there are overloaded methods with up to 4BiJoiner
parameters.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiners
- never null- Returns:
- never null, a stream that matches every A where B exists for which all the
BiJoiner
s are true
-
ifExistsOther
default UniConstraintStream<A> ifExistsOther(Class<A> otherClass)
Create a newUniConstraintStream
for every A, if another A exists that does notObject.equals(Object)
the first.Note that, if a legacy constraint stream uses
ConstraintFactory.from(Class)
as opposed toConstraintFactory.forEach(Class)
, a different definition of exists applies. (SeeConstraintFactory.from(Class)
Javadoc.)- Parameters:
otherClass
- never null- Returns:
- never null, a stream that matches every A where a different A exists
-
ifExistsOther
default UniConstraintStream<A> ifExistsOther(Class<A> otherClass, BiJoiner<A,A> joiner)
Create a newUniConstraintStream
for every A, if another A exists that does notObject.equals(Object)
the first, and for which theBiJoiner
is true (for the properties it extracts from both facts).This method has overloaded methods with multiple
BiJoiner
parameters.Note that, if a legacy constraint stream uses
ConstraintFactory.from(Class)
as opposed toConstraintFactory.forEach(Class)
, a different definition of exists applies. (SeeConstraintFactory.from(Class)
Javadoc.)- Parameters:
otherClass
- never nulljoiner
- never null- Returns:
- never null, a stream that matches every A where a different A exists for which the
BiJoiner
is true
-
ifExistsOther
default UniConstraintStream<A> ifExistsOther(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2)
As defined byifExistsOther(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never null- Returns:
- never null, a stream that matches every A where a different A exists for which all the
BiJoiner
s are true
-
ifExistsOther
default UniConstraintStream<A> ifExistsOther(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3)
As defined byifExistsOther(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never null- Returns:
- never null, a stream that matches every A where a different A exists for which all the
BiJoiner
s are true
-
ifExistsOther
default UniConstraintStream<A> ifExistsOther(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3, BiJoiner<A,A> joiner4)
As defined byifExistsOther(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never nulljoiner4
- never null- Returns:
- never null, a stream that matches every A where a different A exists for which all the
BiJoiner
s are true
-
ifExistsOther
default UniConstraintStream<A> ifExistsOther(Class<A> otherClass, BiJoiner<A,A>... joiners)
As defined byifExistsOther(Class, BiJoiner)
. For performance reasons, the indexing joiners must be placed before filtering joiners.This method causes Unchecked generics array creation for varargs parameter warnings, but we can't fix it with a
SafeVarargs
annotation because it's an interface method. Therefore, there are overloaded methods with up to 4BiJoiner
parameters.- Parameters:
otherClass
- never nulljoiners
- never null- Returns:
- never null, a stream that matches every A where a different A exists for which all the
BiJoiner
s are true
-
ifExistsOtherIncludingNullVars
default UniConstraintStream<A> ifExistsOtherIncludingNullVars(Class<A> otherClass)
Create a newUniConstraintStream
for every A, if another A exists that does notObject.equals(Object)
the first. For classes annotated withPlanningEntity
, this method also includes instances with null variables.- Parameters:
otherClass
- never null- Returns:
- never null, a stream that matches every A where a different A exists
-
ifExistsOtherIncludingNullVars
default UniConstraintStream<A> ifExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A> joiner)
Create a newUniConstraintStream
for every A, if another A exists that does notObject.equals(Object)
the first, and for which theBiJoiner
is true (for the properties it extracts from both facts). For classes annotated withPlanningEntity
, this method also includes instances with null variables.This method has overloaded methods with multiple
BiJoiner
parameters.- Parameters:
otherClass
- never nulljoiner
- never null- Returns:
- never null, a stream that matches every A where a different A exists for which the
BiJoiner
is true
-
ifExistsOtherIncludingNullVars
default UniConstraintStream<A> ifExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2)
As defined byifExistsOther(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never null- Returns:
- never null, a stream that matches every A where a different A exists for which all the
BiJoiner
s are true
-
ifExistsOtherIncludingNullVars
default UniConstraintStream<A> ifExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3)
As defined byifExistsOtherIncludingNullVars(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never null- Returns:
- never null, a stream that matches every A where a different A exists for which all the
BiJoiner
s are true
-
ifExistsOtherIncludingNullVars
default UniConstraintStream<A> ifExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3, BiJoiner<A,A> joiner4)
As defined byifExistsOtherIncludingNullVars(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never nulljoiner4
- never null- Returns:
- never null, a stream that matches every A where a different A exists for which all the
BiJoiner
s are true
-
ifExistsOtherIncludingNullVars
default UniConstraintStream<A> ifExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A>... joiners)
As defined byifExistsOtherIncludingNullVars(Class, BiJoiner)
. If multipleBiJoiner
s are provided, for performance reasons, the indexing joiners must be placed before filtering joiners.This method causes Unchecked generics array creation for varargs parameter warnings, but we can't fix it with a
SafeVarargs
annotation because it's an interface method. Therefore, there are overloaded methods with up to 4BiJoiner
parameters.- Parameters:
otherClass
- never nulljoiners
- never null- Returns:
- never null, a stream that matches every A where a different A exists for which all the
BiJoiner
s are true
-
ifNotExists
default <B> UniConstraintStream<A> ifNotExists(Class<B> otherClass, BiJoiner<A,B> joiner)
Create a newUniConstraintStream
for every A where B does not exist for which theBiJoiner
is true (for the properties it extracts from both facts).This method has overloaded methods with multiple
BiJoiner
parameters.Note that, if a legacy constraint stream uses
ConstraintFactory.from(Class)
as opposed toConstraintFactory.forEach(Class)
, a different definition of exists applies. (SeeConstraintFactory.from(Class)
Javadoc.)- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner
- never null- Returns:
- never null, a stream that matches every A where B does not exist for which the
BiJoiner
is true
-
ifNotExists
default <B> UniConstraintStream<A> ifNotExists(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2)
As defined byifNotExists(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never null- Returns:
- never null, a stream that matches every A where B does not exist for which all the
BiJoiner
s are true
-
ifNotExists
default <B> UniConstraintStream<A> ifNotExists(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3)
As defined byifNotExists(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never null- Returns:
- never null, a stream that matches every A where B does not exist for which all the
BiJoiner
s are true
-
ifNotExists
default <B> UniConstraintStream<A> ifNotExists(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3, BiJoiner<A,B> joiner4)
As defined byifNotExists(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never nulljoiner4
- never null- Returns:
- never null, a stream that matches every A where B does not exist for which all the
BiJoiner
s are true
-
ifNotExists
<B> UniConstraintStream<A> ifNotExists(Class<B> otherClass, BiJoiner<A,B>... joiners)
As defined byifNotExists(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.This method causes Unchecked generics array creation for varargs parameter warnings, but we can't fix it with a
SafeVarargs
annotation because it's an interface method. Therefore, there are overloaded methods with up to 4BiJoiner
parameters.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiners
- never null- Returns:
- never null, a stream that matches every A where B does not exist for which all the
BiJoiner
s are true
-
ifNotExistsIncludingNullVars
default <B> UniConstraintStream<A> ifNotExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B> joiner)
Create a newUniConstraintStream
for every A where B does not exist for which theBiJoiner
is true (for the properties it extracts from both facts). For classes annotated withPlanningEntity
, this method also includes instances with null variables.This method has overloaded methods with multiple
BiJoiner
parameters.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner
- never null- Returns:
- never null, a stream that matches every A where B does not exist for which the
BiJoiner
is true
-
ifNotExistsIncludingNullVars
default <B> UniConstraintStream<A> ifNotExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2)
As defined byifNotExistsIncludingNullVars(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never null- Returns:
- never null, a stream that matches every A where B does not exist for which all the
BiJoiner
s are true
-
ifNotExistsIncludingNullVars
default <B> UniConstraintStream<A> ifNotExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3)
As defined byifNotExistsIncludingNullVars(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never null- Returns:
- never null, a stream that matches every A where B does not exist for which all the
BiJoiner
s are true
-
ifNotExistsIncludingNullVars
default <B> UniConstraintStream<A> ifNotExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B> joiner1, BiJoiner<A,B> joiner2, BiJoiner<A,B> joiner3, BiJoiner<A,B> joiner4)
As defined byifNotExistsIncludingNullVars(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never nulljoiner4
- never null- Returns:
- never null, a stream that matches every A where B does not exist for which all the
BiJoiner
s are true
-
ifNotExistsIncludingNullVars
<B> UniConstraintStream<A> ifNotExistsIncludingNullVars(Class<B> otherClass, BiJoiner<A,B>... joiners)
As defined byifNotExistsIncludingNullVars(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.This method causes Unchecked generics array creation for varargs parameter warnings, but we can't fix it with a
SafeVarargs
annotation because it's an interface method. Therefore, there are overloaded methods with up to 4BiJoiner
parameters.- Type Parameters:
B
- the type of the second matched fact- Parameters:
otherClass
- never nulljoiners
- never null- Returns:
- never null, a stream that matches every A where B does not exist for which all the
BiJoiner
s are true
-
ifNotExistsOther
default UniConstraintStream<A> ifNotExistsOther(Class<A> otherClass)
Create a newUniConstraintStream
for every A, if no other A exists that does notObject.equals(Object)
the first.Note that, if a legacy constraint stream uses
ConstraintFactory.from(Class)
as opposed toConstraintFactory.forEach(Class)
, a different definition of exists applies. (SeeConstraintFactory.from(Class)
Javadoc.)- Parameters:
otherClass
- never null- Returns:
- never null, a stream that matches every A where a different A does not exist
-
ifNotExistsOther
default UniConstraintStream<A> ifNotExistsOther(Class<A> otherClass, BiJoiner<A,A> joiner)
Create a newUniConstraintStream
for every A, if no other A exists that does notObject.equals(Object)
the first, and for which theBiJoiner
is true (for the properties it extracts from both facts).This method has overloaded methods with multiple
BiJoiner
parameters.Note that, if a legacy constraint stream uses
ConstraintFactory.from(Class)
as opposed toConstraintFactory.forEach(Class)
, a different definition of exists applies. (SeeConstraintFactory.from(Class)
Javadoc.)- Parameters:
otherClass
- never nulljoiner
- never null- Returns:
- never null, a stream that matches every A where a different A does not exist for which the
BiJoiner
is true
-
ifNotExistsOther
default UniConstraintStream<A> ifNotExistsOther(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2)
As defined byifNotExistsOther(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never null- Returns:
- never null, a stream that matches every A where a different A does not exist for which all the
BiJoiner
s are true
-
ifNotExistsOther
default UniConstraintStream<A> ifNotExistsOther(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3)
As defined byifNotExistsOther(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never null- Returns:
- never null, a stream that matches every A where a different A does not exist for which all the
BiJoiner
s are true
-
ifNotExistsOther
default UniConstraintStream<A> ifNotExistsOther(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3, BiJoiner<A,A> joiner4)
As defined byifNotExistsOther(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never nulljoiner4
- never null- Returns:
- never null, a stream that matches every A where a different A does not exist for which all the
BiJoiner
s are true
-
ifNotExistsOther
default UniConstraintStream<A> ifNotExistsOther(Class<A> otherClass, BiJoiner<A,A>... joiners)
As defined byifNotExistsOther(Class, BiJoiner)
. For performance reasons, the indexing joiners must be placed before filtering joiners.This method causes Unchecked generics array creation for varargs parameter warnings, but we can't fix it with a
SafeVarargs
annotation because it's an interface method. Therefore, there are overloaded methods with up to 4BiJoiner
parameters.- Parameters:
otherClass
- never nulljoiners
- never null- Returns:
- never null, a stream that matches every A where a different A does not exist for which all the
BiJoiner
s are true
-
ifNotExistsOtherIncludingNullVars
default UniConstraintStream<A> ifNotExistsOtherIncludingNullVars(Class<A> otherClass)
Create a newUniConstraintStream
for every A, if no other A exists that does notObject.equals(Object)
the first. For classes annotated withPlanningEntity
, this method also includes instances with null variables.- Parameters:
otherClass
- never null- Returns:
- never null, a stream that matches every A where a different A does not exist
-
ifNotExistsOtherIncludingNullVars
default UniConstraintStream<A> ifNotExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A> joiner)
Create a newUniConstraintStream
for every A, if no other A exists that does notObject.equals(Object)
the first, and for which theBiJoiner
is true (for the properties it extracts from both facts). For classes annotated withPlanningEntity
, this method also includes instances with null variables.This method has overloaded methods with multiple
BiJoiner
parameters.- Parameters:
otherClass
- never nulljoiner
- never null- Returns:
- never null, a stream that matches every A where a different A does not exist for which the
BiJoiner
is true
-
ifNotExistsOtherIncludingNullVars
default UniConstraintStream<A> ifNotExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2)
As defined byifNotExistsOtherIncludingNullVars(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never null- Returns:
- never null, a stream that matches every A where a different A does not exist for which all the
BiJoiner
s are true
-
ifNotExistsOtherIncludingNullVars
default UniConstraintStream<A> ifNotExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3)
As defined byifNotExistsOtherIncludingNullVars(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never null- Returns:
- never null, a stream that matches every A where a different A does not exist for which all the
BiJoiner
s are true
-
ifNotExistsOtherIncludingNullVars
default UniConstraintStream<A> ifNotExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3, BiJoiner<A,A> joiner4)
As defined byifNotExistsOtherIncludingNullVars(Class, BiJoiner)
. For performance reasons, indexing joiners must be placed before filtering joiners.- Parameters:
otherClass
- never nulljoiner1
- never nulljoiner2
- never nulljoiner3
- never nulljoiner4
- never null- Returns:
- never null, a stream that matches every A where a different A does not exist for which all the
BiJoiner
s are true
-
ifNotExistsOtherIncludingNullVars
default UniConstraintStream<A> ifNotExistsOtherIncludingNullVars(Class<A> otherClass, BiJoiner<A,A>... joiners)
As defined byifNotExistsOtherIncludingNullVars(Class, BiJoiner)
. If multipleBiJoiner
s are provided, for performance reasons, the indexing joiners must be placed before filtering joiners.This method causes Unchecked generics array creation for varargs parameter warnings, but we can't fix it with a
SafeVarargs
annotation because it's an interface method. Therefore, there are overloaded methods with up to 4BiJoiner
parameters.- Parameters:
otherClass
- never nulljoiners
- never null- Returns:
- never null, a stream that matches every A where a different A does not exist for which all the
BiJoiner
s are true
-
groupBy
<ResultContainer_,Result_> UniConstraintStream<Result_> groupBy(UniConstraintCollector<A,ResultContainer_,Result_> collector)
Convert theUniConstraintStream
to a differentUniConstraintStream
, containing only a single tuple, the result of applyingUniConstraintCollector
.- Type Parameters:
ResultContainer_
- the mutable accumulation type (often hidden as an implementation detail)Result_
- the type of a fact in the destinationUniConstraintStream
's tuple- Parameters:
collector
- never null, the collector to perform the grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.- Returns:
- never null
-
groupBy
<ResultContainerA_,ResultA_,ResultContainerB_,ResultB_> BiConstraintStream<ResultA_,ResultB_> groupBy(UniConstraintCollector<A,ResultContainerA_,ResultA_> collectorA, UniConstraintCollector<A,ResultContainerB_,ResultB_> collectorB)
Convert theUniConstraintStream
to aBiConstraintStream
, containing only a single tuple, the result of applying twoUniConstraintCollector
s.- Type Parameters:
ResultContainerA_
- the mutable accumulation type (often hidden as an implementation detail)ResultA_
- the type of the first fact in the destinationBiConstraintStream
's tupleResultContainerB_
- the mutable accumulation type (often hidden as an implementation detail)ResultB_
- the type of the second fact in the destinationBiConstraintStream
's tuple- Parameters:
collectorA
- never null, the collector to perform the first grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.collectorB
- never null, the collector to perform the second grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.- Returns:
- never null
-
groupBy
<ResultContainerA_,ResultA_,ResultContainerB_,ResultB_,ResultContainerC_,ResultC_> TriConstraintStream<ResultA_,ResultB_,ResultC_> groupBy(UniConstraintCollector<A,ResultContainerA_,ResultA_> collectorA, UniConstraintCollector<A,ResultContainerB_,ResultB_> collectorB, UniConstraintCollector<A,ResultContainerC_,ResultC_> collectorC)
Convert theUniConstraintStream
to aTriConstraintStream
, containing only a single tuple, the result of applying threeUniConstraintCollector
s.- Type Parameters:
ResultContainerA_
- the mutable accumulation type (often hidden as an implementation detail)ResultA_
- the type of the first fact in the destinationTriConstraintStream
's tupleResultContainerB_
- the mutable accumulation type (often hidden as an implementation detail)ResultB_
- the type of the second fact in the destinationTriConstraintStream
's tupleResultContainerC_
- the mutable accumulation type (often hidden as an implementation detail)ResultC_
- the type of the third fact in the destinationTriConstraintStream
's tuple- Parameters:
collectorA
- never null, the collector to perform the first grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.collectorB
- never null, the collector to perform the second grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.collectorC
- never null, the collector to perform the third grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.- Returns:
- never null
-
groupBy
<ResultContainerA_,ResultA_,ResultContainerB_,ResultB_,ResultContainerC_,ResultC_,ResultContainerD_,ResultD_> QuadConstraintStream<ResultA_,ResultB_,ResultC_,ResultD_> groupBy(UniConstraintCollector<A,ResultContainerA_,ResultA_> collectorA, UniConstraintCollector<A,ResultContainerB_,ResultB_> collectorB, UniConstraintCollector<A,ResultContainerC_,ResultC_> collectorC, UniConstraintCollector<A,ResultContainerD_,ResultD_> collectorD)
Convert theUniConstraintStream
to aQuadConstraintStream
, containing only a single tuple, the result of applying fourUniConstraintCollector
s.- Type Parameters:
ResultContainerA_
- the mutable accumulation type (often hidden as an implementation detail)ResultA_
- the type of the first fact in the destinationQuadConstraintStream
's tupleResultContainerB_
- the mutable accumulation type (often hidden as an implementation detail)ResultB_
- the type of the second fact in the destinationQuadConstraintStream
's tupleResultContainerC_
- the mutable accumulation type (often hidden as an implementation detail)ResultC_
- the type of the third fact in the destinationQuadConstraintStream
's tupleResultContainerD_
- the mutable accumulation type (often hidden as an implementation detail)ResultD_
- the type of the fourth fact in the destinationQuadConstraintStream
's tuple- Parameters:
collectorA
- never null, the collector to perform the first grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.collectorB
- never null, the collector to perform the second grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.collectorC
- never null, the collector to perform the third grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.collectorD
- never null, the collector to perform the fourth grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.- Returns:
- never null
-
groupBy
<GroupKey_> UniConstraintStream<GroupKey_> groupBy(Function<A,GroupKey_> groupKeyMapping)
Convert theUniConstraintStream
to a differentUniConstraintStream
, containing the set of tuples resulting from applying the group key mapping function on all tuples of the original stream. Neither tuple of the new streamObjects.equals(Object, Object)
any other.- Type Parameters:
GroupKey_
- the type of a fact in the destinationUniConstraintStream
's tuple- Parameters:
groupKeyMapping
- never null, mapping function to convert each element in the stream to a different element- Returns:
- never null
-
groupBy
<GroupKey_,ResultContainer_,Result_> BiConstraintStream<GroupKey_,Result_> groupBy(Function<A,GroupKey_> groupKeyMapping, UniConstraintCollector<A,ResultContainer_,Result_> collector)
Convert theUniConstraintStream
to aBiConstraintStream
, consisting of unique tuples with two facts.The first fact is the return value of the group key mapping function, applied on the incoming tuple. The second fact is the return value of a given
UniConstraintCollector
applied on all incoming tuples with the same first fact.- Type Parameters:
GroupKey_
- the type of the first fact in the destinationBiConstraintStream
's tupleResultContainer_
- the mutable accumulation type (often hidden as an implementation detail)Result_
- the type of the second fact in the destinationBiConstraintStream
's tuple- Parameters:
groupKeyMapping
- never null, function to convert the fact in the original tuple to a different factcollector
- never null, the collector to perform the grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.- Returns:
- never null
-
groupBy
<GroupKey_,ResultContainerB_,ResultB_,ResultContainerC_,ResultC_> TriConstraintStream<GroupKey_,ResultB_,ResultC_> groupBy(Function<A,GroupKey_> groupKeyMapping, UniConstraintCollector<A,ResultContainerB_,ResultB_> collectorB, UniConstraintCollector<A,ResultContainerC_,ResultC_> collectorC)
Convert theUniConstraintStream
to aTriConstraintStream
, consisting of unique tuples with three facts.The first fact is the return value of the group key mapping function, applied on the incoming tuple. The remaining facts are the return value of the respective
UniConstraintCollector
applied on all incoming tuples with the same first fact.- Type Parameters:
GroupKey_
- the type of the first fact in the destinationTriConstraintStream
's tupleResultContainerB_
- the mutable accumulation type (often hidden as an implementation detail)ResultB_
- the type of the second fact in the destinationTriConstraintStream
's tupleResultContainerC_
- the mutable accumulation type (often hidden as an implementation detail)ResultC_
- the type of the third fact in the destinationTriConstraintStream
's tuple- Parameters:
groupKeyMapping
- never null, function to convert the fact in the original tuple to a different factcollectorB
- never null, the collector to perform the first grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.collectorC
- never null, the collector to perform the second grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.- Returns:
- never null
-
groupBy
<GroupKey_,ResultContainerB_,ResultB_,ResultContainerC_,ResultC_,ResultContainerD_,ResultD_> QuadConstraintStream<GroupKey_,ResultB_,ResultC_,ResultD_> groupBy(Function<A,GroupKey_> groupKeyMapping, UniConstraintCollector<A,ResultContainerB_,ResultB_> collectorB, UniConstraintCollector<A,ResultContainerC_,ResultC_> collectorC, UniConstraintCollector<A,ResultContainerD_,ResultD_> collectorD)
Convert theUniConstraintStream
to aQuadConstraintStream
, consisting of unique tuples with four facts.The first fact is the return value of the group key mapping function, applied on the incoming tuple. The remaining facts are the return value of the respective
UniConstraintCollector
applied on all incoming tuples with the same first fact.- Type Parameters:
GroupKey_
- the type of the first fact in the destinationQuadConstraintStream
's tupleResultContainerB_
- the mutable accumulation type (often hidden as an implementation detail)ResultB_
- the type of the second fact in the destinationQuadConstraintStream
's tupleResultContainerC_
- the mutable accumulation type (often hidden as an implementation detail)ResultC_
- the type of the third fact in the destinationQuadConstraintStream
's tupleResultContainerD_
- the mutable accumulation type (often hidden as an implementation detail)ResultD_
- the type of the fourth fact in the destinationQuadConstraintStream
's tuple- Parameters:
groupKeyMapping
- never null, function to convert the fact in the original tuple to a different factcollectorB
- never null, the collector to perform the first grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.collectorC
- never null, the collector to perform the second grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.collectorD
- never null, the collector to perform the third grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.- Returns:
- never null
-
groupBy
<GroupKeyA_,GroupKeyB_> BiConstraintStream<GroupKeyA_,GroupKeyB_> groupBy(Function<A,GroupKeyA_> groupKeyAMapping, Function<A,GroupKeyB_> groupKeyBMapping)
Convert theUniConstraintStream
to aBiConstraintStream
, consisting of unique tuples with two facts.The first fact is the return value of the first group key mapping function, applied on the incoming tuple. The second fact is the return value of the second group key mapping function, applied on all incoming tuples with the same first fact.
- Type Parameters:
GroupKeyA_
- the type of the first fact in the destinationBiConstraintStream
's tupleGroupKeyB_
- the type of the second fact in the destinationBiConstraintStream
's tuple- Parameters:
groupKeyAMapping
- never null, function to convert the original tuple into a first factgroupKeyBMapping
- never null, function to convert the original tuple into a second fact- Returns:
- never null
-
groupBy
<GroupKeyA_,GroupKeyB_,ResultContainer_,Result_> TriConstraintStream<GroupKeyA_,GroupKeyB_,Result_> groupBy(Function<A,GroupKeyA_> groupKeyAMapping, Function<A,GroupKeyB_> groupKeyBMapping, UniConstraintCollector<A,ResultContainer_,Result_> collector)
Combines the semantics ofgroupBy(Function, Function)
andgroupBy(UniConstraintCollector)
. That is, the first and second facts in the tuple follow thegroupBy(Function, Function)
semantics, and the third fact is the result of applyingUniConstraintCollector.finisher()
on all the tuples of the originalUniConstraintStream
that belong to the group.- Type Parameters:
GroupKeyA_
- the type of the first fact in the destinationTriConstraintStream
's tupleGroupKeyB_
- the type of the second fact in the destinationTriConstraintStream
's tupleResultContainer_
- the mutable accumulation type (often hidden as an implementation detail)Result_
- the type of the third fact in the destinationTriConstraintStream
's tuple- Parameters:
groupKeyAMapping
- never null, function to convert the original tuple into a first factgroupKeyBMapping
- never null, function to convert the original tuple into a second factcollector
- never null, the collector to perform the grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.- Returns:
- never null
-
groupBy
<GroupKeyA_,GroupKeyB_,ResultContainerC_,ResultC_,ResultContainerD_,ResultD_> QuadConstraintStream<GroupKeyA_,GroupKeyB_,ResultC_,ResultD_> groupBy(Function<A,GroupKeyA_> groupKeyAMapping, Function<A,GroupKeyB_> groupKeyBMapping, UniConstraintCollector<A,ResultContainerC_,ResultC_> collectorC, UniConstraintCollector<A,ResultContainerD_,ResultD_> collectorD)
Combines the semantics ofgroupBy(Function, Function)
andgroupBy(UniConstraintCollector)
. That is, the first and second facts in the tuple follow thegroupBy(Function, Function)
semantics. The third fact is the result of applying the firstUniConstraintCollector.finisher()
on all the tuples of the originalUniConstraintStream
that belong to the group. The fourth fact is the result of applying the secondUniConstraintCollector.finisher()
on all the tuples of the originalUniConstraintStream
that belong to the group- Type Parameters:
GroupKeyA_
- the type of the first fact in the destinationQuadConstraintStream
's tupleGroupKeyB_
- the type of the second fact in the destinationQuadConstraintStream
's tupleResultContainerC_
- the mutable accumulation type (often hidden as an implementation detail)ResultC_
- the type of the third fact in the destinationQuadConstraintStream
's tupleResultContainerD_
- the mutable accumulation type (often hidden as an implementation detail)ResultD_
- the type of the fourth fact in the destinationQuadConstraintStream
's tuple- Parameters:
groupKeyAMapping
- never null, function to convert the original tuple into a first factgroupKeyBMapping
- never null, function to convert the original tuple into a second factcollectorC
- never null, the collector to perform the first grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.collectorD
- never null, the collector to perform the second grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.- Returns:
- never null
-
groupBy
<GroupKeyA_,GroupKeyB_,GroupKeyC_> TriConstraintStream<GroupKeyA_,GroupKeyB_,GroupKeyC_> groupBy(Function<A,GroupKeyA_> groupKeyAMapping, Function<A,GroupKeyB_> groupKeyBMapping, Function<A,GroupKeyC_> groupKeyCMapping)
Convert theUniConstraintStream
to aTriConstraintStream
, consisting of unique tuples with three facts.The first fact is the return value of the first group key mapping function, applied on the incoming tuple. The second fact is the return value of the second group key mapping function, applied on all incoming tuples with the same first fact. The third fact is the return value of the third group key mapping function, applied on all incoming tuples with the same first fact.
- Type Parameters:
GroupKeyA_
- the type of the first fact in the destinationTriConstraintStream
's tupleGroupKeyB_
- the type of the second fact in the destinationTriConstraintStream
's tupleGroupKeyC_
- the type of the third fact in the destinationTriConstraintStream
's tuple- Parameters:
groupKeyAMapping
- never null, function to convert the original tuple into a first factgroupKeyBMapping
- never null, function to convert the original tuple into a second factgroupKeyCMapping
- never null, function to convert the original tuple into a third fact- Returns:
- never null
-
groupBy
<GroupKeyA_,GroupKeyB_,GroupKeyC_,ResultContainerD_,ResultD_> QuadConstraintStream<GroupKeyA_,GroupKeyB_,GroupKeyC_,ResultD_> groupBy(Function<A,GroupKeyA_> groupKeyAMapping, Function<A,GroupKeyB_> groupKeyBMapping, Function<A,GroupKeyC_> groupKeyCMapping, UniConstraintCollector<A,ResultContainerD_,ResultD_> collectorD)
Combines the semantics ofgroupBy(Function, Function)
andgroupBy(UniConstraintCollector)
. That is, the first three facts in the tuple follow thegroupBy(Function, Function)
semantics. The final fact is the result of applying the firstUniConstraintCollector.finisher()
on all the tuples of the originalUniConstraintStream
that belong to the group.- Type Parameters:
GroupKeyA_
- the type of the first fact in the destinationQuadConstraintStream
's tupleGroupKeyB_
- the type of the second fact in the destinationQuadConstraintStream
's tupleGroupKeyC_
- the type of the third fact in the destinationQuadConstraintStream
's tupleResultContainerD_
- the mutable accumulation type (often hidden as an implementation detail)ResultD_
- the type of the fourth fact in the destinationQuadConstraintStream
's tuple- Parameters:
groupKeyAMapping
- never null, function to convert the original tuple into a first factgroupKeyBMapping
- never null, function to convert the original tuple into a second factgroupKeyCMapping
- never null, function to convert the original tuple into a third factcollectorD
- never null, the collector to perform the grouping operation with SeeConstraintCollectors
for common operations, such ascount()
,sum()
and others.- Returns:
- never null
-
groupBy
<GroupKeyA_,GroupKeyB_,GroupKeyC_,GroupKeyD_> QuadConstraintStream<GroupKeyA_,GroupKeyB_,GroupKeyC_,GroupKeyD_> groupBy(Function<A,GroupKeyA_> groupKeyAMapping, Function<A,GroupKeyB_> groupKeyBMapping, Function<A,GroupKeyC_> groupKeyCMapping, Function<A,GroupKeyD_> groupKeyDMapping)
Convert theUniConstraintStream
to aQuadConstraintStream
, consisting of unique tuples with four facts.The first fact is the return value of the first group key mapping function, applied on the incoming tuple. The second fact is the return value of the second group key mapping function, applied on all incoming tuples with the same first fact. The third fact is the return value of the third group key mapping function, applied on all incoming tuples with the same first fact. The fourth fact is the return value of the fourth group key mapping function, applied on all incoming tuples with the same first fact.
- Type Parameters:
GroupKeyA_
- the type of the first fact in the destinationQuadConstraintStream
's tupleGroupKeyB_
- the type of the second fact in the destinationQuadConstraintStream
's tupleGroupKeyC_
- the type of the third fact in the destinationQuadConstraintStream
's tupleGroupKeyD_
- the type of the fourth fact in the destinationQuadConstraintStream
's tuple- Parameters:
groupKeyAMapping
- * callingmap(Person::getAge)
on such stream will produce a stream ofInteger
s *[20, 25, 30]
,groupKeyBMapping
- never null, function to convert the original tuple into a second factgroupKeyCMapping
- never null, function to convert the original tuple into a third factgroupKeyDMapping
- never null, function to convert the original tuple into a fourth fact- Returns:
- never null
-
map
<ResultA_> UniConstraintStream<ResultA_> map(Function<A,ResultA_> mapping)
Transforms the stream in such a way that tuples are remapped using the given function. This may produce a stream with duplicate tuples. Seedistinct()
for details. There are several recommendations for implementing the mapping function:- Purity. The mapping function should only depend on its input. That is, given the same input, it always returns the same output.
- Bijectivity.
No two input tuples should map to the same output tuple,
or to tuples that are
equal
. Not following this recommendation creates a constraint stream with duplicate tuples, and may force you to usedistinct()
later, which comes with a performance cost. - Immutable data carriers.
The objects returned by the mapping function should be identified by their contents and nothing else.
If two of them have contents which
equal
, then they should likewiseequal
and preferably be the same instance. The objects returned by the mapping function should also be immutable, meaning their contents should not be allowed to change.
Simple example: assuming a constraint stream of tuples of
Person
s[Ann(age = 20), Beth(age = 25), Cathy(age = 30)]
, callingmap(Person::getAge)
on such stream will produce a stream ofInteger
s[20, 25, 30]
,Example with a non-bijective mapping function: assuming a constraint stream of tuples of
Person
s[Ann(age = 20), Beth(age = 25), Cathy(age = 30), David(age = 30), Eric(age = 20)]
, callingmap(Person::getAge)
on such stream will produce a stream ofInteger
s[20, 25, 30, 30, 20]
.- Type Parameters:
ResultA_
- the type of the only fact in the resultingUniConstraintStream
's tuple- Parameters:
mapping
- never null, function to convert the original tuple into the new tuple- Returns:
- never null
-
flattenLast
<ResultA_> UniConstraintStream<ResultA_> flattenLast(Function<A,Iterable<ResultA_>> mapping)
Takes each tuple and applies a mapping on it, which turns the tuple into aIterable
. Returns a constraint stream consisting of contents of those iterables. This may produce a stream with duplicate tuples. Seedistinct()
for details.In cases where the original tuple is already an
Iterable
, useFunction.identity()
as the argument.Simple example: assuming a constraint stream of tuples of
Person
s[Ann(roles = [USER, ADMIN]]), Beth(roles = [USER]), Cathy(roles = [ADMIN, AUDITOR])]
, callingflattenLast(Person::getRoles)
on such stream will produce a stream of[USER, ADMIN, USER, ADMIN, AUDITOR]
.- Type Parameters:
ResultA_
- the type of facts in the resulting tuples- Parameters:
mapping
- never null, function to convert the original tuple intoIterable
- Returns:
- never null
-
distinct
UniConstraintStream<A> distinct()
Transforms the stream in such a way that all the tuples going through it are distinct. (No two tuples willequal
.)By default, tuples going through a constraint stream are distinct. However, operations such as
map(Function)
may create a stream which breaks that promise. By calling this method on such a stream, duplicate copies of the same tuple will be omitted at a performance cost.- Returns:
- never null
-
penalize
default Constraint penalize(String constraintName, Score<?> constraintWeight, ToIntFunction<A> matchWeigher)
Negatively impact theScore
: subtract the constraintWeight multiplied by the match weight. Otherwise as defined byConstraintStream.penalize(String, Score)
.For non-int
Score
types usepenalizeLong(String, Score, ToLongFunction)
orpenalizeBigDecimal(String, Score, Function)
instead.- Parameters:
constraintName
- never null, shows up inConstraintMatchTotal
during score justificationconstraintWeight
- never nullmatchWeigher
- never null, the result of this function (matchWeight) is multiplied by the constraintWeight- Returns:
- never null
-
penalize
Constraint penalize(String constraintPackage, String constraintName, Score<?> constraintWeight, ToIntFunction<A> matchWeigher)
As defined bypenalize(String, Score, ToIntFunction)
.- Parameters:
constraintPackage
- never nullconstraintName
- never nullconstraintWeight
- never nullmatchWeigher
- never null- Returns:
- never null
-
penalizeLong
default Constraint penalizeLong(String constraintName, Score<?> constraintWeight, ToLongFunction<A> matchWeigher)
Negatively impact theScore
: subtract the constraintWeight multiplied by the match weight. Otherwise as defined byConstraintStream.penalize(String, Score)
.- Parameters:
constraintName
- never null, shows up inConstraintMatchTotal
during score justificationconstraintWeight
- never nullmatchWeigher
- never null, the result of this function (matchWeight) is multiplied by the constraintWeight- Returns:
- never null
-
penalizeLong
Constraint penalizeLong(String constraintPackage, String constraintName, Score<?> constraintWeight, ToLongFunction<A> matchWeigher)
As defined bypenalizeLong(String, Score, ToLongFunction)
.- Parameters:
constraintPackage
- never nullconstraintName
- never nullconstraintWeight
- never nullmatchWeigher
- never null- Returns:
- never null
-
penalizeBigDecimal
default Constraint penalizeBigDecimal(String constraintName, Score<?> constraintWeight, Function<A,BigDecimal> matchWeigher)
Negatively impact theScore
: subtract the constraintWeight multiplied by the match weight. Otherwise as defined byConstraintStream.penalize(String, Score)
.- Parameters:
constraintName
- never null, shows up inConstraintMatchTotal
during score justificationconstraintWeight
- never nullmatchWeigher
- never null, the result of this function (matchWeight) is multiplied by the constraintWeight- Returns:
- never null
-
penalizeBigDecimal
Constraint penalizeBigDecimal(String constraintPackage, String constraintName, Score<?> constraintWeight, Function<A,BigDecimal> matchWeigher)
As defined bypenalizeBigDecimal(String, Score, Function)
.- Parameters:
constraintPackage
- never nullconstraintName
- never nullconstraintWeight
- never nullmatchWeigher
- never null- Returns:
- never null
-
penalizeConfigurable
default Constraint penalizeConfigurable(String constraintName, ToIntFunction<A> matchWeigher)
Negatively impact theScore
: subtract theConstraintWeight
multiplied by the match weight. Otherwise as defined byConstraintStream.penalizeConfigurable(String)
.For non-int
Score
types usepenalizeConfigurableLong(String, ToLongFunction)
orpenalizeConfigurableBigDecimal(String, Function)
instead.- Parameters:
constraintName
- never null, shows up inConstraintMatchTotal
during score justificationmatchWeigher
- never null, the result of this function (matchWeight) is multiplied by the constraintWeight- Returns:
- never null
-
penalizeConfigurable
Constraint penalizeConfigurable(String constraintPackage, String constraintName, ToIntFunction<A> matchWeigher)
As defined bypenalizeConfigurable(String, ToIntFunction)
.- Parameters:
constraintPackage
- never nullconstraintName
- never nullmatchWeigher
- never null- Returns:
- never null
-
penalizeConfigurableLong
default Constraint penalizeConfigurableLong(String constraintName, ToLongFunction<A> matchWeigher)
Negatively impact theScore
: subtract theConstraintWeight
multiplied by the match weight. Otherwise as defined byConstraintStream.penalizeConfigurable(String)
.- Parameters:
constraintName
- never null, shows up inConstraintMatchTotal
during score justificationmatchWeigher
- never null, the result of this function (matchWeight) is multiplied by the constraintWeight- Returns:
- never null
-
penalizeConfigurableLong
Constraint penalizeConfigurableLong(String constraintPackage, String constraintName, ToLongFunction<A> matchWeigher)
As defined bypenalizeConfigurableLong(String, ToLongFunction)
.- Parameters:
constraintPackage
- never nullconstraintName
- never nullmatchWeigher
- never null- Returns:
- never null
-
penalizeConfigurableBigDecimal
default Constraint penalizeConfigurableBigDecimal(String constraintName, Function<A,BigDecimal> matchWeigher)
Negatively impact theScore
: subtract theConstraintWeight
multiplied by the match weight. Otherwise as defined byConstraintStream.penalizeConfigurable(String)
.- Parameters:
constraintName
- never null, shows up inConstraintMatchTotal
during score justificationmatchWeigher
- never null, the result of this function (matchWeight) is multiplied by the constraintWeight- Returns:
- never null
-
penalizeConfigurableBigDecimal
Constraint penalizeConfigurableBigDecimal(String constraintPackage, String constraintName, Function<A,BigDecimal> matchWeigher)
As defined bypenalizeConfigurableBigDecimal(String, Function)
.- Parameters:
constraintPackage
- never nullconstraintName
- never nullmatchWeigher
- never null- Returns:
- never null
-
reward
default Constraint reward(String constraintName, Score<?> constraintWeight, ToIntFunction<A> matchWeigher)
Positively impact theScore
: add the constraintWeight multiplied by the match weight. Otherwise as defined byConstraintStream.reward(String, Score)
.For non-int
Score
types userewardLong(String, Score, ToLongFunction)
orrewardBigDecimal(String, Score, Function)
instead.- Parameters:
constraintName
- never null, shows up inConstraintMatchTotal
during score justificationconstraintWeight
- never nullmatchWeigher
- never null, the result of this function (matchWeight) is multiplied by the constraintWeight- Returns:
- never null
-
reward
Constraint reward(String constraintPackage, String constraintName, Score<?> constraintWeight, ToIntFunction<A> matchWeigher)
As defined byreward(String, Score, ToIntFunction)
.- Parameters:
constraintPackage
- never nullconstraintName
- never nullconstraintWeight
- never nullmatchWeigher
- never null- Returns:
- never null
-
rewardLong
default Constraint rewardLong(String constraintName, Score<?> constraintWeight, ToLongFunction<A> matchWeigher)
Positively impact theScore
: add the constraintWeight multiplied by the match weight. Otherwise as defined byConstraintStream.reward(String, Score)
.- Parameters:
constraintName
- never null, shows up inConstraintMatchTotal
during score justificationconstraintWeight
- never nullmatchWeigher
- never null, the result of this function (matchWeight) is multiplied by the constraintWeight- Returns:
- never null
-
rewardLong
Constraint rewardLong(String constraintPackage, String constraintName, Score<?> constraintWeight, ToLongFunction<A> matchWeigher)
As defined byrewardLong(String, Score, ToLongFunction)
.- Parameters:
constraintPackage
- never nullconstraintName
- never nullconstraintWeight
- never nullmatchWeigher
- never null- Returns:
- never null
-
rewardBigDecimal
default Constraint rewardBigDecimal(String constraintName, Score<?> constraintWeight, Function<A,BigDecimal> matchWeigher)
Positively impact theScore
: add the constraintWeight multiplied by the match weight. Otherwise as defined byConstraintStream.reward(String, Score)
.- Parameters:
constraintName
- never null, shows up inConstraintMatchTotal
during score justificationconstraintWeight
- never nullmatchWeigher
- never null, the result of this function (matchWeight) is multiplied by the constraintWeight- Returns:
- never null
-
rewardBigDecimal
Constraint rewardBigDecimal(String constraintPackage, String constraintName, Score<?> constraintWeight, Function<A,BigDecimal> matchWeigher)
As defined byrewardBigDecimal(String, Score, Function)
.- Parameters:
constraintPackage
- never nullconstraintName
- never nullconstraintWeight
- never nullmatchWeigher
- never null- Returns:
- never null
-
rewardConfigurable
default Constraint rewardConfigurable(String constraintName, ToIntFunction<A> matchWeigher)
Positively impact theScore
: add theConstraintWeight
multiplied by the match weight. Otherwise as defined byConstraintStream.rewardConfigurable(String)
.For non-int
Score
types userewardConfigurableLong(String, ToLongFunction)
orrewardConfigurableBigDecimal(String, Function)
instead.- Parameters:
constraintName
- never null, shows up inConstraintMatchTotal
during score justificationmatchWeigher
- never null, the result of this function (matchWeight) is multiplied by the constraintWeight- Returns:
- never null
-
rewardConfigurable
Constraint rewardConfigurable(String constraintPackage, String constraintName, ToIntFunction<A> matchWeigher)
As defined byrewardConfigurable(String, ToIntFunction)
.- Parameters:
constraintPackage
- never nullconstraintName
- never nullmatchWeigher
- never null- Returns:
- never null
-
rewardConfigurableLong
default Constraint rewardConfigurableLong(String constraintName, ToLongFunction<A> matchWeigher)
Positively impact theScore
: add theConstraintWeight
multiplied by the match weight. Otherwise as defined byConstraintStream.rewardConfigurable(String)
.- Parameters:
constraintName
- never null, shows up inConstraintMatchTotal
during score justificationmatchWeigher
- never null, the result of this function (matchWeight) is multiplied by the constraintWeight- Returns:
- never null
-
rewardConfigurableLong
Constraint rewardConfigurableLong(String constraintPackage, String constraintName, ToLongFunction<A> matchWeigher)
As defined byrewardConfigurableLong(String, ToLongFunction)
.- Parameters:
constraintPackage
- never nullconstraintName
- never nullmatchWeigher
- never null- Returns:
- never null
-
rewardConfigurableBigDecimal
default Constraint rewardConfigurableBigDecimal(String constraintName, Function<A,BigDecimal> matchWeigher)
Positively impact theScore
: add theConstraintWeight
multiplied by the match weight. Otherwise as defined byConstraintStream.rewardConfigurable(String)
.- Parameters:
constraintName
- never null, shows up inConstraintMatchTotal
during score justificationmatchWeigher
- never null, the result of this function (matchWeight) is multiplied by the constraintWeight- Returns:
- never null
-
rewardConfigurableBigDecimal
Constraint rewardConfigurableBigDecimal(String constraintPackage, String constraintName, Function<A,BigDecimal> matchWeigher)
As defined byrewardConfigurableBigDecimal(String, Function)
.- Parameters:
constraintPackage
- never nullconstraintName
- never nullmatchWeigher
- never null- Returns:
- never null
-
impact
default Constraint impact(String constraintName, Score<?> constraintWeight, ToIntFunction<A> matchWeigher)
Positively or negatively impact theScore
by the constraintWeight multiplied by the match weight. Otherwise as defined byConstraintStream.impact(String, Score)
.Use
penalize(...)
orreward(...)
instead, unless this constraint can both have positive and negative weights.For non-int
Score
types useimpactLong(String, Score, ToLongFunction)
orimpactBigDecimal(String, Score, Function)
instead.- Parameters:
constraintName
- never null, shows up inConstraintMatchTotal
during score justificationconstraintWeight
- never nullmatchWeigher
- never null, the result of this function (matchWeight) is multiplied by the constraintWeight- Returns:
- never null
-
impact
Constraint impact(String constraintPackage, String constraintName, Score<?> constraintWeight, ToIntFunction<A> matchWeigher)
As defined byimpact(String, Score, ToIntFunction)
.- Parameters:
constraintPackage
- never nullconstraintName
- never nullconstraintWeight
- never nullmatchWeigher
- never null- Returns:
- never null
-
impactLong
default Constraint impactLong(String constraintName, Score<?> constraintWeight, ToLongFunction<A> matchWeigher)
Positively or negatively impact theScore
by the constraintWeight multiplied by the match weight. Otherwise as defined byConstraintStream.impact(String, Score)
.Use
penalizeLong(...)
orrewardLong(...)
instead, unless this constraint can both have positive and negative weights.- Parameters:
constraintName
- never null, shows up inConstraintMatchTotal
during score justificationconstraintWeight
- never nullmatchWeigher
- never null, the result of this function (matchWeight) is multiplied by the constraintWeight- Returns:
- never null
-
impactLong
Constraint impactLong(String constraintPackage, String constraintName, Score<?> constraintWeight, ToLongFunction<A> matchWeigher)
As defined byimpactLong(String, Score, ToLongFunction)
.- Parameters:
constraintPackage
- never nullconstraintName
- never nullconstraintWeight
- never nullmatchWeigher
- never null- Returns:
- never null
-
impactBigDecimal
default Constraint impactBigDecimal(String constraintName, Score<?> constraintWeight, Function<A,BigDecimal> matchWeigher)
Positively or negatively impact theScore
by the constraintWeight multiplied by the match weight. Otherwise as defined byConstraintStream.impact(String, Score)
.Use
penalizeBigDecimal(...)
orrewardBigDecimal(...)
instead, unless this constraint can both have positive and negative weights.- Parameters:
constraintName
- never null, shows up inConstraintMatchTotal
during score justificationconstraintWeight
- never nullmatchWeigher
- never null, the result of this function (matchWeight) is multiplied by the constraintWeight- Returns:
- never null
-
impactBigDecimal
Constraint impactBigDecimal(String constraintPackage, String constraintName, Score<?> constraintWeight, Function<A,BigDecimal> matchWeigher)
As defined byimpactBigDecimal(String, Score, Function)
.- Parameters:
constraintPackage
- never nullconstraintName
- never nullconstraintWeight
- never nullmatchWeigher
- never null- Returns:
- never null
-
impactConfigurable
default Constraint impactConfigurable(String constraintName, ToIntFunction<A> matchWeigher)
Positively or negatively impact theScore
by theConstraintWeight
multiplied by the match weight.Use
penalizeConfigurable(...)
orrewardConfigurable(...)
instead, unless this constraint can both have positive and negative weights.The constraintWeight comes from an
ConstraintWeight
annotated member on theConstraintConfiguration
, so end users can change the constraint weights dynamically. This constraint may be deactivated if theConstraintWeight
is zero. If there is noConstraintConfiguration
, useConstraintStream.impact(String, Score)
instead.For non-int
Score
types useimpactConfigurableLong(String, ToLongFunction)
orimpactConfigurableBigDecimal(String, Function)
instead.The
Constraint.getConstraintPackage()
defaults toConstraintConfiguration.constraintPackage()
.- Parameters:
constraintName
- never null, shows up inConstraintMatchTotal
during score justificationmatchWeigher
- never null, the result of this function (matchWeight) is multiplied by the constraintWeight- Returns:
- never null
-
impactConfigurable
Constraint impactConfigurable(String constraintPackage, String constraintName, ToIntFunction<A> matchWeigher)
As defined byimpactConfigurable(String, ToIntFunction)
.- Parameters:
constraintPackage
- never nullconstraintName
- never nullmatchWeigher
- never null- Returns:
- never null
-
impactConfigurableLong
default Constraint impactConfigurableLong(String constraintName, ToLongFunction<A> matchWeigher)
Positively or negatively impact theScore
by theConstraintWeight
multiplied by the match weight.Use
penalizeConfigurableLong(...)
orrewardConfigurableLong(...)
instead, unless this constraint can both have positive and negative weights.The constraintWeight comes from an
ConstraintWeight
annotated member on theConstraintConfiguration
, so end users can change the constraint weights dynamically. This constraint may be deactivated if theConstraintWeight
is zero. If there is noConstraintConfiguration
, useConstraintStream.impact(String, Score)
instead.The
Constraint.getConstraintPackage()
defaults toConstraintConfiguration.constraintPackage()
.- Parameters:
constraintName
- never null, shows up inConstraintMatchTotal
during score justificationmatchWeigher
- never null, the result of this function (matchWeight) is multiplied by the constraintWeight- Returns:
- never null
-
impactConfigurableLong
Constraint impactConfigurableLong(String constraintPackage, String constraintName, ToLongFunction<A> matchWeigher)
As defined byimpactConfigurableLong(String, ToLongFunction)
.- Parameters:
constraintPackage
- never nullconstraintName
- never nullmatchWeigher
- never null- Returns:
- never null
-
impactConfigurableBigDecimal
default Constraint impactConfigurableBigDecimal(String constraintName, Function<A,BigDecimal> matchWeigher)
Positively or negatively impact theScore
by theConstraintWeight
multiplied by the match weight.Use
penalizeConfigurableBigDecimal(...)
orrewardConfigurableBigDecimal(...)
instead, unless this constraint can both have positive and negative weights.The constraintWeight comes from an
ConstraintWeight
annotated member on theConstraintConfiguration
, so end users can change the constraint weights dynamically. This constraint may be deactivated if theConstraintWeight
is zero. If there is noConstraintConfiguration
, useConstraintStream.impact(String, Score)
instead.The
Constraint.getConstraintPackage()
defaults toConstraintConfiguration.constraintPackage()
.- Parameters:
constraintName
- never null, shows up inConstraintMatchTotal
during score justificationmatchWeigher
- never null, the result of this function (matchWeight) is multiplied by the constraintWeight- Returns:
- never null
-
impactConfigurableBigDecimal
Constraint impactConfigurableBigDecimal(String constraintPackage, String constraintName, Function<A,BigDecimal> matchWeigher)
As defined byimpactConfigurableBigDecimal(String, Function)
.- Parameters:
constraintPackage
- never nullconstraintName
- never nullmatchWeigher
- never null- Returns:
- never null
-
-