Interface BiConstraintCollector<A,B,ResultContainer_,Result_>
-
- Type Parameters:
A
- the type of the first fact of the tuple in the sourceBiConstraintStream
B
- the type of the second fact of the tuple in the sourceBiConstraintStream
ResultContainer_
- the mutable accumulation type (often hidden as an implementation detail)Result_
- the type of the fact of the tuple in the destinationConstraintStream
- All Known Implementing Classes:
DefaultBiConstraintCollector
public interface BiConstraintCollector<A,B,ResultContainer_,Result_>
Usually created withConstraintCollectors
. Used byBiConstraintStream.groupBy(BiFunction, BiConstraintCollector)
, ...Loosely based on JDK's
Collector
, but it returns an undo operation for each accumulation to enable incremental score calculation inconstraint streams
.- See Also:
ConstraintCollectors
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TriFunction<ResultContainer_,A,B,Runnable>
accumulator()
A lambda that extracts data from the matched facts, accumulates it in the result container and returns an undo operation for that accumulation.Function<ResultContainer_,Result_>
finisher()
A lambda that converts the result container into the result.Supplier<ResultContainer_>
supplier()
A lambda that creates the result container, one for each group key combination.
-
-
-
Method Detail
-
supplier
Supplier<ResultContainer_> supplier()
A lambda that creates the result container, one for each group key combination.- Returns:
- never null
-
accumulator
TriFunction<ResultContainer_,A,B,Runnable> accumulator()
A lambda that extracts data from the matched facts, accumulates it in the result container and returns an undo operation for that accumulation.- Returns:
- never null, the undo operation. This lambda is called when the facts no longer matches.
-
finisher
Function<ResultContainer_,Result_> finisher()
A lambda that converts the result container into the result.- Returns:
- never null
-
-