Class BavetAbstractUniConstraintStream<Solution_,A>
- All Implemented Interfaces:
ConstraintStream,UniConstraintStream<A>,BavetStream,InnerUniConstraintStream<A>
- Direct Known Subclasses:
BavetAftBridgeUniConstraintStream,BavetForEachUniConstraintStream,BavetForeBridgeUniConstraintStream,BavetUniConcatUniConstraintStream
-
Field Summary
Fields inherited from class ai.timefold.solver.core.impl.bavet.common.BavetAbstractConstraintStream
childStreamList, constraintFactory, parent -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBavetAbstractUniConstraintStream(BavetConstraintFactory<Solution_> constraintFactory, BavetAbstractConstraintStream<Solution_> parent) protectedBavetAbstractUniConstraintStream(BavetConstraintFactory<Solution_> constraintFactory, RetrievalSemantics retrievalSemantics) -
Method Summary
Modifier and TypeMethodDescription<B> @NonNull BiConstraintStream<A,B> concat(@NonNull BiConstraintStream<A, B> otherStream, @NonNull Function<A, B> paddingFunction) Returns a newBiConstraintStreamcontaining all the tuples of both thisUniConstraintStreamand the providedBiConstraintStream.<B,C, D> @NonNull QuadConstraintStream<A, B, C, D> concat(@NonNull QuadConstraintStream<A, B, C, D> otherStream, @NonNull Function<A, B> paddingFunctionB, @NonNull Function<A, C> paddingFunctionC, @NonNull Function<A, D> paddingFunctionD) Returns a newQuadConstraintStreamcontaining all the tuples of both thisUniConstraintStreamand the providedQuadConstraintStream.<B,C> @NonNull TriConstraintStream<A, B, C> concat(@NonNull TriConstraintStream<A, B, C> otherStream, @NonNull Function<A, B> paddingFunctionB, @NonNull Function<A, C> paddingFunctionC) Returns a newTriConstraintStreamcontaining all the tuples of both thisUniConstraintStreamand the providedTriConstraintStream.@NonNull UniConstraintStream<A>concat(@NonNull UniConstraintStream<A> otherStream) Returns a newUniConstraintStreamcontaining all the tuples of both thisUniConstraintStreamand the providedUniConstraintStream.@NonNull UniConstraintStream<A>distinct()Transforms the stream in such a way that all the tuples going through it are distinct.<ResultB_> @NonNull BiConstraintStream<A,ResultB_> Adds a fact to the end of the tuple, increasing the cardinality of the stream.<ResultB_,ResultC_>
@NonNull TriConstraintStream<A,ResultB_, ResultC_> Adds two facts to the end of the tuple, increasing the cardinality of the stream.<ResultB_,ResultC_, ResultD_>
@NonNull QuadConstraintStream<A,ResultB_, ResultC_, ResultD_> expand(@NonNull Function<A, ResultB_> mappingB, @NonNull Function<A, ResultC_> mappingC, @NonNull Function<A, ResultD_> mappingD) Adds three facts to the end of the tuple, increasing the cardinality of the stream.@NonNull UniConstraintStream<A>Exhaustively test each fact against thePredicateand match ifPredicate.test(Object)returns true.<ResultA_> @NonNull UniConstraintStream<ResultA_>flattenLast(@NonNull Function<A, Iterable<ResultA_>> mapping) Takes each tuple and applies a mapping on it, which turns the tuple into aIterable.protected final Function<A,Collection<?>> protected final BiFunction<A,Score<?>, DefaultConstraintJustification> <ResultContainer_,Result_>
@NonNull UniConstraintStream<Result_>groupBy(@NonNull UniConstraintCollector<A, ResultContainer_, Result_> collector) Convert theUniConstraintStreamto a differentUniConstraintStream, containing only a single tuple, the result of applyingUniConstraintCollector.<ResultContainerA_,ResultA_, ResultContainerB_, ResultB_>
@NonNull BiConstraintStream<ResultA_,ResultB_> groupBy(@NonNull UniConstraintCollector<A, ResultContainerA_, ResultA_> collectorA, @NonNull UniConstraintCollector<A, ResultContainerB_, ResultB_> collectorB) Convert theUniConstraintStreamto aBiConstraintStream, containing only a single tuple, the result of applying twoUniConstraintCollectors.<ResultContainerA_,ResultA_, ResultContainerB_, ResultB_, ResultContainerC_, ResultC_>
@NonNull TriConstraintStream<ResultA_,ResultB_, ResultC_> groupBy(@NonNull UniConstraintCollector<A, ResultContainerA_, ResultA_> collectorA, @NonNull UniConstraintCollector<A, ResultContainerB_, ResultB_> collectorB, @NonNull UniConstraintCollector<A, ResultContainerC_, ResultC_> collectorC) Convert theUniConstraintStreamto aTriConstraintStream, containing only a single tuple, the result of applying threeUniConstraintCollectors.<ResultContainerA_,ResultA_, ResultContainerB_, ResultB_, ResultContainerC_, ResultC_, ResultContainerD_, ResultD_>
@NonNull QuadConstraintStream<ResultA_,ResultB_, ResultC_, ResultD_> groupBy(@NonNull UniConstraintCollector<A, ResultContainerA_, ResultA_> collectorA, @NonNull UniConstraintCollector<A, ResultContainerB_, ResultB_> collectorB, @NonNull UniConstraintCollector<A, ResultContainerC_, ResultC_> collectorC, @NonNull UniConstraintCollector<A, ResultContainerD_, ResultD_> collectorD) Convert theUniConstraintStreamto aQuadConstraintStream, containing only a single tuple, the result of applying fourUniConstraintCollectors.<GroupKey_>
@NonNull UniConstraintStream<GroupKey_>Convert theUniConstraintStreamto 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_>
@NonNull BiConstraintStream<GroupKey_,Result_> groupBy(@NonNull Function<A, GroupKey_> groupKeyMapping, @NonNull UniConstraintCollector<A, ResultContainer_, Result_> collector) Convert theUniConstraintStreamto aBiConstraintStream, consisting of unique tuples with two facts.<GroupKey_,ResultContainerB_, ResultB_, ResultContainerC_, ResultC_>
@NonNull TriConstraintStream<GroupKey_,ResultB_, ResultC_> groupBy(@NonNull Function<A, GroupKey_> groupKeyMapping, @NonNull UniConstraintCollector<A, ResultContainerB_, ResultB_> collectorB, @NonNull UniConstraintCollector<A, ResultContainerC_, ResultC_> collectorC) Convert theUniConstraintStreamto aTriConstraintStream, consisting of unique tuples with three facts.<GroupKey_,ResultContainerB_, ResultB_, ResultContainerC_, ResultC_, ResultContainerD_, ResultD_>
@NonNull QuadConstraintStream<GroupKey_,ResultB_, ResultC_, ResultD_> groupBy(@NonNull Function<A, GroupKey_> groupKeyMapping, @NonNull UniConstraintCollector<A, ResultContainerB_, ResultB_> collectorB, @NonNull UniConstraintCollector<A, ResultContainerC_, ResultC_> collectorC, @NonNull UniConstraintCollector<A, ResultContainerD_, ResultD_> collectorD) Convert theUniConstraintStreamto aQuadConstraintStream, consisting of unique tuples with four facts.<GroupKeyA_,GroupKeyB_>
@NonNull BiConstraintStream<GroupKeyA_,GroupKeyB_> groupBy(@NonNull Function<A, GroupKeyA_> groupKeyAMapping, @NonNull Function<A, GroupKeyB_> groupKeyBMapping) Convert theUniConstraintStreamto aBiConstraintStream, consisting of unique tuples with two facts.<GroupKeyA_,GroupKeyB_, ResultContainer_, Result_>
@NonNull TriConstraintStream<GroupKeyA_,GroupKeyB_, Result_> groupBy(@NonNull Function<A, GroupKeyA_> groupKeyAMapping, @NonNull Function<A, GroupKeyB_> groupKeyBMapping, @NonNull UniConstraintCollector<A, ResultContainer_, Result_> collector) Combines the semantics ofUniConstraintStream.groupBy(Function, Function)andUniConstraintStream.groupBy(UniConstraintCollector).<GroupKeyA_,GroupKeyB_, ResultContainerC_, ResultC_, ResultContainerD_, ResultD_>
@NonNull QuadConstraintStream<GroupKeyA_,GroupKeyB_, ResultC_, ResultD_> groupBy(@NonNull Function<A, GroupKeyA_> groupKeyAMapping, @NonNull Function<A, GroupKeyB_> groupKeyBMapping, @NonNull UniConstraintCollector<A, ResultContainerC_, ResultC_> collectorC, @NonNull UniConstraintCollector<A, ResultContainerD_, ResultD_> collectorD) Combines the semantics ofUniConstraintStream.groupBy(Function, Function)andUniConstraintStream.groupBy(UniConstraintCollector).<GroupKeyA_,GroupKeyB_, GroupKeyC_>
@NonNull TriConstraintStream<GroupKeyA_,GroupKeyB_, GroupKeyC_> groupBy(@NonNull Function<A, GroupKeyA_> groupKeyAMapping, @NonNull Function<A, GroupKeyB_> groupKeyBMapping, @NonNull Function<A, GroupKeyC_> groupKeyCMapping) Convert theUniConstraintStreamto aTriConstraintStream, consisting of unique tuples with three facts.<GroupKeyA_,GroupKeyB_, GroupKeyC_, ResultContainerD_, ResultD_>
@NonNull QuadConstraintStream<GroupKeyA_,GroupKeyB_, GroupKeyC_, ResultD_> groupBy(@NonNull Function<A, GroupKeyA_> groupKeyAMapping, @NonNull Function<A, GroupKeyB_> groupKeyBMapping, @NonNull Function<A, GroupKeyC_> groupKeyCMapping, @NonNull UniConstraintCollector<A, ResultContainerD_, ResultD_> collectorD) Combines the semantics ofUniConstraintStream.groupBy(Function, Function)andUniConstraintStream.groupBy(UniConstraintCollector).<GroupKeyA_,GroupKeyB_, GroupKeyC_, GroupKeyD_>
@NonNull QuadConstraintStream<GroupKeyA_,GroupKeyB_, GroupKeyC_, GroupKeyD_> groupBy(@NonNull Function<A, GroupKeyA_> groupKeyAMapping, @NonNull Function<A, GroupKeyB_> groupKeyBMapping, @NonNull Function<A, GroupKeyC_> groupKeyCMapping, @NonNull Function<A, GroupKeyD_> groupKeyDMapping) Convert theUniConstraintStreamto aQuadConstraintStream, consisting of unique tuples with four facts.final <B> @NonNull UniConstraintStream<A>ifExists(@NonNull UniConstraintStream<B> otherStream, @NonNull BiJoiner<A, B>... joiners) As defined byUniConstraintStream.ifExists(UniConstraintStream, BiJoiner).final <B> @NonNull UniConstraintStream<A>ifNotExists(@NonNull UniConstraintStream<B> otherStream, @NonNull BiJoiner<A, B>... joiners) <Score_ extends Score<Score_>>
UniConstraintBuilder<A,Score_> innerImpact(Score_ constraintWeight, Function<A, BigDecimal> matchWeigher, ScoreImpactType scoreImpactType) <Score_ extends Score<Score_>>
UniConstraintBuilder<A,Score_> innerImpact(Score_ constraintWeight, ToIntFunction<A> matchWeigher, ScoreImpactType scoreImpactType) <Score_ extends Score<Score_>>
UniConstraintBuilder<A,Score_> innerImpact(Score_ constraintWeight, ToLongFunction<A> matchWeigher, ScoreImpactType scoreImpactType) final <B> @NonNull BiConstraintStream<A,B> join(@NonNull UniConstraintStream<B> otherStream, @NonNull BiJoiner<A, B>... joiners) As defined byUniConstraintStream.join(UniConstraintStream, BiJoiner).final <B> BiConstraintStream<A,B> join(UniConstraintStream<B> otherStream, BiJoinerComber<A, B> joinerComber) AllowsConstraintFactory.forEachUniquePair(Class)to reuse the joiner combing logic.<ResultA_> @NonNull UniConstraintStream<ResultA_>Transforms the stream in such a way that tuples are remapped using the given function.<ResultA_,ResultB_>
@NonNull BiConstraintStream<ResultA_,ResultB_> As defined byUniConstraintStream.map(Function), only resulting inBiConstraintStream.<ResultA_,ResultB_, ResultC_>
@NonNull TriConstraintStream<ResultA_,ResultB_, ResultC_> map(@NonNull Function<A, ResultA_> mappingA, @NonNull Function<A, ResultB_> mappingB, @NonNull Function<A, ResultC_> mappingC) As defined byUniConstraintStream.map(Function), only resulting inTriConstraintStream.<ResultA_,ResultB_, ResultC_, ResultD_>
@NonNull QuadConstraintStream<ResultA_,ResultB_, ResultC_, ResultD_> map(@NonNull Function<A, ResultA_> mappingA, @NonNull Function<A, ResultB_> mappingB, @NonNull Function<A, ResultC_> mappingC, @NonNull Function<A, ResultD_> mappingD) As defined byUniConstraintStream.map(Function), only resulting inQuadConstraintStream.Methods inherited from class ai.timefold.solver.core.impl.bavet.common.BavetAbstractConstraintStream
assertEmptyChildStreamList, buildConstraint, buildNode, collectActiveConstraintStreams, getChildStreamList, getConstraintFactory, getParent, getTupleSource, guaranteesDistinct, shareAndAddChildMethods inherited from class ai.timefold.solver.core.impl.score.stream.common.AbstractConstraintStream
getRetrievalSemanticsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ai.timefold.solver.core.api.score.stream.ConstraintStream
getConstraintFactoryMethods inherited from interface ai.timefold.solver.core.impl.score.stream.common.uni.InnerUniConstraintStream
getRetrievalSemantics, guaranteesDistinct, ifExists, ifExistsIncludingUnassigned, ifNotExists, ifNotExistsIncludingUnassigned, impact, impact, impact, impactBigDecimal, impactConfigurable, impactConfigurableBigDecimal, impactConfigurableLong, impactLong, join, penalize, penalize, penalize, penalizeBigDecimal, penalizeConfigurable, penalizeConfigurable, penalizeConfigurable, penalizeConfigurableBigDecimal, penalizeConfigurableLong, penalizeLong, reward, reward, reward, rewardBigDecimal, rewardConfigurable, rewardConfigurable, rewardConfigurable, rewardConfigurableBigDecimal, rewardConfigurableLong, rewardLongMethods inherited from interface ai.timefold.solver.core.api.score.stream.uni.UniConstraintStream
complement, concat, concat, concat, ifExists, ifExists, ifExists, ifExists, ifExists, ifExists, ifExists, ifExists, ifExistsIncludingNullVars, ifExistsIncludingNullVars, ifExistsIncludingNullVars, ifExistsIncludingNullVars, ifExistsIncludingNullVars, ifExistsIncludingUnassigned, ifExistsIncludingUnassigned, ifExistsIncludingUnassigned, ifExistsIncludingUnassigned, ifExistsOther, ifExistsOther, ifExistsOther, ifExistsOther, ifExistsOther, ifExistsOther, ifExistsOtherIncludingNullVars, ifExistsOtherIncludingNullVars, ifExistsOtherIncludingNullVars, ifExistsOtherIncludingNullVars, ifExistsOtherIncludingNullVars, ifExistsOtherIncludingNullVars, ifExistsOtherIncludingUnassigned, ifExistsOtherIncludingUnassigned, ifExistsOtherIncludingUnassigned, ifExistsOtherIncludingUnassigned, ifExistsOtherIncludingUnassigned, ifExistsOtherIncludingUnassigned, ifNotExists, ifNotExists, ifNotExists, ifNotExists, ifNotExists, ifNotExists, ifNotExists, ifNotExists, ifNotExistsIncludingNullVars, ifNotExistsIncludingNullVars, ifNotExistsIncludingNullVars, ifNotExistsIncludingNullVars, ifNotExistsIncludingNullVars, ifNotExistsIncludingUnassigned, ifNotExistsIncludingUnassigned, ifNotExistsIncludingUnassigned, ifNotExistsIncludingUnassigned, ifNotExistsOther, ifNotExistsOther, ifNotExistsOther, ifNotExistsOther, ifNotExistsOther, ifNotExistsOther, ifNotExistsOtherIncludingNullVars, ifNotExistsOtherIncludingNullVars, ifNotExistsOtherIncludingNullVars, ifNotExistsOtherIncludingNullVars, ifNotExistsOtherIncludingNullVars, ifNotExistsOtherIncludingNullVars, ifNotExistsOtherIncludingUnassigned, ifNotExistsOtherIncludingUnassigned, ifNotExistsOtherIncludingUnassigned, ifNotExistsOtherIncludingUnassigned, ifNotExistsOtherIncludingUnassigned, ifNotExistsOtherIncludingUnassigned, impact, impact, impact, impactBigDecimal, impactBigDecimal, impactConfigurable, impactConfigurable, impactConfigurable, impactConfigurableBigDecimal, impactConfigurableBigDecimal, impactConfigurableLong, impactConfigurableLong, impactLong, impactLong, join, join, join, join, join, join, join, join, join, join, penalize, penalize, penalize, penalizeBigDecimal, penalizeBigDecimal, penalizeBigDecimal, penalizeConfigurable, penalizeConfigurable, penalizeConfigurable, penalizeConfigurableBigDecimal, penalizeConfigurableBigDecimal, penalizeConfigurableLong, penalizeConfigurableLong, penalizeLong, penalizeLong, penalizeLong, reward, reward, reward, rewardBigDecimal, rewardBigDecimal, rewardConfigurable, rewardConfigurable, rewardConfigurable, rewardConfigurableBigDecimal, rewardConfigurableBigDecimal, rewardConfigurableLong, rewardConfigurableLong, rewardLong, rewardLong
-
Constructor Details
-
BavetAbstractUniConstraintStream
protected BavetAbstractUniConstraintStream(BavetConstraintFactory<Solution_> constraintFactory, BavetAbstractConstraintStream<Solution_> parent) -
BavetAbstractUniConstraintStream
protected BavetAbstractUniConstraintStream(BavetConstraintFactory<Solution_> constraintFactory, RetrievalSemantics retrievalSemantics)
-
-
Method Details
-
filter
Description copied from interface:UniConstraintStreamExhaustively test each fact against thePredicateand match ifPredicate.test(Object)returns true.- Specified by:
filterin interfaceUniConstraintStream<Solution_>
-
join
@SafeVarargs public final <B> @NonNull BiConstraintStream<A,B> join(@NonNull UniConstraintStream<B> otherStream, @NonNull BiJoiner<A, B>... joiners) Description copied from interface:UniConstraintStreamAs defined byUniConstraintStream.join(UniConstraintStream, BiJoiner). If multipleBiJoiners 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
SafeVarargsannotation because it's an interface method. Therefore, there are overloaded methods with up to 4BiJoinerparameters.- Specified by:
joinin interfaceUniConstraintStream<Solution_>- Type Parameters:
B- the type of the second matched fact- Returns:
- a stream that matches every combination of A and B for which all the
joinersare true
-
join
public final <B> BiConstraintStream<A,B> join(UniConstraintStream<B> otherStream, BiJoinerComber<A, B> joinerComber) Description copied from interface:InnerUniConstraintStreamAllowsConstraintFactory.forEachUniquePair(Class)to reuse the joiner combing logic.- Specified by:
joinin interfaceInnerUniConstraintStream<Solution_>- Parameters:
otherStream- never nulljoinerComber- never null- Returns:
- never null
-
ifExists
@SafeVarargs public final <B> @NonNull UniConstraintStream<A> ifExists(@NonNull UniConstraintStream<B> otherStream, @NonNull BiJoiner<A, B>... joiners) Description copied from interface:UniConstraintStreamAs defined byUniConstraintStream.ifExists(UniConstraintStream, 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
SafeVarargsannotation because it's an interface method. Therefore, there are overloaded methods with up to 4BiJoinerparameters.- Specified by:
ifExistsin interfaceUniConstraintStream<Solution_>- Type Parameters:
B- the type of the second matched fact- Returns:
- a stream that matches every A where B exists for which all the
BiJoiners are true
-
ifNotExists
@SafeVarargs public final <B> @NonNull UniConstraintStream<A> ifNotExists(@NonNull UniConstraintStream<B> otherStream, @NonNull BiJoiner<A, B>... joiners) Description copied from interface:UniConstraintStreamAs defined byUniConstraintStream.ifNotExists(UniConstraintStream, 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
SafeVarargsannotation because it's an interface method. Therefore, there are overloaded methods with up to 4BiJoinerparameters.- Specified by:
ifNotExistsin interfaceUniConstraintStream<Solution_>- Type Parameters:
B- the type of the second matched fact- Parameters:
otherStream- never nulljoiners- never null- Returns:
- never null, a stream that matches every A where B does not exist for which all the
BiJoiners are true
-
groupBy
public <ResultContainer_,Result_> @NonNull UniConstraintStream<Result_> groupBy(@NonNull UniConstraintCollector<A, ResultContainer_, Result_> collector) Description copied from interface:UniConstraintStreamConvert theUniConstraintStreamto a differentUniConstraintStream, containing only a single tuple, the result of applyingUniConstraintCollector.- Specified by:
groupByin interfaceUniConstraintStream<Solution_>- 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- the collector to perform the grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.
-
groupBy
public <ResultContainerA_,ResultA_, @NonNull BiConstraintStream<ResultA_,ResultContainerB_, ResultB_> ResultB_> groupBy(@NonNull UniConstraintCollector<A, ResultContainerA_, ResultA_> collectorA, @NonNull UniConstraintCollector<A, ResultContainerB_, ResultB_> collectorB) Description copied from interface:UniConstraintStreamConvert theUniConstraintStreamto aBiConstraintStream, containing only a single tuple, the result of applying twoUniConstraintCollectors.- Specified by:
groupByin interfaceUniConstraintStream<Solution_>- 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- the collector to perform the first grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.collectorB- the collector to perform the second grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.
-
groupBy
public <ResultContainerA_,ResultA_, @NonNull TriConstraintStream<ResultA_,ResultContainerB_, ResultB_, ResultContainerC_, ResultC_> ResultB_, groupByResultC_> (@NonNull UniConstraintCollector<A, ResultContainerA_, ResultA_> collectorA, @NonNull UniConstraintCollector<A, ResultContainerB_, ResultB_> collectorB, @NonNull UniConstraintCollector<A, ResultContainerC_, ResultC_> collectorC) Description copied from interface:UniConstraintStreamConvert theUniConstraintStreamto aTriConstraintStream, containing only a single tuple, the result of applying threeUniConstraintCollectors.- Specified by:
groupByin interfaceUniConstraintStream<Solution_>- 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- the collector to perform the first grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.collectorB- the collector to perform the second grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.collectorC- the collector to perform the third grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.
-
groupBy
public <ResultContainerA_,ResultA_, @NonNull QuadConstraintStream<ResultA_,ResultContainerB_, ResultB_, ResultContainerC_, ResultC_, ResultContainerD_, ResultD_> ResultB_, groupByResultC_, ResultD_> (@NonNull UniConstraintCollector<A, ResultContainerA_, ResultA_> collectorA, @NonNull UniConstraintCollector<A, ResultContainerB_, ResultB_> collectorB, @NonNull UniConstraintCollector<A, ResultContainerC_, ResultC_> collectorC, @NonNull UniConstraintCollector<A, ResultContainerD_, ResultD_> collectorD) Description copied from interface:UniConstraintStreamConvert theUniConstraintStreamto aQuadConstraintStream, containing only a single tuple, the result of applying fourUniConstraintCollectors.- Specified by:
groupByin interfaceUniConstraintStream<Solution_>- 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- the collector to perform the first grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.collectorB- the collector to perform the second grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.collectorC- the collector to perform the third grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.collectorD- the collector to perform the fourth grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.
-
groupBy
public <GroupKey_> @NonNull UniConstraintStream<GroupKey_> groupBy(@NonNull Function<A, GroupKey_> groupKeyMapping) Description copied from interface:UniConstraintStreamConvert theUniConstraintStreamto 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.- Specified by:
groupByin interfaceUniConstraintStream<Solution_>- Type Parameters:
GroupKey_- the type of a fact in the destinationUniConstraintStream's tuple; must honorthe general contract of hashCode.- Parameters:
groupKeyMapping- mapping function to convert each element in the stream to a different element
-
groupBy
public <GroupKey_,ResultContainerB_, @NonNull TriConstraintStream<GroupKey_,ResultB_, ResultContainerC_, ResultC_> ResultB_, groupByResultC_> (@NonNull Function<A, GroupKey_> groupKeyMapping, @NonNull UniConstraintCollector<A, ResultContainerB_, ResultB_> collectorB, @NonNull UniConstraintCollector<A, ResultContainerC_, ResultC_> collectorC) Description copied from interface:UniConstraintStreamConvert theUniConstraintStreamto 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
UniConstraintCollectorapplied on all incoming tuples with the same first fact.- Specified by:
groupByin interfaceUniConstraintStream<Solution_>- Type Parameters:
GroupKey_- the type of the first fact in the destinationTriConstraintStream's tuple; must honorthe general contract of hashCode.ResultContainerB_- 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- function to convert the fact in the original tuple to a different factcollectorB- the collector to perform the first grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.collectorC- the collector to perform the second grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.
-
groupBy
public <GroupKey_,ResultContainerB_, @NonNull QuadConstraintStream<GroupKey_,ResultB_, ResultContainerC_, ResultC_, ResultContainerD_, ResultD_> ResultB_, groupByResultC_, ResultD_> (@NonNull Function<A, GroupKey_> groupKeyMapping, @NonNull UniConstraintCollector<A, ResultContainerB_, ResultB_> collectorB, @NonNull UniConstraintCollector<A, ResultContainerC_, ResultC_> collectorC, @NonNull UniConstraintCollector<A, ResultContainerD_, ResultD_> collectorD) Description copied from interface:UniConstraintStreamConvert theUniConstraintStreamto 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
UniConstraintCollectorapplied on all incoming tuples with the same first fact.- Specified by:
groupByin interfaceUniConstraintStream<Solution_>- Type Parameters:
GroupKey_- the type of the first fact in the destinationQuadConstraintStream's tuple; must honorthe general contract of hashCode.ResultContainerB_- 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- function to convert the fact in the original tuple to a different factcollectorB- the collector to perform the first grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.collectorC- the collector to perform the second grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.collectorD- the collector to perform the third grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.
-
groupBy
public <GroupKey_,ResultContainer_, @NonNull BiConstraintStream<GroupKey_,Result_> Result_> groupBy(@NonNull Function<A, GroupKey_> groupKeyMapping, @NonNull UniConstraintCollector<A, ResultContainer_, Result_> collector) Description copied from interface:UniConstraintStreamConvert theUniConstraintStreamto 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
UniConstraintCollectorapplied on all incoming tuples with the same first fact.- Specified by:
groupByin interfaceUniConstraintStream<Solution_>- Type Parameters:
GroupKey_- the type of the first fact in the destinationBiConstraintStream's tuple; must honorthe general contract of hashCode.ResultContainer_- the mutable accumulation type (often hidden as an implementation detail)Result_- the type of the second fact in the destinationBiConstraintStream's tuple- Parameters:
groupKeyMapping- function to convert the fact in the original tuple to a different factcollector- the collector to perform the grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.
-
groupBy
public <GroupKeyA_,GroupKeyB_> @NonNull BiConstraintStream<GroupKeyA_,GroupKeyB_> groupBy(@NonNull Function<A, GroupKeyA_> groupKeyAMapping, @NonNull Function<A, GroupKeyB_> groupKeyBMapping) Description copied from interface:UniConstraintStreamConvert theUniConstraintStreamto 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.
- Specified by:
groupByin interfaceUniConstraintStream<Solution_>- Type Parameters:
GroupKeyA_- the type of the first fact in the destinationBiConstraintStream's tuple; must honorthe general contract of hashCode.GroupKeyB_- the type of the second fact in the destinationBiConstraintStream's tuple; must honorthe general contract of hashCode.- Parameters:
groupKeyAMapping- function to convert the original tuple into a first factgroupKeyBMapping- function to convert the original tuple into a second fact
-
groupBy
public <GroupKeyA_,GroupKeyB_, @NonNull TriConstraintStream<GroupKeyA_,ResultContainer_, Result_> GroupKeyB_, groupByResult_> (@NonNull Function<A, GroupKeyA_> groupKeyAMapping, @NonNull Function<A, GroupKeyB_> groupKeyBMapping, @NonNull UniConstraintCollector<A, ResultContainer_, Result_> collector) Description copied from interface:UniConstraintStreamCombines the semantics ofUniConstraintStream.groupBy(Function, Function)andUniConstraintStream.groupBy(UniConstraintCollector). That is, the first and second facts in the tuple follow theUniConstraintStream.groupBy(Function, Function)semantics, and the third fact is the result of applyingUniConstraintCollector.finisher()on all the tuples of the originalUniConstraintStreamthat belong to the group.- Specified by:
groupByin interfaceUniConstraintStream<Solution_>- Type Parameters:
GroupKeyA_- the type of the first fact in the destinationTriConstraintStream's tuple; must honorthe general contract of hashCode.GroupKeyB_- the type of the second fact in the destinationTriConstraintStream's tuple; must honorthe general contract of hashCode.ResultContainer_- the mutable accumulation type (often hidden as an implementation detail)Result_- the type of the third fact in the destinationTriConstraintStream's tuple- Parameters:
groupKeyAMapping- function to convert the original tuple into a first factgroupKeyBMapping- function to convert the original tuple into a second factcollector- the collector to perform the grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.
-
groupBy
public <GroupKeyA_,GroupKeyB_, @NonNull QuadConstraintStream<GroupKeyA_,ResultContainerC_, ResultC_, ResultContainerD_, ResultD_> GroupKeyB_, groupByResultC_, ResultD_> (@NonNull Function<A, GroupKeyA_> groupKeyAMapping, @NonNull Function<A, GroupKeyB_> groupKeyBMapping, @NonNull UniConstraintCollector<A, ResultContainerC_, ResultC_> collectorC, @NonNull UniConstraintCollector<A, ResultContainerD_, ResultD_> collectorD) Description copied from interface:UniConstraintStreamCombines the semantics ofUniConstraintStream.groupBy(Function, Function)andUniConstraintStream.groupBy(UniConstraintCollector). That is, the first and second facts in the tuple follow theUniConstraintStream.groupBy(Function, Function)semantics. The third fact is the result of applying the firstUniConstraintCollector.finisher()on all the tuples of the originalUniConstraintStreamthat belong to the group. The fourth fact is the result of applying the secondUniConstraintCollector.finisher()on all the tuples of the originalUniConstraintStreamthat belong to the group- Specified by:
groupByin interfaceUniConstraintStream<Solution_>- Type Parameters:
GroupKeyA_- the type of the first fact in the destinationQuadConstraintStream's tuple; must honorthe general contract of hashCode.GroupKeyB_- the type of the second fact in the destinationQuadConstraintStream's tuple; must honorthe general contract of hashCode.ResultContainerC_- 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- function to convert the original tuple into a first factgroupKeyBMapping- function to convert the original tuple into a second factcollectorC- the collector to perform the first grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.collectorD- the collector to perform the second grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.
-
groupBy
public <GroupKeyA_,GroupKeyB_, @NonNull TriConstraintStream<GroupKeyA_,GroupKeyC_> GroupKeyB_, groupByGroupKeyC_> (@NonNull Function<A, GroupKeyA_> groupKeyAMapping, @NonNull Function<A, GroupKeyB_> groupKeyBMapping, @NonNull Function<A, GroupKeyC_> groupKeyCMapping) Description copied from interface:UniConstraintStreamConvert theUniConstraintStreamto 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.
- Specified by:
groupByin interfaceUniConstraintStream<Solution_>- Type Parameters:
GroupKeyA_- the type of the first fact in the destinationTriConstraintStream's tuple; must honorthe general contract of hashCode.GroupKeyB_- the type of the second fact in the destinationTriConstraintStream's tuple; must honorthe general contract of hashCode.GroupKeyC_- the type of the third fact in the destinationTriConstraintStream's tuple; must honorthe general contract of hashCode.- Parameters:
groupKeyAMapping- function to convert the original tuple into a first factgroupKeyBMapping- function to convert the original tuple into a second factgroupKeyCMapping- function to convert the original tuple into a third fact
-
groupBy
public <GroupKeyA_,GroupKeyB_, @NonNull QuadConstraintStream<GroupKeyA_,GroupKeyC_, ResultContainerD_, ResultD_> GroupKeyB_, groupByGroupKeyC_, ResultD_> (@NonNull Function<A, GroupKeyA_> groupKeyAMapping, @NonNull Function<A, GroupKeyB_> groupKeyBMapping, @NonNull Function<A, GroupKeyC_> groupKeyCMapping, @NonNull UniConstraintCollector<A, ResultContainerD_, ResultD_> collectorD) Description copied from interface:UniConstraintStreamCombines the semantics ofUniConstraintStream.groupBy(Function, Function)andUniConstraintStream.groupBy(UniConstraintCollector). That is, the first three facts in the tuple follow theUniConstraintStream.groupBy(Function, Function)semantics. The final fact is the result of applying the firstUniConstraintCollector.finisher()on all the tuples of the originalUniConstraintStreamthat belong to the group.- Specified by:
groupByin interfaceUniConstraintStream<Solution_>- Type Parameters:
GroupKeyA_- the type of the first fact in the destinationQuadConstraintStream's tuple; must honorthe general contract of hashCode.GroupKeyB_- the type of the second fact in the destinationQuadConstraintStream's tuple; must honorthe general contract of hashCode.GroupKeyC_- the type of the third fact in the destinationQuadConstraintStream's tuple; must honorthe general contract of hashCode.ResultContainerD_- the mutable accumulation type (often hidden as an implementation detail)ResultD_- the type of the fourth fact in the destinationQuadConstraintStream's tuple- Parameters:
groupKeyAMapping- function to convert the original tuple into a first factgroupKeyBMapping- function to convert the original tuple into a second factgroupKeyCMapping- function to convert the original tuple into a third factcollectorD- the collector to perform the grouping operation with SeeConstraintCollectorsfor common operations, such ascount(),sum()and others.
-
groupBy
public <GroupKeyA_,GroupKeyB_, @NonNull QuadConstraintStream<GroupKeyA_,GroupKeyC_, GroupKeyD_> GroupKeyB_, groupByGroupKeyC_, GroupKeyD_> (@NonNull Function<A, GroupKeyA_> groupKeyAMapping, @NonNull Function<A, GroupKeyB_> groupKeyBMapping, @NonNull Function<A, GroupKeyC_> groupKeyCMapping, @NonNull Function<A, GroupKeyD_> groupKeyDMapping) Description copied from interface:UniConstraintStreamConvert theUniConstraintStreamto 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.
- Specified by:
groupByin interfaceUniConstraintStream<Solution_>- Type Parameters:
GroupKeyA_- the type of the first fact in the destinationQuadConstraintStream's tuple; must honorthe general contract of hashCode.GroupKeyB_- the type of the second fact in the destinationQuadConstraintStream's tuple; must honorthe general contract of hashCode.GroupKeyC_- the type of the third fact in the destinationQuadConstraintStream's tuple; must honorthe general contract of hashCode.GroupKeyD_- the type of the fourth fact in the destinationQuadConstraintStream's tuple; must honorthe general contract of hashCode.- Parameters:
groupKeyAMapping- * callingmap(Person::getAge)on such stream will produce a stream ofIntegers *[20, 25, 30],groupKeyBMapping- function to convert the original tuple into a second factgroupKeyCMapping- function to convert the original tuple into a third factgroupKeyDMapping- function to convert the original tuple into a fourth fact
-
distinct
Description copied from interface:UniConstraintStreamTransforms 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
UniConstraintStream.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.- Specified by:
distinctin interfaceInnerUniConstraintStream<Solution_>- Specified by:
distinctin interfaceUniConstraintStream<Solution_>
-
concat
Description copied from interface:UniConstraintStreamReturns a newUniConstraintStreamcontaining all the tuples of both thisUniConstraintStreamand the providedUniConstraintStream. Tuples in both thisUniConstraintStreamand the providedUniConstraintStreamwill appear at least twice.For instance, if this stream consists of
[A, B, C]and the other stream consists of[C, D, E],this.concat(other)will consist of[A, B, C, C, D, E]. This operation can be thought of as an or between streams.- Specified by:
concatin interfaceUniConstraintStream<Solution_>
-
concat
public <B> @NonNull BiConstraintStream<A,B> concat(@NonNull BiConstraintStream<A, B> otherStream, @NonNull Function<A, B> paddingFunction) Description copied from interface:UniConstraintStreamReturns a newBiConstraintStreamcontaining all the tuples of both thisUniConstraintStreamand the providedBiConstraintStream. TheUniConstraintStreamtuples will be padded from the right by the result of the padding function.For instance, if this stream consists of
[A, B, C]and the other stream consists of[(C1, C2), (D1, D2), (E1, E2)],this.concat(other, a -> null)will consist of[(A, null), (B, null), (C, null), (C1, C2), (D1, D2), (E1, E2)].This operation can be thought of as an or between streams.
- Specified by:
concatin interfaceUniConstraintStream<Solution_>paddingFunction- function to find the padding for the second fact
-
concat
public <B,C> @NonNull TriConstraintStream<A,B, concatC> (@NonNull TriConstraintStream<A, B, C> otherStream, @NonNull Function<A, B> paddingFunctionB, @NonNull Function<A, C> paddingFunctionC) Description copied from interface:UniConstraintStreamReturns a newTriConstraintStreamcontaining all the tuples of both thisUniConstraintStreamand the providedTriConstraintStream. TheUniConstraintStreamtuples will be padded from the right by the result of the padding functions.For instance, if this stream consists of
[A, B, C]and the other stream consists of[(C1, C2, C3), (D1, D2, D3), (E1, E2, E3)],this.concat(other, a -> null, a -> null)will consist of[(A, null), (B, null), (C, null), (C1, C2, C3), (D1, D2, D3), (E1, E2, E3)].This operation can be thought of as an or between streams.
- Specified by:
concatin interfaceUniConstraintStream<Solution_>paddingFunctionB- function to find the padding for the second factpaddingFunctionC- function to find the padding for the third fact
-
concat
public <B,C, @NonNull QuadConstraintStream<A,D> B, concatC, D> (@NonNull QuadConstraintStream<A, B, C, D> otherStream, @NonNull Function<A, B> paddingFunctionB, @NonNull Function<A, C> paddingFunctionC, @NonNull Function<A, D> paddingFunctionD) Description copied from interface:UniConstraintStreamReturns a newQuadConstraintStreamcontaining all the tuples of both thisUniConstraintStreamand the providedQuadConstraintStream. TheUniConstraintStreamtuples will be padded from the right by the result of the padding functions.For instance, if this stream consists of
[A, B, C]and the other stream consists of[(C1, C2, C3, C4), (D1, D2, D3, D4), (E1, E2, E3, E4)],this.concat(other, a -> null, a -> null, a -> null)will consist of[(A, null), (B, null), (C, null), (C1, C2, C3, C4), (D1, D2, D3, D4), (E1, E2, E3, E4)].This operation can be thought of as an or between streams.
- Specified by:
concatin interfaceUniConstraintStream<Solution_>paddingFunctionB- function to find the padding for the second factpaddingFunctionC- function to find the padding for the third factpaddingFunctionD- function to find the padding for the fourth fact
-
map
Description copied from interface:UniConstraintStreamTransforms the stream in such a way that tuples are remapped using the given function. This may produce a stream with duplicate tuples. SeeUniConstraintStream.distinct()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 useUniConstraintStream.distinct()later, which comes at 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 likewiseequaland 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
Persons[Ann(age = 20), Beth(age = 25), Cathy(age = 30)], callingmap(Person::getAge)on such stream will produce a stream ofIntegers[20, 25, 30],Example with a non-bijective mapping function: assuming a constraint stream of tuples of
Persons[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 ofIntegers[20, 25, 30, 30, 20].Use with caution, as the increased memory allocation rates coming from tuple creation may negatively affect performance.
- Specified by:
mapin interfaceUniConstraintStream<Solution_>- Type Parameters:
ResultA_- the type of the only fact in the resultingUniConstraintStream's tuple- Parameters:
mapping- function to convert the original tuple into the new tuple
-
map
public <ResultA_,ResultB_> @NonNull BiConstraintStream<ResultA_,ResultB_> map(@NonNull Function<A, ResultA_> mappingA, @NonNull Function<A, ResultB_> mappingB) Description copied from interface:UniConstraintStreamAs defined byUniConstraintStream.map(Function), only resulting inBiConstraintStream.- Specified by:
mapin interfaceUniConstraintStream<Solution_>- Type Parameters:
ResultA_- the type of the first fact in the resultingBiConstraintStream's tupleResultB_- the type of the first fact in the resultingBiConstraintStream's tuple- Parameters:
mappingA- function to convert the original tuple into the first fact of a new tuplemappingB- function to convert the original tuple into the second fact of a new tuple
-
map
public <ResultA_,ResultB_, @NonNull TriConstraintStream<ResultA_,ResultC_> ResultB_, mapResultC_> (@NonNull Function<A, ResultA_> mappingA, @NonNull Function<A, ResultB_> mappingB, @NonNull Function<A, ResultC_> mappingC) Description copied from interface:UniConstraintStreamAs defined byUniConstraintStream.map(Function), only resulting inTriConstraintStream.- Specified by:
mapin interfaceUniConstraintStream<Solution_>- Type Parameters:
ResultA_- the type of the first fact in the resultingTriConstraintStream's tupleResultB_- the type of the first fact in the resultingTriConstraintStream's tupleResultC_- the type of the third fact in the resultingTriConstraintStream's tuple- Parameters:
mappingA- function to convert the original tuple into the first fact of a new tuplemappingB- function to convert the original tuple into the second fact of a new tuplemappingC- function to convert the original tuple into the third fact of a new tuple
-
map
public <ResultA_,ResultB_, @NonNull QuadConstraintStream<ResultA_,ResultC_, ResultD_> ResultB_, mapResultC_, ResultD_> (@NonNull Function<A, ResultA_> mappingA, @NonNull Function<A, ResultB_> mappingB, @NonNull Function<A, ResultC_> mappingC, @NonNull Function<A, ResultD_> mappingD) Description copied from interface:UniConstraintStreamAs defined byUniConstraintStream.map(Function), only resulting inQuadConstraintStream.- Specified by:
mapin interfaceUniConstraintStream<Solution_>- Type Parameters:
ResultA_- the type of the first fact in the resultingQuadConstraintStream's tupleResultB_- the type of the first fact in the resultingQuadConstraintStream's tupleResultC_- the type of the third fact in the resultingQuadConstraintStream's tupleResultD_- the type of the third fact in the resultingQuadConstraintStream's tuple- Parameters:
mappingA- function to convert the original tuple into the first fact of a new tuplemappingB- function to convert the original tuple into the second fact of a new tuplemappingC- function to convert the original tuple into the third fact of a new tuplemappingD- function to convert the original tuple into the fourth fact of a new tuple
-
flattenLast
public <ResultA_> @NonNull UniConstraintStream<ResultA_> flattenLast(@NonNull Function<A, Iterable<ResultA_>> mapping) Description copied from interface:UniConstraintStreamTakes 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. SeeUniConstraintStream.distinct()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
Persons[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].- Specified by:
flattenLastin interfaceUniConstraintStream<Solution_>- Type Parameters:
ResultA_- the type of facts in the resulting tuples. It is recommended that this type be deeply immutable. Not following this recommendation may lead to hard-to-debug hashing issues down the stream, especially if this value is ever used as a group key.- Parameters:
mapping- function to convert the original tuple intoIterable. For performance, returning an implementation ofCollectionis preferred.
-
expand
public <ResultB_> @NonNull BiConstraintStream<A,ResultB_> expand(@NonNull Function<A, ResultB_> mapping) Description copied from interface:UniConstraintStreamAdds a fact to the end of the tuple, increasing the cardinality of the stream. Useful for storing results of expensive computations on the original tuple.Use with caution, as the benefits of caching computation may be outweighed by increased memory allocation rates coming from tuple creation. If more than one fact is to be added, prefer
UniConstraintStream.expand(Function, Function)orUniConstraintStream.expand(Function, Function, Function).- Specified by:
expandin interfaceUniConstraintStream<Solution_>- Type Parameters:
ResultB_- type of the final fact of the new tuple- Parameters:
mapping- function to produce the new fact from the original tuple
-
expand
public <ResultB_,ResultC_> @NonNull TriConstraintStream<A,ResultB_, expandResultC_> (@NonNull Function<A, ResultB_> mappingB, @NonNull Function<A, ResultC_> mappingC) Description copied from interface:UniConstraintStreamAdds two facts to the end of the tuple, increasing the cardinality of the stream. Useful for storing results of expensive computations on the original tuple.Use with caution, as the benefits of caching computation may be outweighed by increased memory allocation rates coming from tuple creation. If more than two facts are to be added, prefer
UniConstraintStream.expand(Function, Function, Function).- Specified by:
expandin interfaceUniConstraintStream<Solution_>- Type Parameters:
ResultB_- type of the second fact of the new tupleResultC_- type of the third fact of the new tuple- Parameters:
mappingB- function to produce the new second fact from the original tuplemappingC- function to produce the new third fact from the original tuple
-
expand
public <ResultB_,ResultC_, @NonNull QuadConstraintStream<A,ResultD_> ResultB_, expandResultC_, ResultD_> (@NonNull Function<A, ResultB_> mappingB, @NonNull Function<A, ResultC_> mappingC, @NonNull Function<A, ResultD_> mappingD) Description copied from interface:UniConstraintStreamAdds three facts to the end of the tuple, increasing the cardinality of the stream. Useful for storing results of expensive computations on the original tuple.Use with caution, as the benefits of caching computation may be outweighed by increased memory allocation rates coming from tuple creation.
- Specified by:
expandin interfaceUniConstraintStream<Solution_>- Type Parameters:
ResultB_- type of the second fact of the new tupleResultC_- type of the third fact of the new tupleResultD_- type of the final fact of the new tuple- Parameters:
mappingB- function to produce the new second fact from the original tuplemappingC- function to produce the new third fact from the original tuplemappingD- function to produce the new final fact from the original tuple
-
innerImpact
public <Score_ extends Score<Score_>> UniConstraintBuilder<A,Score_> innerImpact(Score_ constraintWeight, ToIntFunction<A> matchWeigher, ScoreImpactType scoreImpactType) - Specified by:
innerImpactin interfaceInnerUniConstraintStream<Solution_>
-
innerImpact
public <Score_ extends Score<Score_>> UniConstraintBuilder<A,Score_> innerImpact(Score_ constraintWeight, ToLongFunction<A> matchWeigher, ScoreImpactType scoreImpactType) - Specified by:
innerImpactin interfaceInnerUniConstraintStream<Solution_>
-
innerImpact
public <Score_ extends Score<Score_>> UniConstraintBuilder<A,Score_> innerImpact(Score_ constraintWeight, Function<A, BigDecimal> matchWeigher, ScoreImpactType scoreImpactType) - Specified by:
innerImpactin interfaceInnerUniConstraintStream<Solution_>
-
getDefaultJustificationMapping
protected final BiFunction<A,Score<?>, getDefaultJustificationMapping()DefaultConstraintJustification> - Specified by:
getDefaultJustificationMappingin classAbstractConstraintStream<Solution_>
-
getDefaultIndictedObjectsMapping
- Specified by:
getDefaultIndictedObjectsMappingin classAbstractConstraintStream<Solution_>
-