Class DefaultUniConstraintCollector<A,ResultContainer_,Result_>
- java.lang.Object
-
- org.optaplanner.core.impl.score.stream.uni.DefaultUniConstraintCollector<A,ResultContainer_,Result_>
-
- All Implemented Interfaces:
UniConstraintCollector<A,ResultContainer_,Result_>
public final class DefaultUniConstraintCollector<A,ResultContainer_,Result_> extends Object implements UniConstraintCollector<A,ResultContainer_,Result_>
-
-
Constructor Summary
Constructors Constructor Description DefaultUniConstraintCollector(Supplier<ResultContainer_> supplier, BiFunction<ResultContainer_,A,Runnable> accumulator, Function<ResultContainer_,Result_> finisher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BiFunction<ResultContainer_,A,Runnable>
accumulator()
A lambda that extracts data from the matched fact, 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.
-
-
-
Constructor Detail
-
DefaultUniConstraintCollector
public DefaultUniConstraintCollector(Supplier<ResultContainer_> supplier, BiFunction<ResultContainer_,A,Runnable> accumulator, Function<ResultContainer_,Result_> finisher)
-
-
Method Detail
-
supplier
public Supplier<ResultContainer_> supplier()
Description copied from interface:UniConstraintCollector
A lambda that creates the result container, one for each group key combination.- Specified by:
supplier
in interfaceUniConstraintCollector<A,ResultContainer_,Result_>
- Returns:
- never null
-
accumulator
public BiFunction<ResultContainer_,A,Runnable> accumulator()
Description copied from interface:UniConstraintCollector
A lambda that extracts data from the matched fact, accumulates it in the result container and returns an undo operation for that accumulation.- Specified by:
accumulator
in interfaceUniConstraintCollector<A,ResultContainer_,Result_>
- Returns:
- never null, the undo operation. This lambda is called when the fact no longer matches.
-
finisher
public Function<ResultContainer_,Result_> finisher()
Description copied from interface:UniConstraintCollector
A lambda that converts the result container into the result.- Specified by:
finisher
in interfaceUniConstraintCollector<A,ResultContainer_,Result_>
- Returns:
- null when the result would be invalid, such as maximum value from an empty container.
-
-