public abstract class BavetAbstractUniConstraintStream<Solution_,A> extends BavetAbstractConstraintStream<Solution_> implements InnerUniConstraintStream<A>
Modifier and Type | Field and Description |
---|---|
protected List<BavetAbstractUniConstraintStream<Solution_,A>> |
childStreamList |
constraintFactory
Constructor and Description |
---|
BavetAbstractUniConstraintStream(BavetConstraintFactory<Solution_> constraintFactory) |
Modifier and Type | Method and Description |
---|---|
void |
addChildStream(BavetAbstractUniConstraintStream<Solution_,A> childStream) |
protected void |
createChildNodeChains(BavetNodeBuildPolicy<Solution_> buildPolicy,
Score<?> constraintWeight,
int nodeOrder,
BavetAbstractUniNode<A> node) |
protected abstract BavetAbstractUniNode<A> |
createNode(BavetNodeBuildPolicy<Solution_> buildPolicy,
Score<?> constraintWeight,
int nodeOrder,
BavetAbstractUniNode<A> parentNode) |
BavetAbstractUniNode<A> |
createNodeChain(BavetNodeBuildPolicy<Solution_> buildPolicy,
Score<?> constraintWeight,
int nodeOrder,
BavetAbstractUniNode<A> parentNode) |
BavetAbstractUniConstraintStream<Solution_,A> |
filter(Predicate<A> predicate)
Exhaustively test each fact against the
Predicate
and match if Predicate.test(Object) returns true. |
<GroupKey_> |
groupBy(Function<A,GroupKey_> groupKeyMapping)
Convert the
UniConstraintStream to a different 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(Function<A,GroupKey_> groupKeyMapping,
UniConstraintCollector<A,ResultContainer_,Result_> collector)
Convert the
UniConstraintStream to a BiConstraintStream , consisting of unique tuples with two
facts. |
<GroupKeyA_,GroupKeyB_> |
groupBy(Function<A,GroupKeyA_> groupKeyAMapping,
Function<A,GroupKeyB_> groupKeyBMapping)
Convert the
UniConstraintStream to a BiConstraintStream , consisting of unique tuples with two
facts. |
<GroupKeyA_,GroupKeyB_,ResultContainer_,Result_> |
groupBy(Function<A,GroupKeyA_> groupKeyAMapping,
Function<A,GroupKeyB_> groupKeyBMapping,
UniConstraintCollector<A,ResultContainer_,Result_> collector)
Combines the semantics of
UniConstraintStream.groupBy(Function, Function) and UniConstraintStream.groupBy(UniConstraintCollector) . |
<GroupKeyA_,GroupKeyB_,ResultContainerC_,ResultC_,ResultContainerD_,ResultD_> |
groupBy(Function<A,GroupKeyA_> groupKeyAMapping,
Function<A,GroupKeyB_> groupKeyBMapping,
UniConstraintCollector<A,ResultContainerC_,ResultC_> collectorC,
UniConstraintCollector<A,ResultContainerD_,ResultD_> collectorD)
Combines the semantics of
UniConstraintStream.groupBy(Function, Function) and UniConstraintStream.groupBy(UniConstraintCollector) . |
<ResultContainer_,Result_> |
groupBy(UniConstraintCollector<A,ResultContainer_,Result_> collector)
Convert the
UniConstraintStream to a different UniConstraintStream , containing only a single
tuple, the result of applying UniConstraintCollector . |
Constraint |
impactScore(String constraintPackage,
String constraintName,
Score<?> constraintWeight,
boolean positive) |
Constraint |
impactScore(String constraintPackage,
String constraintName,
Score<?> constraintWeight,
ToIntFunction<A> matchWeigher,
boolean positive) |
Constraint |
impactScoreBigDecimal(String constraintPackage,
String constraintName,
Score<?> constraintWeight,
Function<A,BigDecimal> matchWeigher,
boolean positive) |
Constraint |
impactScoreConfigurable(String constraintPackage,
String constraintName,
boolean positive) |
Constraint |
impactScoreConfigurable(String constraintPackage,
String constraintName,
ToIntFunction<A> matchWeigher,
boolean positive) |
Constraint |
impactScoreConfigurableBigDecimal(String constraintPackage,
String constraintName,
Function<A,BigDecimal> matchWeigher,
boolean positive) |
Constraint |
impactScoreConfigurableLong(String constraintPackage,
String constraintName,
ToLongFunction<A> matchWeigher,
boolean positive) |
Constraint |
impactScoreLong(String constraintPackage,
String constraintName,
Score<?> constraintWeight,
ToLongFunction<A> matchWeigher,
boolean positive) |
<B> BiConstraintStream<A,B> |
join(UniConstraintStream<B> otherStream,
BiJoiner<A,B> joiner)
Create a new
BiConstraintStream for every combination of A and B for which the BiJoiner
is true (for the properties it extracts from both facts). |
protected BavetAbstractUniNode<A> |
processNode(BavetNodeBuildPolicy<Solution_> buildPolicy,
int nodeOrder,
BavetAbstractUniNode<A> parentNode,
BavetAbstractUniNode<A> node) |
buildConstraint, buildConstraintConfigurable, getConstraintFactory, getFromStreamList
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
join, join, join, join, join, join, join, penalize, penalizeBigDecimal, penalizeConfigurable, penalizeConfigurableBigDecimal, penalizeConfigurableLong, penalizeLong, reward, rewardBigDecimal, rewardConfigurable, rewardConfigurableBigDecimal, rewardConfigurableLong, rewardLong
getConstraintFactory, penalize, penalize, penalizeConfigurable, penalizeConfigurable, reward, reward, rewardConfigurable, rewardConfigurable
protected final List<BavetAbstractUniConstraintStream<Solution_,A>> childStreamList
public BavetAbstractUniConstraintStream(BavetConstraintFactory<Solution_> constraintFactory)
public void addChildStream(BavetAbstractUniConstraintStream<Solution_,A> childStream)
public BavetAbstractUniConstraintStream<Solution_,A> filter(Predicate<A> predicate)
UniConstraintStream
Predicate
and match if Predicate.test(Object)
returns true.filter
in interface UniConstraintStream<A>
predicate
- never nullpublic <B> BiConstraintStream<A,B> join(UniConstraintStream<B> otherStream, BiJoiner<A,B> joiner)
UniConstraintStream
BiConstraintStream
for every combination of A and B for which the BiJoiner
is true (for the properties it extracts from both facts).
Important: This is faster and more scalable than a join
followed by a filter
,
because it applies hashing and/or indexing on the properties,
so it doesn't create nor checks every combination of A and B.
join
in interface UniConstraintStream<A>
B
- the type of the second matched factotherStream
- never nulljoiner
- never nullBiJoiner
is truepublic <ResultContainer_,Result_> UniConstraintStream<Result_> groupBy(UniConstraintCollector<A,ResultContainer_,Result_> collector)
UniConstraintStream
UniConstraintStream
to a different UniConstraintStream
, containing only a single
tuple, the result of applying UniConstraintCollector
.groupBy
in interface UniConstraintStream<A>
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(Function<A,GroupKey_> groupKeyMapping)
UniConstraintStream
UniConstraintStream
to a different 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 UniConstraintStream<A>
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 <GroupKeyA_,GroupKeyB_> BiConstraintStream<GroupKeyA_,GroupKeyB_> groupBy(Function<A,GroupKeyA_> groupKeyAMapping, Function<A,GroupKeyB_> groupKeyBMapping)
UniConstraintStream
UniConstraintStream
to a BiConstraintStream
, 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.
groupBy
in interface UniConstraintStream<A>
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 original tuple into a first factgroupKeyBMapping
- never null, function to convert the original tuple into a second factpublic <GroupKey_,ResultContainer_,Result_> BiConstraintStream<GroupKey_,Result_> groupBy(Function<A,GroupKey_> groupKeyMapping, UniConstraintCollector<A,ResultContainer_,Result_> collector)
UniConstraintStream
UniConstraintStream
to a BiConstraintStream
, 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 a given UniConstraintCollector
applied on all incoming tuples with
the same first fact.
groupBy
in interface UniConstraintStream<A>
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_,ResultContainer_,Result_> TriConstraintStream<GroupKeyA_,GroupKeyB_,Result_> groupBy(Function<A,GroupKeyA_> groupKeyAMapping, Function<A,GroupKeyB_> groupKeyBMapping, UniConstraintCollector<A,ResultContainer_,Result_> collector)
UniConstraintStream
UniConstraintStream.groupBy(Function, Function)
and UniConstraintStream.groupBy(UniConstraintCollector)
.
That is, the first and second facts in the tuple follow the UniConstraintStream.groupBy(Function, Function)
semantics, and
the third fact is the result of applying UniConstraintCollector.finisher()
on all the tuples of the
original UniConstraintStream
that belong to the group.groupBy
in interface UniConstraintStream<A>
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(Function<A,GroupKeyA_> groupKeyAMapping, Function<A,GroupKeyB_> groupKeyBMapping, UniConstraintCollector<A,ResultContainerC_,ResultC_> collectorC, UniConstraintCollector<A,ResultContainerD_,ResultD_> collectorD)
UniConstraintStream
UniConstraintStream.groupBy(Function, Function)
and UniConstraintStream.groupBy(UniConstraintCollector)
.
That is, the first and second facts in the tuple follow the UniConstraintStream.groupBy(Function, Function)
semantics.
The third fact is the result of applying the first UniConstraintCollector.finisher()
on all the tuples
of the original UniConstraintStream
that belong to the group.
The fourth fact is the result of applying the second UniConstraintCollector.finisher()
on all the tuples
of the original UniConstraintStream
that belong to the groupgroupBy
in interface UniConstraintStream<A>
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 withpublic final Constraint impactScore(String constraintPackage, String constraintName, Score<?> constraintWeight, boolean positive)
impactScore
in class AbstractConstraintStream<Solution_>
public final Constraint impactScore(String constraintPackage, String constraintName, Score<?> constraintWeight, ToIntFunction<A> matchWeigher, boolean positive)
impactScore
in interface InnerUniConstraintStream<A>
public final Constraint impactScoreLong(String constraintPackage, String constraintName, Score<?> constraintWeight, ToLongFunction<A> matchWeigher, boolean positive)
impactScoreLong
in interface InnerUniConstraintStream<A>
public final Constraint impactScoreBigDecimal(String constraintPackage, String constraintName, Score<?> constraintWeight, Function<A,BigDecimal> matchWeigher, boolean positive)
impactScoreBigDecimal
in interface InnerUniConstraintStream<A>
public final Constraint impactScoreConfigurable(String constraintPackage, String constraintName, boolean positive)
impactScoreConfigurable
in class AbstractConstraintStream<Solution_>
public final Constraint impactScoreConfigurable(String constraintPackage, String constraintName, ToIntFunction<A> matchWeigher, boolean positive)
impactScoreConfigurable
in interface InnerUniConstraintStream<A>
public final Constraint impactScoreConfigurableLong(String constraintPackage, String constraintName, ToLongFunction<A> matchWeigher, boolean positive)
impactScoreConfigurableLong
in interface InnerUniConstraintStream<A>
public final Constraint impactScoreConfigurableBigDecimal(String constraintPackage, String constraintName, Function<A,BigDecimal> matchWeigher, boolean positive)
impactScoreConfigurableBigDecimal
in interface InnerUniConstraintStream<A>
public BavetAbstractUniNode<A> createNodeChain(BavetNodeBuildPolicy<Solution_> buildPolicy, Score<?> constraintWeight, int nodeOrder, BavetAbstractUniNode<A> parentNode)
protected BavetAbstractUniNode<A> processNode(BavetNodeBuildPolicy<Solution_> buildPolicy, int nodeOrder, BavetAbstractUniNode<A> parentNode, BavetAbstractUniNode<A> node)
protected void createChildNodeChains(BavetNodeBuildPolicy<Solution_> buildPolicy, Score<?> constraintWeight, int nodeOrder, BavetAbstractUniNode<A> node)
protected abstract BavetAbstractUniNode<A> createNode(BavetNodeBuildPolicy<Solution_> buildPolicy, Score<?> constraintWeight, int nodeOrder, BavetAbstractUniNode<A> parentNode)
Copyright © 2006–2020 JBoss by Red Hat. All rights reserved.