org.optaplanner.core.impl.score.stream.uni

## 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 and 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 and 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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 interface `UniConstraintCollector<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 interface `UniConstraintCollector<A,ResultContainer_,Result_>`
      Returns:
        never null, the undo operation. This lamdba 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 interface `UniConstraintCollector<A,ResultContainer_,Result_>`
      Returns:
        null when the result would be invalid, such as maximum value from an empty container.

Copyright © 2006–2021 JBoss by Red Hat. All rights reserved.