Interface TriConstraintCollector<A,​B,​C,​ResultContainer_,​Result_>

  • Type Parameters:
    A - the type of the first fact of the tuple in the source TriConstraintStream
    B - the type of the second fact of the tuple in the source TriConstraintStream
    ResultContainer_ - the mutable accumulation type (often hidden as an implementation detail)
    Result_ - the type of the fact of the tuple in the destination ConstraintStream 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.

    public interface TriConstraintCollector<A,​B,​C,​ResultContainer_,​Result_>
    Usually created with ConstraintCollectors. Used by TriConstraintStream.groupBy(TriFunction, TriConstraintCollector), ...

    Loosely based on JDK's Collector, but it returns an undo operation for each accumulation to enable incremental score calculation in constraint streams.

    See Also:
    ConstraintCollectors
    • Method Detail

      • supplier

        Supplier<ResultContainer_> supplier()
        A lambda that creates the result container, one for each group key combination.
        Returns:
        never null
      • accumulator

        QuadFunction<ResultContainer_,​A,​B,​C,​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.