Interface QuadConstraintStream<A,B,C,D>
-
- Type Parameters:
A- the type of the first matched fact (either a problem fact or aplanning entity)B- the type of the second matched fact (either a problem fact or aplanning entity)C- the type of the third matched fact (either a problem fact or aplanning entity)D- the type of the fourth matched fact (either a problem fact or aplanning entity)
- All Superinterfaces:
ConstraintStream
- All Known Subinterfaces:
InnerQuadConstraintStream<A,B,C,D>
- All Known Implementing Classes:
DroolsAbstractQuadConstraintStream,DroolsExistsQuadConstraintStream,DroolsFilterQuadConstraintStream,DroolsGroupingQuadConstraintStream,DroolsJoinQuadConstraintStream,DroolsScoringQuadConstraintStream
public interface QuadConstraintStream<A,B,C,D> extends ConstraintStream
AConstraintStreamthat matches four facts.- See Also:
ConstraintStream
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description QuadConstraintStream<A,B,C,D>filter(QuadPredicate<A,B,C,D> predicate)Exhaustively test each tuple of facts against theQuadPredicateand match ifQuadPredicate.test(Object, Object, Object, Object)returns true.<GroupKey_>
UniConstraintStream<GroupKey_>groupBy(QuadFunction<A,B,C,D,GroupKey_> groupKeyMapping)Convert theQuadConstraintStreamto aUniConstraintStream, 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(QuadFunction<A,B,C,D,GroupKey_> groupKeyMapping, QuadConstraintCollector<A,B,C,D,ResultContainer_,Result_> collector)Convert theQuadConstraintStreamto aBiConstraintStream, consisting of unique tuples.<GroupKeyA_,GroupKeyB_>
BiConstraintStream<GroupKeyA_,GroupKeyB_>groupBy(QuadFunction<A,B,C,D,GroupKeyA_> groupKeyAMapping, QuadFunction<A,B,C,D,GroupKeyB_> groupKeyBMapping)Convert theQuadConstraintStreamto aBiConstraintStream, consisting of unique tuples.<GroupKeyA_,GroupKeyB_,ResultContainer_,Result_>
TriConstraintStream<GroupKeyA_,GroupKeyB_,Result_>groupBy(QuadFunction<A,B,C,D,GroupKeyA_> groupKeyAMapping, QuadFunction<A,B,C,D,GroupKeyB_> groupKeyBMapping, QuadConstraintCollector<A,B,C,D,ResultContainer_,Result_> collector)Combines the semantics ofgroupBy(QuadFunction, QuadFunction)andgroupBy(QuadConstraintCollector).<GroupKeyA_,GroupKeyB_,ResultContainerC_,ResultC_,ResultContainerD_,ResultD_>
QuadConstraintStream<GroupKeyA_,GroupKeyB_,ResultC_,ResultD_>groupBy(QuadFunction<A,B,C,D,GroupKeyA_> groupKeyAMapping, QuadFunction<A,B,C,D,GroupKeyB_> groupKeyBMapping, QuadConstraintCollector<A,B,C,D,ResultContainerC_,ResultC_> collectorC, QuadConstraintCollector<A,B,C,D,ResultContainerD_,ResultD_> collectorD)Combines the semantics ofgroupBy(QuadFunction, QuadFunction)andgroupBy(QuadConstraintCollector).<ResultContainer_,Result_>
UniConstraintStream<Result_>groupBy(QuadConstraintCollector<A,B,C,D,ResultContainer_,Result_> collector)Convert theQuadConstraintStreamto aUniConstraintStream, containing only a single tuple, the result of applyingQuadConstraintCollector.default <E> QuadConstraintStream<A,B,C,D>ifExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E> joiner)Create a newBiConstraintStreamfor every tuple of A, B, C and D where E exists for which thePentaJoineris true (for the properties it extracts from the facts).<E> QuadConstraintStream<A,B,C,D>ifExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E>... joiners)As defined byifExists(Class, PentaJoiner).default <E> QuadConstraintStream<A,B,C,D>ifExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E> joiner1, PentaJoiner<A,B,C,D,E> joiner2)As defined byifExists(Class, PentaJoiner).default <E> QuadConstraintStream<A,B,C,D>ifExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E> joiner1, PentaJoiner<A,B,C,D,E> joiner2, PentaJoiner<A,B,C,D,E> joiner3)As defined byifExists(Class, PentaJoiner).default <E> QuadConstraintStream<A,B,C,D>ifExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E> joiner1, PentaJoiner<A,B,C,D,E> joiner2, PentaJoiner<A,B,C,D,E> joiner3, PentaJoiner<A,B,C,D,E> joiner4)As defined byifExists(Class, PentaJoiner).default <E> QuadConstraintStream<A,B,C,D>ifNotExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E> joiner)Create a newBiConstraintStreamfor every tuple of A, B, C and D where E does not exist for which thePentaJoineris true (for the properties it extracts from the facts).<E> QuadConstraintStream<A,B,C,D>ifNotExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E>... joiners)As defined byifNotExists(Class, PentaJoiner).default <E> QuadConstraintStream<A,B,C,D>ifNotExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E> joiner1, PentaJoiner<A,B,C,D,E> joiner2)As defined byifNotExists(Class, PentaJoiner).default <E> QuadConstraintStream<A,B,C,D>ifNotExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E> joiner1, PentaJoiner<A,B,C,D,E> joiner2, PentaJoiner<A,B,C,D,E> joiner3)As defined byifNotExists(Class, PentaJoiner).default <E> QuadConstraintStream<A,B,C,D>ifNotExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E> joiner1, PentaJoiner<A,B,C,D,E> joiner2, PentaJoiner<A,B,C,D,E> joiner3, PentaJoiner<A,B,C,D,E> joiner4)As defined byifNotExists(Class, PentaJoiner).Constraintimpact(String constraintPackage, String constraintName, Score<?> constraintWeight, ToIntQuadFunction<A,B,C,D> matchWeigher)As defined byimpact(String, Score, ToIntQuadFunction).default Constraintimpact(String constraintName, Score<?> constraintWeight, ToIntQuadFunction<A,B,C,D> matchWeigher)Positively or negatively impact theScoreby the constraintWeight multiplied by the match weight.ConstraintimpactBigDecimal(String constraintPackage, String constraintName, Score<?> constraintWeight, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)As defined byimpactBigDecimal(String, Score, QuadFunction).default ConstraintimpactBigDecimal(String constraintName, Score<?> constraintWeight, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)Positively or negatively impact theScoreby the constraintWeight multiplied by the match weight.ConstraintimpactConfigurable(String constraintPackage, String constraintName, ToIntQuadFunction<A,B,C,D> matchWeigher)As defined byimpactConfigurable(String, ToIntQuadFunction).default ConstraintimpactConfigurable(String constraintName, ToIntQuadFunction<A,B,C,D> matchWeigher)Positively or negatively impact theScoreby theConstraintWeightfor each match.ConstraintimpactConfigurableBigDecimal(String constraintPackage, String constraintName, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)As defined byimpactConfigurableBigDecimal(String, QuadFunction).default ConstraintimpactConfigurableBigDecimal(String constraintName, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)Positively or negatively impact theScoreby theConstraintWeightfor each match.ConstraintimpactConfigurableLong(String constraintPackage, String constraintName, ToLongQuadFunction<A,B,C,D> matchWeigher)As defined byimpactConfigurableLong(String, ToLongQuadFunction).default ConstraintimpactConfigurableLong(String constraintName, ToLongQuadFunction<A,B,C,D> matchWeigher)Positively or negatively impact theScoreby theConstraintWeightfor each match.ConstraintimpactLong(String constraintPackage, String constraintName, Score<?> constraintWeight, ToLongQuadFunction<A,B,C,D> matchWeigher)As defined byimpactLong(String, Score, ToLongQuadFunction).default ConstraintimpactLong(String constraintName, Score<?> constraintWeight, ToLongQuadFunction<A,B,C,D> matchWeigher)Positively or negatively impact theScoreby the constraintWeight multiplied by the match weight.Constraintpenalize(String constraintPackage, String constraintName, Score<?> constraintWeight, ToIntQuadFunction<A,B,C,D> matchWeigher)As defined bypenalize(String, Score, ToIntQuadFunction).default Constraintpenalize(String constraintName, Score<?> constraintWeight, ToIntQuadFunction<A,B,C,D> matchWeigher)Negatively impact theScore: subtract the constraintWeight multiplied by the match weight.ConstraintpenalizeBigDecimal(String constraintPackage, String constraintName, Score<?> constraintWeight, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)As defined bypenalizeBigDecimal(String, Score, QuadFunction).default ConstraintpenalizeBigDecimal(String constraintName, Score<?> constraintWeight, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)Negatively impact theScore: subtract the constraintWeight multiplied by the match weight.ConstraintpenalizeConfigurable(String constraintPackage, String constraintName, ToIntQuadFunction<A,B,C,D> matchWeigher)As defined bypenalizeConfigurable(String, ToIntQuadFunction).default ConstraintpenalizeConfigurable(String constraintName, ToIntQuadFunction<A,B,C,D> matchWeigher)Negatively impact theScore: subtract theConstraintWeightmultiplied by the match weight.ConstraintpenalizeConfigurableBigDecimal(String constraintPackage, String constraintName, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)As defined bypenalizeConfigurableBigDecimal(String, QuadFunction).default ConstraintpenalizeConfigurableBigDecimal(String constraintName, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)Negatively impact theScore: subtract theConstraintWeightmultiplied by the match weight.ConstraintpenalizeConfigurableLong(String constraintPackage, String constraintName, ToLongQuadFunction<A,B,C,D> matchWeigher)As defined bypenalizeConfigurableLong(String, ToLongQuadFunction).default ConstraintpenalizeConfigurableLong(String constraintName, ToLongQuadFunction<A,B,C,D> matchWeigher)Negatively impact theScore: subtract theConstraintWeightmultiplied by the match weight.ConstraintpenalizeLong(String constraintPackage, String constraintName, Score<?> constraintWeight, ToLongQuadFunction<A,B,C,D> matchWeigher)As defined bypenalizeLong(String, Score, ToLongQuadFunction).default ConstraintpenalizeLong(String constraintName, Score<?> constraintWeight, ToLongQuadFunction<A,B,C,D> matchWeigher)Negatively impact theScore: subtract the constraintWeight multiplied by the match weight.Constraintreward(String constraintPackage, String constraintName, Score<?> constraintWeight, ToIntQuadFunction<A,B,C,D> matchWeigher)As defined byreward(String, Score, ToIntQuadFunction).default Constraintreward(String constraintName, Score<?> constraintWeight, ToIntQuadFunction<A,B,C,D> matchWeigher)Positively impact theScore: add the constraintWeight multiplied by the match weight.ConstraintrewardBigDecimal(String constraintPackage, String constraintName, Score<?> constraintWeight, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)As defined byrewardBigDecimal(String, Score, QuadFunction).default ConstraintrewardBigDecimal(String constraintName, Score<?> constraintWeight, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)Positively impact theScore: add the constraintWeight multiplied by the match weight.ConstraintrewardConfigurable(String constraintPackage, String constraintName, ToIntQuadFunction<A,B,C,D> matchWeigher)As defined byrewardConfigurable(String, ToIntQuadFunction).default ConstraintrewardConfigurable(String constraintName, ToIntQuadFunction<A,B,C,D> matchWeigher)Positively impact theScore: add theConstraintWeightmultiplied by the match weight.ConstraintrewardConfigurableBigDecimal(String constraintPackage, String constraintName, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)As defined byrewardConfigurableBigDecimal(String, QuadFunction).default ConstraintrewardConfigurableBigDecimal(String constraintName, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)Positively impact theScore: add theConstraintWeightmultiplied by the match weight.ConstraintrewardConfigurableLong(String constraintPackage, String constraintName, ToLongQuadFunction<A,B,C,D> matchWeigher)As defined byrewardConfigurableLong(String, ToLongQuadFunction).default ConstraintrewardConfigurableLong(String constraintName, ToLongQuadFunction<A,B,C,D> matchWeigher)Positively impact theScore: add theConstraintWeightmultiplied by the match weight.ConstraintrewardLong(String constraintPackage, String constraintName, Score<?> constraintWeight, ToLongQuadFunction<A,B,C,D> matchWeigher)As defined byrewardLong(String, Score, ToLongQuadFunction).default ConstraintrewardLong(String constraintName, Score<?> constraintWeight, ToLongQuadFunction<A,B,C,D> 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
QuadConstraintStream<A,B,C,D> filter(QuadPredicate<A,B,C,D> predicate)
Exhaustively test each tuple of facts against theQuadPredicateand match ifQuadPredicate.test(Object, Object, Object, Object)returns true.Important: This is slower and less scalable than
TriConstraintStream.join(UniConstraintStream, QuadJoiner)with a properQuadJoinerpredicate (such asJoiners.equal(TriFunction, Function), because the latter applies hashing and/or indexing, so it doesn't create every combination just to filter it out.- Parameters:
predicate- never null- Returns:
- never null
-
ifExists
default <E> QuadConstraintStream<A,B,C,D> ifExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E> joiner)
Create a newBiConstraintStreamfor every tuple of A, B, C and D where E exists for which thePentaJoineris true (for the properties it extracts from the facts).This method has overloaded methods with multiple
PentaJoinerparameters.- Type Parameters:
E- the type of the fifth matched fact- Parameters:
otherClass- never nulljoiner- never null- Returns:
- never null, a stream that matches every tuple of A, B, C and D where E exists for which the
PentaJoineris true
-
ifExists
default <E> QuadConstraintStream<A,B,C,D> ifExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E> joiner1, PentaJoiner<A,B,C,D,E> joiner2)
As defined byifExists(Class, PentaJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
E- the type of the fifth matched fact- Parameters:
otherClass- never nulljoiner1- never nulljoiner2- never null- Returns:
- never null, a stream that matches every tuple of A, B, C and D where E exists for which the
PentaJoiners are true
-
ifExists
default <E> QuadConstraintStream<A,B,C,D> ifExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E> joiner1, PentaJoiner<A,B,C,D,E> joiner2, PentaJoiner<A,B,C,D,E> joiner3)
As defined byifExists(Class, PentaJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
E- the type of the fifth matched fact- Parameters:
otherClass- never nulljoiner1- never nulljoiner2- never nulljoiner3- never null- Returns:
- never null, a stream that matches every tuple of A, B, C and D where E exists for which the
PentaJoiners are true
-
ifExists
default <E> QuadConstraintStream<A,B,C,D> ifExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E> joiner1, PentaJoiner<A,B,C,D,E> joiner2, PentaJoiner<A,B,C,D,E> joiner3, PentaJoiner<A,B,C,D,E> joiner4)
As defined byifExists(Class, PentaJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
E- the type of the fifth matched fact- Parameters:
otherClass- never nulljoiner1- never nulljoiner2- never nulljoiner3- never nulljoiner4- never null- Returns:
- never null, a stream that matches every tuple of A, B, C and D where E exists for which the
PentaJoiners are true
-
ifExists
<E> QuadConstraintStream<A,B,C,D> ifExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E>... joiners)
As defined byifExists(Class, PentaJoiner). 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
SafeVarargsannotation because it's an interface method. Therefore, there are overloaded methods with up to 4PentaJoinerparameters.- Type Parameters:
E- the type of the fifth matched fact- Parameters:
otherClass- never nulljoiners- never null- Returns:
- never null, a stream that matches every tuple of A, B, C and D where E exists for which the
PentaJoiners are true
-
ifNotExists
default <E> QuadConstraintStream<A,B,C,D> ifNotExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E> joiner)
Create a newBiConstraintStreamfor every tuple of A, B, C and D where E does not exist for which thePentaJoineris true (for the properties it extracts from the facts).This method has overloaded methods with multiple
PentaJoinerparameters.- Type Parameters:
E- the type of the fifth matched fact- Parameters:
otherClass- never nulljoiner- never null- Returns:
- never null, a stream that matches every tuple of A, B, C and D where E does not exist for which the
PentaJoineris true
-
ifNotExists
default <E> QuadConstraintStream<A,B,C,D> ifNotExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E> joiner1, PentaJoiner<A,B,C,D,E> joiner2)
As defined byifNotExists(Class, PentaJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
E- the type of the fifth matched fact- Parameters:
otherClass- never nulljoiner1- never nulljoiner2- never null- Returns:
- never null, a stream that matches every tuple of A, B, C and D where E does not exist for which the
PentaJoiners are true
-
ifNotExists
default <E> QuadConstraintStream<A,B,C,D> ifNotExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E> joiner1, PentaJoiner<A,B,C,D,E> joiner2, PentaJoiner<A,B,C,D,E> joiner3)
As defined byifNotExists(Class, PentaJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
E- the type of the fifth matched fact- Parameters:
otherClass- never nulljoiner1- never nulljoiner2- never nulljoiner3- never null- Returns:
- never null, a stream that matches every tuple of A, B, C and D where E does not exist for which the
PentaJoiners are true
-
ifNotExists
default <E> QuadConstraintStream<A,B,C,D> ifNotExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E> joiner1, PentaJoiner<A,B,C,D,E> joiner2, PentaJoiner<A,B,C,D,E> joiner3, PentaJoiner<A,B,C,D,E> joiner4)
As defined byifNotExists(Class, PentaJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.- Type Parameters:
E- the type of the fifth matched fact- Parameters:
otherClass- never nulljoiner1- never nulljoiner2- never nulljoiner3- never nulljoiner4- never null- Returns:
- never null, a stream that matches every tuple of A, B, C and D where E does not exist for which the
PentaJoiners are true
-
ifNotExists
<E> QuadConstraintStream<A,B,C,D> ifNotExists(Class<E> otherClass, PentaJoiner<A,B,C,D,E>... joiners)
As defined byifNotExists(Class, PentaJoiner). 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
SafeVarargsannotation because it's an interface method. Therefore, there are overloaded methods with up to 4PentaJoinerparameters.- Type Parameters:
E- the type of the fifth matched fact- Parameters:
otherClass- never nulljoiners- never null- Returns:
- never null, a stream that matches every tuple of A, B, C and D where E does not exist for which the
PentaJoiners are true
-
groupBy
<ResultContainer_,Result_> UniConstraintStream<Result_> groupBy(QuadConstraintCollector<A,B,C,D,ResultContainer_,Result_> collector)
Convert theQuadConstraintStreamto aUniConstraintStream, containing only a single tuple, the result of applyingQuadConstraintCollector.UniConstraintStreamwhich only has a single tuple, the result of applyingQuadConstraintCollector.- 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 SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.- Returns:
- never null
-
groupBy
<GroupKey_> UniConstraintStream<GroupKey_> groupBy(QuadFunction<A,B,C,D,GroupKey_> groupKeyMapping)
Convert theQuadConstraintStreamto aUniConstraintStream, 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(QuadFunction<A,B,C,D,GroupKey_> groupKeyMapping, QuadConstraintCollector<A,B,C,D,ResultContainer_,Result_> collector)
Convert theQuadConstraintStreamto aBiConstraintStream, consisting of unique tuples.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 a given
QuadConstraintCollectorapplied 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 SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.- Returns:
- never null
-
groupBy
<GroupKeyA_,GroupKeyB_> BiConstraintStream<GroupKeyA_,GroupKeyB_> groupBy(QuadFunction<A,B,C,D,GroupKeyA_> groupKeyAMapping, QuadFunction<A,B,C,D,GroupKeyB_> groupKeyBMapping)
Convert theQuadConstraintStreamto aBiConstraintStream, consisting of unique tuples.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 facts in the original tuple to a new factgroupKeyBMapping- never null, function to convert the facts in the original tuple to another new fact- Returns:
- never null
-
groupBy
<GroupKeyA_,GroupKeyB_,ResultContainer_,Result_> TriConstraintStream<GroupKeyA_,GroupKeyB_,Result_> groupBy(QuadFunction<A,B,C,D,GroupKeyA_> groupKeyAMapping, QuadFunction<A,B,C,D,GroupKeyB_> groupKeyBMapping, QuadConstraintCollector<A,B,C,D,ResultContainer_,Result_> collector)
Combines the semantics ofgroupBy(QuadFunction, QuadFunction)andgroupBy(QuadConstraintCollector). That is, the first and second facts in the tuple follow thegroupBy(QuadFunction, QuadFunction)semantics, and the third fact is the result of applyingQuadConstraintCollector.finisher()on all the tuples of the originalUniConstraintStreamthat 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 SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.- Returns:
- never null
-
groupBy
<GroupKeyA_,GroupKeyB_,ResultContainerC_,ResultC_,ResultContainerD_,ResultD_> QuadConstraintStream<GroupKeyA_,GroupKeyB_,ResultC_,ResultD_> groupBy(QuadFunction<A,B,C,D,GroupKeyA_> groupKeyAMapping, QuadFunction<A,B,C,D,GroupKeyB_> groupKeyBMapping, QuadConstraintCollector<A,B,C,D,ResultContainerC_,ResultC_> collectorC, QuadConstraintCollector<A,B,C,D,ResultContainerD_,ResultD_> collectorD)
Combines the semantics ofgroupBy(QuadFunction, QuadFunction)andgroupBy(QuadConstraintCollector). That is, the first and second facts in the tuple follow thegroupBy(QuadFunction, QuadFunction)semantics. The third fact is the result of applying the firstQuadConstraintCollector.finisher()on all the tuples of the originalQuadConstraintStreamthat belong to the group. The fourth fact is the result of applying the secondQuadConstraintCollector.finisher()on all the tuples of the originalQuadConstraintStreamthat 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 SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.collectorD- never null, the collector to perform the second grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.- Returns:
- never null
-
penalize
default Constraint penalize(String constraintName, Score<?> constraintWeight, ToIntQuadFunction<A,B,C,D> matchWeigher)
Negatively impact theScore: subtract the constraintWeight multiplied by the match weight. Otherwise as defined byConstraintStream.penalize(String, Score).For non-int
Scoretypes usepenalizeLong(String, Score, ToLongQuadFunction)orpenalizeBigDecimal(String, Score, QuadFunction)instead.- Parameters:
constraintName- never null, shows up inConstraintMatchTotalduring 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, ToIntQuadFunction<A,B,C,D> matchWeigher)
As defined bypenalize(String, Score, ToIntQuadFunction).- Parameters:
constraintPackage- never nullconstraintName- never nullconstraintWeight- never nullmatchWeigher- never null- Returns:
- never null
-
penalizeLong
default Constraint penalizeLong(String constraintName, Score<?> constraintWeight, ToLongQuadFunction<A,B,C,D> 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 inConstraintMatchTotalduring 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, ToLongQuadFunction<A,B,C,D> matchWeigher)
As defined bypenalizeLong(String, Score, ToLongQuadFunction).- Parameters:
constraintPackage- never nullconstraintName- never nullconstraintWeight- never nullmatchWeigher- never null- Returns:
- never null
-
penalizeBigDecimal
default Constraint penalizeBigDecimal(String constraintName, Score<?> constraintWeight, QuadFunction<A,B,C,D,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 inConstraintMatchTotalduring 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, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)
As defined bypenalizeBigDecimal(String, Score, QuadFunction).- Parameters:
constraintPackage- never nullconstraintName- never nullconstraintWeight- never nullmatchWeigher- never null- Returns:
- never null
-
penalizeConfigurable
default Constraint penalizeConfigurable(String constraintName, ToIntQuadFunction<A,B,C,D> matchWeigher)
Negatively impact theScore: subtract theConstraintWeightmultiplied by the match weight. Otherwise as defined byConstraintStream.penalizeConfigurable(String).For non-int
Scoretypes usepenalizeConfigurableLong(String, ToLongQuadFunction)orpenalizeConfigurableBigDecimal(String, QuadFunction)instead.- Parameters:
constraintName- never null, shows up inConstraintMatchTotalduring 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, ToIntQuadFunction<A,B,C,D> matchWeigher)
As defined bypenalizeConfigurable(String, ToIntQuadFunction).- Parameters:
constraintPackage- never nullconstraintName- never nullmatchWeigher- never null- Returns:
- never null
-
penalizeConfigurableLong
default Constraint penalizeConfigurableLong(String constraintName, ToLongQuadFunction<A,B,C,D> matchWeigher)
Negatively impact theScore: subtract theConstraintWeightmultiplied by the match weight. Otherwise as defined byConstraintStream.penalizeConfigurable(String).- Parameters:
constraintName- never null, shows up inConstraintMatchTotalduring 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, ToLongQuadFunction<A,B,C,D> matchWeigher)
As defined bypenalizeConfigurableLong(String, ToLongQuadFunction).- Parameters:
constraintPackage- never nullconstraintName- never nullmatchWeigher- never null- Returns:
- never null
-
penalizeConfigurableBigDecimal
default Constraint penalizeConfigurableBigDecimal(String constraintName, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)
Negatively impact theScore: subtract theConstraintWeightmultiplied by the match weight. Otherwise as defined byConstraintStream.penalizeConfigurable(String).- Parameters:
constraintName- never null, shows up inConstraintMatchTotalduring 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, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)
As defined bypenalizeConfigurableBigDecimal(String, QuadFunction).- Parameters:
constraintPackage- never nullconstraintName- never nullmatchWeigher- never null- Returns:
- never null
-
reward
default Constraint reward(String constraintName, Score<?> constraintWeight, ToIntQuadFunction<A,B,C,D> matchWeigher)
Positively impact theScore: add the constraintWeight multiplied by the match weight. Otherwise as defined byConstraintStream.reward(String, Score).For non-int
Scoretypes userewardLong(String, Score, ToLongQuadFunction)orrewardBigDecimal(String, Score, QuadFunction)instead.- Parameters:
constraintName- never null, shows up inConstraintMatchTotalduring 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, ToIntQuadFunction<A,B,C,D> matchWeigher)
As defined byreward(String, Score, ToIntQuadFunction).- Parameters:
constraintPackage- never nullconstraintName- never nullconstraintWeight- never nullmatchWeigher- never null- Returns:
- never null
-
rewardLong
default Constraint rewardLong(String constraintName, Score<?> constraintWeight, ToLongQuadFunction<A,B,C,D> 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 inConstraintMatchTotalduring 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, ToLongQuadFunction<A,B,C,D> matchWeigher)
As defined byrewardLong(String, Score, ToLongQuadFunction).- Parameters:
constraintPackage- never nullconstraintName- never nullconstraintWeight- never nullmatchWeigher- never null- Returns:
- never null
-
rewardBigDecimal
default Constraint rewardBigDecimal(String constraintName, Score<?> constraintWeight, QuadFunction<A,B,C,D,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 inConstraintMatchTotalduring 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, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)
As defined byrewardBigDecimal(String, Score, QuadFunction).- Parameters:
constraintPackage- never nullconstraintName- never nullconstraintWeight- never nullmatchWeigher- never null- Returns:
- never null
-
rewardConfigurable
default Constraint rewardConfigurable(String constraintName, ToIntQuadFunction<A,B,C,D> matchWeigher)
Positively impact theScore: add theConstraintWeightmultiplied by the match weight. Otherwise as defined byConstraintStream.rewardConfigurable(String).For non-int
Scoretypes userewardConfigurableLong(String, ToLongQuadFunction)orrewardConfigurableBigDecimal(String, QuadFunction)instead.- Parameters:
constraintName- never null, shows up inConstraintMatchTotalduring 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, ToIntQuadFunction<A,B,C,D> matchWeigher)
As defined byrewardConfigurable(String, ToIntQuadFunction).- Parameters:
constraintPackage- never nullconstraintName- never nullmatchWeigher- never null- Returns:
- never null
-
rewardConfigurableLong
default Constraint rewardConfigurableLong(String constraintName, ToLongQuadFunction<A,B,C,D> matchWeigher)
Positively impact theScore: add theConstraintWeightmultiplied by the match weight. Otherwise as defined byConstraintStream.rewardConfigurable(String).- Parameters:
constraintName- never null, shows up inConstraintMatchTotalduring 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, ToLongQuadFunction<A,B,C,D> matchWeigher)
As defined byrewardConfigurableLong(String, ToLongQuadFunction).- Parameters:
constraintPackage- never nullconstraintName- never nullmatchWeigher- never null- Returns:
- never null
-
rewardConfigurableBigDecimal
default Constraint rewardConfigurableBigDecimal(String constraintName, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)
Positively impact theScore: add theConstraintWeightmultiplied by the match weight. Otherwise as defined byConstraintStream.rewardConfigurable(String).- Parameters:
constraintName- never null, shows up inConstraintMatchTotalduring 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, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)
As defined byrewardConfigurableBigDecimal(String, QuadFunction).- Parameters:
constraintPackage- never nullconstraintName- never nullmatchWeigher- never null- Returns:
- never null
-
impact
default Constraint impact(String constraintName, Score<?> constraintWeight, ToIntQuadFunction<A,B,C,D> matchWeigher)
Positively or negatively impact theScoreby 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
Scoretypes useimpactLong(String, Score, ToLongQuadFunction)orimpactBigDecimal(String, Score, QuadFunction)instead.- Parameters:
constraintName- never null, shows up inConstraintMatchTotalduring 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, ToIntQuadFunction<A,B,C,D> matchWeigher)
As defined byimpact(String, Score, ToIntQuadFunction).- Parameters:
constraintPackage- never nullconstraintName- never nullconstraintWeight- never nullmatchWeigher- never null- Returns:
- never null
-
impactLong
default Constraint impactLong(String constraintName, Score<?> constraintWeight, ToLongQuadFunction<A,B,C,D> matchWeigher)
Positively or negatively impact theScoreby 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 inConstraintMatchTotalduring 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, ToLongQuadFunction<A,B,C,D> matchWeigher)
As defined byimpactLong(String, Score, ToLongQuadFunction).- Parameters:
constraintPackage- never nullconstraintName- never nullconstraintWeight- never nullmatchWeigher- never null- Returns:
- never null
-
impactBigDecimal
default Constraint impactBigDecimal(String constraintName, Score<?> constraintWeight, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)
Positively or negatively impact theScoreby 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 inConstraintMatchTotalduring 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, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)
As defined byimpactBigDecimal(String, Score, QuadFunction).- Parameters:
constraintPackage- never nullconstraintName- never nullconstraintWeight- never nullmatchWeigher- never null- Returns:
- never null
-
impactConfigurable
default Constraint impactConfigurable(String constraintName, ToIntQuadFunction<A,B,C,D> matchWeigher)
Positively or negatively impact theScoreby theConstraintWeightfor each match.Use
penalizeConfigurable(...)orrewardConfigurable(...)instead, unless this constraint can both have positive and negative weights.For non-int
Scoretypes useimpactConfigurableLong(String, ToLongQuadFunction)orimpactConfigurableBigDecimal(String, QuadFunction)instead.The constraintWeight comes from an
ConstraintWeightannotated member on theConstraintConfiguration, so end users can change the constraint weights dynamically. This constraint may be deactivated if theConstraintWeightis zero. If there is noConstraintConfiguration, useConstraintStream.impact(String, Score)instead.The
Constraint.getConstraintPackage()defaults toConstraintConfiguration.constraintPackage().- Parameters:
constraintName- never null, shows up inConstraintMatchTotalduring 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, ToIntQuadFunction<A,B,C,D> matchWeigher)
As defined byimpactConfigurable(String, ToIntQuadFunction).- Parameters:
constraintPackage- never nullconstraintName- never nullmatchWeigher- never null- Returns:
- never null
-
impactConfigurableLong
default Constraint impactConfigurableLong(String constraintName, ToLongQuadFunction<A,B,C,D> matchWeigher)
Positively or negatively impact theScoreby theConstraintWeightfor each match.Use
penalizeConfigurableLong(...)orrewardConfigurableLong(...)instead, unless this constraint can both have positive and negative weights.The constraintWeight comes from an
ConstraintWeightannotated member on theConstraintConfiguration, so end users can change the constraint weights dynamically. This constraint may be deactivated if theConstraintWeightis zero. If there is noConstraintConfiguration, useConstraintStream.impact(String, Score)instead.The
Constraint.getConstraintPackage()defaults toConstraintConfiguration.constraintPackage().- Parameters:
constraintName- never null, shows up inConstraintMatchTotalduring 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, ToLongQuadFunction<A,B,C,D> matchWeigher)
As defined byimpactConfigurableLong(String, ToLongQuadFunction).- Parameters:
constraintPackage- never nullconstraintName- never nullmatchWeigher- never null- Returns:
- never null
-
impactConfigurableBigDecimal
default Constraint impactConfigurableBigDecimal(String constraintName, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)
Positively or negatively impact theScoreby theConstraintWeightfor each match.Use
penalizeConfigurableBigDecimal(...)orrewardConfigurableBigDecimal(...)instead, unless this constraint can both have positive and negative weights.The constraintWeight comes from an
ConstraintWeightannotated member on theConstraintConfiguration, so end users can change the constraint weights dynamically. This constraint may be deactivated if theConstraintWeightis zero. If there is noConstraintConfiguration, useConstraintStream.impact(String, Score)instead.The
Constraint.getConstraintPackage()defaults toConstraintConfiguration.constraintPackage().- Parameters:
constraintName- never null, shows up inConstraintMatchTotalduring 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, QuadFunction<A,B,C,D,BigDecimal> matchWeigher)
As defined byimpactConfigurableBigDecimal(String, QuadFunction).- Parameters:
constraintPackage- never nullconstraintName- never nullmatchWeigher- never null- Returns:
- never null
-
-