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 of 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 tuples which have:
As the first fact, the value resulting from applying the group key mapping function on the fact from the
original tuple. |
<ResultContainer_,Result_> |
groupBy(UniConstraintCollector<A,ResultContainer_,Result_> collector)
Runs all tuples of the stream through a given @
UniConstraintCollector and converts them into a new
UniConstraintStream which only has 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
UniConstraintCollector
and converts them into a new
UniConstraintStream
which only has 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 of 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 will 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 <GroupKey_,ResultContainer_,Result_> BiConstraintStream<GroupKey_,Result_> groupBy(Function<A,GroupKey_> groupKeyMapping, UniConstraintCollector<A,ResultContainer_,Result_> collector)
UniConstraintStream
UniConstraintStream
to a BiConstraintStream
, consisting of tuples which have:
Objects.equals(Object, Object)
any other.UniConstraintCollector
on all the facts of the
original tuple with a matching group key.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 a fact in original tuple to a different factpublic 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–2019 JBoss by Red Hat. All rights reserved.