public abstract class DroolsAbstractQuadConstraintStream<Solution_,A,B,C,D> extends DroolsAbstractConstraintStream<Solution_> implements InnerQuadConstraintStream<A,B,C,D>
Modifier and Type | Field and Description |
---|---|
protected DroolsAbstractConstraintStream<Solution_> |
parent |
constraintFactory
Constructor and Description |
---|
DroolsAbstractQuadConstraintStream(DroolsConstraintFactory<Solution_> constraintFactory,
DroolsAbstractConstraintStream<Solution_> parent) |
Modifier and Type | Method and Description |
---|---|
QuadConstraintStream<A,B,C,D> |
filter(QuadPredicate<A,B,C,D> predicate)
Exhaustively test each tuple of facts against the
QuadPredicate
and match if QuadPredicate.test(Object, Object, Object, Object) returns true. |
abstract DroolsQuadCondition<A,B,C,D> |
getCondition() |
List<DroolsFromUniConstraintStream<Solution_,Object>> |
getFromStreamList() |
<ResultContainer_,Result_> |
groupBy(QuadConstraintCollector<A,B,C,D,ResultContainer_,Result_> collector)
Convert the
QuadConstraintStream to a UniConstraintStream , containing only a single tuple, the
result of applying QuadConstraintCollector . |
<GroupKey_> |
groupBy(QuadFunction<A,B,C,D,GroupKey_> groupKeyMapping)
Convert the
QuadConstraintStream to a UniConstraintStream , containing the set of tuples resulting
from applying the group key mapping function on all tuples of the original stream. |
<GroupKey_,ResultContainer_,Result_> |
groupBy(QuadFunction<A,B,C,D,GroupKey_> groupKeyMapping,
QuadConstraintCollector<A,B,C,D,ResultContainer_,Result_> collector)
Convert the
QuadConstraintStream to a BiConstraintStream , consisting of unique tuples. |
<GroupKeyA_,GroupKeyB_> |
groupBy(QuadFunction<A,B,C,D,GroupKeyA_> groupKeyAMapping,
QuadFunction<A,B,C,D,GroupKeyB_> groupKeyBMapping)
Convert the
QuadConstraintStream to a BiConstraintStream , consisting of unique tuples. |
<GroupKeyA_,GroupKeyB_,ResultContainer_,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 of
QuadConstraintStream.groupBy(QuadFunction, QuadFunction) and
QuadConstraintStream.groupBy(QuadConstraintCollector) . |
<GroupKeyA_,GroupKeyB_,ResultContainerC_,ResultC_,ResultContainerD_,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 of
QuadConstraintStream.groupBy(QuadFunction, QuadFunction) and
QuadConstraintStream.groupBy(QuadConstraintCollector) . |
protected Constraint |
impactScore(String constraintPackage,
String constraintName,
Score<?> constraintWeight,
boolean positive) |
Constraint |
impactScore(String constraintPackage,
String constraintName,
Score<?> constraintWeight,
ToIntQuadFunction<A,B,C,D> matchWeigher,
boolean positive) |
Constraint |
impactScoreBigDecimal(String constraintPackage,
String constraintName,
Score<?> constraintWeight,
QuadFunction<A,B,C,D,BigDecimal> matchWeigher,
boolean positive) |
protected Constraint |
impactScoreConfigurable(String constraintPackage,
String constraintName,
boolean positive) |
Constraint |
impactScoreConfigurable(String constraintPackage,
String constraintName,
ToIntQuadFunction<A,B,C,D> matchWeigher,
boolean positive) |
Constraint |
impactScoreConfigurableBigDecimal(String constraintPackage,
String constraintName,
QuadFunction<A,B,C,D,BigDecimal> matchWeigher,
boolean positive) |
Constraint |
impactScoreConfigurableLong(String constraintPackage,
String constraintName,
ToLongQuadFunction<A,B,C,D> matchWeigher,
boolean positive) |
Constraint |
impactScoreLong(String constraintPackage,
String constraintName,
Score<?> constraintWeight,
ToLongQuadFunction<A,B,C,D> matchWeigher,
boolean positive) |
boolean |
isGroupByAllowed() |
addChildStream, buildConstraint, buildConstraintConfigurable, createRuleItemBuilders, getChildStreams, getConstraintFactory, throwWhenGroupByNotAllowed
buildConstraintWeightExtractor, buildConstraintWeightExtractor, penalize, penalizeConfigurable, reward, rewardConfigurable, validateConstraintId
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
penalize, penalizeBigDecimal, penalizeConfigurable, penalizeConfigurableBigDecimal, penalizeConfigurableLong, penalizeLong, reward, rewardBigDecimal, rewardConfigurable, rewardConfigurableBigDecimal, rewardConfigurableLong, rewardLong
penalize, penalizeBigDecimal, penalizeConfigurable, penalizeConfigurableBigDecimal, penalizeConfigurableLong, penalizeLong, reward, rewardBigDecimal, rewardConfigurable, rewardConfigurableBigDecimal, rewardConfigurableLong, rewardLong
getConstraintFactory, penalize, penalize, penalizeConfigurable, penalizeConfigurable, reward, reward, rewardConfigurable, rewardConfigurable
protected final DroolsAbstractConstraintStream<Solution_> parent
public DroolsAbstractQuadConstraintStream(DroolsConstraintFactory<Solution_> constraintFactory, DroolsAbstractConstraintStream<Solution_> parent)
public QuadConstraintStream<A,B,C,D> filter(QuadPredicate<A,B,C,D> predicate)
QuadConstraintStream
QuadPredicate
and match if QuadPredicate.test(Object, Object, Object, Object)
returns true.
Important: This is slower and less scalable than
TriConstraintStream.join(UniConstraintStream, QuadJoiner)
with a proper QuadJoiner
predicate
(such as Joiners.equal(TriFunction, Function)
,
because the latter applies hashing and/or indexing, so it doesn't create every combination just to filter it out.
public <ResultContainer_,Result_> UniConstraintStream<Result_> groupBy(QuadConstraintCollector<A,B,C,D,ResultContainer_,Result_> collector)
QuadConstraintStream
QuadConstraintStream
to a UniConstraintStream
, containing only a single tuple, the
result of applying QuadConstraintCollector
.
UniConstraintStream
which only has a single tuple, the result of applying
QuadConstraintCollector
.groupBy
in interface QuadConstraintStream<A,B,C,D>
ResultContainer_
- the mutable accumulation type (often hidden as an implementation detail)Result_
- the type of a fact in the destination UniConstraintStream
's tuplecollector
- never null, the collector to perform the grouping operation withpublic <GroupKey_> UniConstraintStream<GroupKey_> groupBy(QuadFunction<A,B,C,D,GroupKey_> groupKeyMapping)
QuadConstraintStream
QuadConstraintStream
to a UniConstraintStream
, 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 stream Objects.equals(Object, Object)
any other.groupBy
in interface QuadConstraintStream<A,B,C,D>
GroupKey_
- the type of a fact in the destination UniConstraintStream
's tuplegroupKeyMapping
- never null, mapping function to convert each element in the stream to a different elementpublic <GroupKey_,ResultContainer_,Result_> BiConstraintStream<GroupKey_,Result_> groupBy(QuadFunction<A,B,C,D,GroupKey_> groupKeyMapping, QuadConstraintCollector<A,B,C,D,ResultContainer_,Result_> collector)
QuadConstraintStream
QuadConstraintStream
to a BiConstraintStream
, 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 QuadConstraintCollector
applied on all incoming tuples
with the same first fact.
groupBy
in interface QuadConstraintStream<A,B,C,D>
GroupKey_
- the type of the first fact in the destination BiConstraintStream
's tupleResultContainer_
- the mutable accumulation type (often hidden as an implementation detail)Result_
- the type of the second fact in the destination BiConstraintStream
's tuplegroupKeyMapping
- never null, function to convert the fact in the original tuple to a different factpublic <GroupKeyA_,GroupKeyB_> BiConstraintStream<GroupKeyA_,GroupKeyB_> groupBy(QuadFunction<A,B,C,D,GroupKeyA_> groupKeyAMapping, QuadFunction<A,B,C,D,GroupKeyB_> groupKeyBMapping)
QuadConstraintStream
QuadConstraintStream
to a BiConstraintStream
, 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.
groupBy
in interface QuadConstraintStream<A,B,C,D>
GroupKeyA_
- the type of the first fact in the destination BiConstraintStream
's tupleGroupKeyB_
- the type of the second fact in the destination BiConstraintStream
's tuplegroupKeyAMapping
- 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 factpublic <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)
QuadConstraintStream
QuadConstraintStream.groupBy(QuadFunction, QuadFunction)
and
QuadConstraintStream.groupBy(QuadConstraintCollector)
.
That is, the first and second facts in the tuple follow the QuadConstraintStream.groupBy(QuadFunction, QuadFunction)
semantics,
and the third fact is the result of applying QuadConstraintCollector.finisher()
on all the tuples of the
original UniConstraintStream
that belong to the group.groupBy
in interface QuadConstraintStream<A,B,C,D>
GroupKeyA_
- the type of the first fact in the destination TriConstraintStream
's tupleGroupKeyB_
- the type of the second fact in the destination TriConstraintStream
's tupleResultContainer_
- the mutable accumulation type (often hidden as an implementation detail)Result_
- the type of the third fact in the destination TriConstraintStream
's tuplegroupKeyAMapping
- 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 withpublic <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)
QuadConstraintStream
QuadConstraintStream.groupBy(QuadFunction, QuadFunction)
and
QuadConstraintStream.groupBy(QuadConstraintCollector)
.
That is, the first and second facts in the tuple follow the QuadConstraintStream.groupBy(QuadFunction, QuadFunction)
semantics.
The third fact is the result of applying the first QuadConstraintCollector.finisher()
on all the tuples
of the original QuadConstraintStream
that belong to the group.
The fourth fact is the result of applying the second QuadConstraintCollector.finisher()
on all the tuples
of the original QuadConstraintStream
that belong to the groupgroupBy
in interface QuadConstraintStream<A,B,C,D>
GroupKeyA_
- the type of the first fact in the destination QuadConstraintStream
's tupleGroupKeyB_
- the type of the second fact in the destination QuadConstraintStream
's tupleResultContainerC_
- the mutable accumulation type (often hidden as an implementation detail)ResultC_
- the type of the third fact in the destination QuadConstraintStream
's tupleResultContainerD_
- the mutable accumulation type (often hidden as an implementation detail)ResultD_
- the type of the fourth fact in the destination QuadConstraintStream
's tuplegroupKeyAMapping
- 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 withcollectorD
- never null, the collector to perform the first grouping operation withprotected Constraint impactScore(String constraintPackage, String constraintName, Score<?> constraintWeight, boolean positive)
impactScore
in class AbstractConstraintStream<Solution_>
public Constraint impactScore(String constraintPackage, String constraintName, Score<?> constraintWeight, ToIntQuadFunction<A,B,C,D> matchWeigher, boolean positive)
impactScore
in interface InnerQuadConstraintStream<A,B,C,D>
public Constraint impactScoreLong(String constraintPackage, String constraintName, Score<?> constraintWeight, ToLongQuadFunction<A,B,C,D> matchWeigher, boolean positive)
impactScoreLong
in interface InnerQuadConstraintStream<A,B,C,D>
public Constraint impactScoreBigDecimal(String constraintPackage, String constraintName, Score<?> constraintWeight, QuadFunction<A,B,C,D,BigDecimal> matchWeigher, boolean positive)
impactScoreBigDecimal
in interface InnerQuadConstraintStream<A,B,C,D>
protected Constraint impactScoreConfigurable(String constraintPackage, String constraintName, boolean positive)
impactScoreConfigurable
in class AbstractConstraintStream<Solution_>
public Constraint impactScoreConfigurable(String constraintPackage, String constraintName, ToIntQuadFunction<A,B,C,D> matchWeigher, boolean positive)
impactScoreConfigurable
in interface InnerQuadConstraintStream<A,B,C,D>
public Constraint impactScoreConfigurableLong(String constraintPackage, String constraintName, ToLongQuadFunction<A,B,C,D> matchWeigher, boolean positive)
impactScoreConfigurableLong
in interface InnerQuadConstraintStream<A,B,C,D>
public Constraint impactScoreConfigurableBigDecimal(String constraintPackage, String constraintName, QuadFunction<A,B,C,D,BigDecimal> matchWeigher, boolean positive)
impactScoreConfigurableBigDecimal
in interface InnerQuadConstraintStream<A,B,C,D>
public List<DroolsFromUniConstraintStream<Solution_,Object>> getFromStreamList()
getFromStreamList
in class DroolsAbstractConstraintStream<Solution_>
public abstract DroolsQuadCondition<A,B,C,D> getCondition()
public boolean isGroupByAllowed()
isGroupByAllowed
in class DroolsAbstractConstraintStream<Solution_>
Copyright © 2006–2020 JBoss by Red Hat. All rights reserved.