Interface BiConstraintStream<A,​B>

    • Method Detail

      • join

        <C> TriConstraintStream<A,​B,​C> join​(UniConstraintStream<C> otherStream,
                                                        TriJoiner<A,​B,​C> joiner)
        Create a new TriConstraintStream for every combination of [A, B] and C for which the TriJoiner is true (for the properties it extracts from both facts).

        Important: This is faster and more scalable than a join followed by a filter, because it applies hashing and/or indexing on the properties, so it doesn't create nor checks every combination of [A, B] and C.

        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherStream - never null
        joiner - never null
        Returns:
        never null, a stream that matches every combination of [A, B] and C for which the TriFunction is true
      • join

        default <C> TriConstraintStream<A,​B,​C> join​(UniConstraintStream<C> otherStream,
                                                                TriJoiner<A,​B,​C> joiner1,
                                                                TriJoiner<A,​B,​C> joiner2)
        As defined by join(Class, TriJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.
        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherStream - never null
        joiner1 - never null
        joiner2 - never null
        Returns:
        never null, a stream that matches every combination of [A, B] and C for which all the joiners are true
      • join

        default <C> TriConstraintStream<A,​B,​C> join​(UniConstraintStream<C> otherStream,
                                                                TriJoiner<A,​B,​C> joiner1,
                                                                TriJoiner<A,​B,​C> joiner2,
                                                                TriJoiner<A,​B,​C> joiner3)
        As defined by join(Class, TriJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.
        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherStream - never null
        joiner1 - never null
        joiner2 - never null
        joiner3 - never null
        Returns:
        never null, a stream that matches every combination of [A, B] and C for which all the joiners are true
      • join

        default <C> TriConstraintStream<A,​B,​C> join​(UniConstraintStream<C> otherStream,
                                                                TriJoiner<A,​B,​C> joiner1,
                                                                TriJoiner<A,​B,​C> joiner2,
                                                                TriJoiner<A,​B,​C> joiner3,
                                                                TriJoiner<A,​B,​C> joiner4)
        As defined by join(Class, TriJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.
        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherStream - never null
        joiner1 - never null
        joiner2 - never null
        joiner3 - never null
        joiner4 - never null
        Returns:
        never null, a stream that matches every combination of [A, B] and C for which all the joiners are true
      • join

        default <C> TriConstraintStream<A,​B,​C> join​(UniConstraintStream<C> otherStream,
                                                                TriJoiner<A,​B,​C>... joiners)
        As defined by join(Class, TriJoiner). 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 SafeVarargs annotation because it's an interface method. Therefore, there are overloaded methods with up to 4 BiJoiner parameters.

        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherStream - never null
        joiners - never null
        Returns:
        never null, a stream that matches every combination of [A, B] and C for which all the joiners are true
      • join

        default <C> TriConstraintStream<A,​B,​C> join​(Class<C> otherClass,
                                                                TriJoiner<A,​B,​C> joiner1,
                                                                TriJoiner<A,​B,​C> joiner2)
        As defined by join(Class, TriJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.
        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiner1 - never null
        joiner2 - never null
        Returns:
        never null, a stream that matches every combination of [A, B] and C for which all the joiners are true
      • join

        default <C> TriConstraintStream<A,​B,​C> join​(Class<C> otherClass,
                                                                TriJoiner<A,​B,​C> joiner1,
                                                                TriJoiner<A,​B,​C> joiner2,
                                                                TriJoiner<A,​B,​C> joiner3)
        As defined by join(Class, TriJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.
        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiner1 - never null
        joiner2 - never null
        joiner3 - never null
        Returns:
        never null, a stream that matches every combination of [A, B] and C for which all the joiners are true
      • join

        default <C> TriConstraintStream<A,​B,​C> join​(Class<C> otherClass,
                                                                TriJoiner<A,​B,​C> joiner1,
                                                                TriJoiner<A,​B,​C> joiner2,
                                                                TriJoiner<A,​B,​C> joiner3,
                                                                TriJoiner<A,​B,​C> joiner4)
        As defined by join(Class, TriJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.
        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiner1 - never null
        joiner2 - never null
        joiner3 - never null
        joiner4 - never null
        Returns:
        never null, a stream that matches every combination of [A, B] and C for which all the joiners are true
      • join

        <C> TriConstraintStream<A,​B,​C> join​(Class<C> otherClass,
                                                        TriJoiner<A,​B,​C>... joiners)
        As defined by join(Class, TriJoiner). 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 SafeVarargs annotation because it's an interface method. Therefore, there are overloaded methods with up to 4 BiJoiner parameters.

        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiners - never null
        Returns:
        never null, a stream that matches every combination of [A, B] and C for which all the joiners are true
      • ifExists

        default <C> BiConstraintStream<A,​B> ifExists​(Class<C> otherClass,
                                                           TriJoiner<A,​B,​C> joiner1,
                                                           TriJoiner<A,​B,​C> joiner2)
        As defined by ifExists(Class, TriJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.
        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiner1 - never null
        joiner2 - never null
        Returns:
        never null, a stream that matches every pair of A and B where C exists for which the TriJoiners are true
      • ifExists

        default <C> BiConstraintStream<A,​B> ifExists​(Class<C> otherClass,
                                                           TriJoiner<A,​B,​C> joiner1,
                                                           TriJoiner<A,​B,​C> joiner2,
                                                           TriJoiner<A,​B,​C> joiner3)
        As defined by ifExists(Class, TriJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.
        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiner1 - never null
        joiner2 - never null
        joiner3 - never null
        Returns:
        never null, a stream that matches every pair of A and B where C exists for which the TriJoiners are true
      • ifExists

        default <C> BiConstraintStream<A,​B> ifExists​(Class<C> otherClass,
                                                           TriJoiner<A,​B,​C> joiner1,
                                                           TriJoiner<A,​B,​C> joiner2,
                                                           TriJoiner<A,​B,​C> joiner3,
                                                           TriJoiner<A,​B,​C> joiner4)
        As defined by ifExists(Class, TriJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.
        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiner1 - never null
        joiner2 - never null
        joiner3 - never null
        joiner4 - never null
        Returns:
        never null, a stream that matches every pair of A and B where C exists for which the TriJoiners are true
      • ifExists

        <C> BiConstraintStream<A,​B> ifExists​(Class<C> otherClass,
                                                   TriJoiner<A,​B,​C>... joiners)
        As defined by ifExists(Class, TriJoiner). 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 SafeVarargs annotation because it's an interface method. Therefore, there are overloaded methods with up to 4 TriJoiner parameters.

        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiners - never null
        Returns:
        never null, a stream that matches every pair of A and B where C exists for which the TriJoiners are true
      • ifExistsIncludingNullVars

        default <C> BiConstraintStream<A,​B> ifExistsIncludingNullVars​(Class<C> otherClass,
                                                                            TriJoiner<A,​B,​C> joiner)
        Create a new BiConstraintStream for every pair of A and B where C exists for which the TriJoiner is true (for the properties it extracts from the facts). For classes annotated with PlanningEntity, this method also includes instances with null variables.

        This method has overloaded methods with multiple TriJoiner parameters.

        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiner - never null
        Returns:
        never null, a stream that matches every pair of A and B where C exists for which the TriJoiner is true
      • ifExistsIncludingNullVars

        default <C> BiConstraintStream<A,​B> ifExistsIncludingNullVars​(Class<C> otherClass,
                                                                            TriJoiner<A,​B,​C> joiner1,
                                                                            TriJoiner<A,​B,​C> joiner2)
        As defined by ifExistsIncludingNullVars(Class, TriJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.
        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiner1 - never null
        joiner2 - never null
        Returns:
        never null, a stream that matches every pair of A and B where C exists for which the TriJoiners are true
      • ifExistsIncludingNullVars

        default <C> BiConstraintStream<A,​B> ifExistsIncludingNullVars​(Class<C> otherClass,
                                                                            TriJoiner<A,​B,​C> joiner1,
                                                                            TriJoiner<A,​B,​C> joiner2,
                                                                            TriJoiner<A,​B,​C> joiner3)
        As defined by ifExistsIncludingNullVars(Class, TriJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.
        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiner1 - never null
        joiner2 - never null
        joiner3 - never null
        Returns:
        never null, a stream that matches every pair of A and B where C exists for which the TriJoiners are true
      • ifExistsIncludingNullVars

        default <C> BiConstraintStream<A,​B> ifExistsIncludingNullVars​(Class<C> otherClass,
                                                                            TriJoiner<A,​B,​C> joiner1,
                                                                            TriJoiner<A,​B,​C> joiner2,
                                                                            TriJoiner<A,​B,​C> joiner3,
                                                                            TriJoiner<A,​B,​C> joiner4)
        As defined by ifExistsIncludingNullVars(Class, TriJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.
        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiner1 - never null
        joiner2 - never null
        joiner3 - never null
        joiner4 - never null
        Returns:
        never null, a stream that matches every pair of A and B where C exists for which the TriJoiners are true
      • ifExistsIncludingNullVars

        <C> BiConstraintStream<A,​B> ifExistsIncludingNullVars​(Class<C> otherClass,
                                                                    TriJoiner<A,​B,​C>... joiners)
        As defined by ifExistsIncludingNullVars(Class, TriJoiner). 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 SafeVarargs annotation because it's an interface method. Therefore, there are overloaded methods with up to 4 TriJoiner parameters.

        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiners - never null
        Returns:
        never null, a stream that matches every pair of A and B where C exists for which the TriJoiners are true
      • ifNotExists

        default <C> BiConstraintStream<A,​B> ifNotExists​(Class<C> otherClass,
                                                              TriJoiner<A,​B,​C> joiner1,
                                                              TriJoiner<A,​B,​C> joiner2)
        As defined by ifNotExists(Class, TriJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.
        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiner1 - never null
        joiner2 - never null
        Returns:
        never null, a stream that matches every pair of A and B where C does not exist for which the TriJoiners are true
      • ifNotExists

        default <C> BiConstraintStream<A,​B> ifNotExists​(Class<C> otherClass,
                                                              TriJoiner<A,​B,​C> joiner1,
                                                              TriJoiner<A,​B,​C> joiner2,
                                                              TriJoiner<A,​B,​C> joiner3)
        As defined by ifNotExists(Class, TriJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.
        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiner1 - never null
        joiner2 - never null
        joiner3 - never null
        Returns:
        never null, a stream that matches every pair of A and B where C does not exist for which the TriJoiners are true
      • ifNotExists

        default <C> BiConstraintStream<A,​B> ifNotExists​(Class<C> otherClass,
                                                              TriJoiner<A,​B,​C> joiner1,
                                                              TriJoiner<A,​B,​C> joiner2,
                                                              TriJoiner<A,​B,​C> joiner3,
                                                              TriJoiner<A,​B,​C> joiner4)
        As defined by ifNotExists(Class, TriJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.
        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiner1 - never null
        joiner2 - never null
        joiner3 - never null
        joiner4 - never null
        Returns:
        never null, a stream that matches every pair of A and B where C does not exist for which the TriJoiners are true
      • ifNotExists

        <C> BiConstraintStream<A,​B> ifNotExists​(Class<C> otherClass,
                                                      TriJoiner<A,​B,​C>... joiners)
        As defined by ifNotExists(Class, TriJoiner). 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 SafeVarargs annotation because it's an interface method. Therefore, there are overloaded methods with up to 4 TriJoiner parameters.

        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiners - never null
        Returns:
        never null, a stream that matches every pair of A and B where C does not exist for which the TriJoiners are true
      • ifNotExistsIncludingNullVars

        default <C> BiConstraintStream<A,​B> ifNotExistsIncludingNullVars​(Class<C> otherClass,
                                                                               TriJoiner<A,​B,​C> joiner)
        Create a new BiConstraintStream for every pair of A and B where C does not exist for which the TriJoiner is true (for the properties it extracts from the facts). For classes annotated with PlanningEntity, this method also includes instances with null variables.

        This method has overloaded methods with multiple TriJoiner parameters.

        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiner - never null
        Returns:
        never null, a stream that matches every pair of A and B where C does not exist for which the TriJoiner is true
      • ifNotExistsIncludingNullVars

        default <C> BiConstraintStream<A,​B> ifNotExistsIncludingNullVars​(Class<C> otherClass,
                                                                               TriJoiner<A,​B,​C> joiner1,
                                                                               TriJoiner<A,​B,​C> joiner2)
        As defined by ifNotExistsIncludingNullVars(Class, TriJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.
        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiner1 - never null
        joiner2 - never null
        Returns:
        never null, a stream that matches every pair of A and B where C does not exist for which the TriJoiners are true
      • ifNotExistsIncludingNullVars

        default <C> BiConstraintStream<A,​B> ifNotExistsIncludingNullVars​(Class<C> otherClass,
                                                                               TriJoiner<A,​B,​C> joiner1,
                                                                               TriJoiner<A,​B,​C> joiner2,
                                                                               TriJoiner<A,​B,​C> joiner3)
        As defined by ifNotExistsIncludingNullVars(Class, TriJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.
        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiner1 - never null
        joiner2 - never null
        joiner3 - never null
        Returns:
        never null, a stream that matches every pair of A and B where C does not exist for which the TriJoiners are true
      • ifNotExistsIncludingNullVars

        default <C> BiConstraintStream<A,​B> ifNotExistsIncludingNullVars​(Class<C> otherClass,
                                                                               TriJoiner<A,​B,​C> joiner1,
                                                                               TriJoiner<A,​B,​C> joiner2,
                                                                               TriJoiner<A,​B,​C> joiner3,
                                                                               TriJoiner<A,​B,​C> joiner4)
        As defined by ifNotExistsIncludingNullVars(Class, TriJoiner). For performance reasons, indexing joiners must be placed before filtering joiners.
        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiner1 - never null
        joiner2 - never null
        joiner3 - never null
        joiner4 - never null
        Returns:
        never null, a stream that matches every pair of A and B where C does not exist for which the TriJoiners are true
      • ifNotExistsIncludingNullVars

        <C> BiConstraintStream<A,​B> ifNotExistsIncludingNullVars​(Class<C> otherClass,
                                                                       TriJoiner<A,​B,​C>... joiners)
        As defined by ifNotExistsIncludingNullVars(Class, TriJoiner). 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 SafeVarargs annotation because it's an interface method. Therefore, there are overloaded methods with up to 4 TriJoiner parameters.

        Type Parameters:
        C - the type of the third matched fact
        Parameters:
        otherClass - never null
        joiners - never null
        Returns:
        never null, a stream that matches every pair of A and B where C does not exist for which the TriJoiners are true
      • groupBy

        <ResultContainer_,​Result_> UniConstraintStream<Result_> groupBy​(BiConstraintCollector<A,​B,​ResultContainer_,​Result_> collector)
        Runs all tuples of the stream through a given @BiConstraintCollector and converts them into a new UniConstraintStream which only has a single tuple, the result of applying BiConstraintCollector.
        Type Parameters:
        ResultContainer_ - the mutable accumulation type (often hidden as an implementation detail)
        Result_ - the type of a fact in the destination UniConstraintStream's tuple
        Parameters:
        collector - never null, the collector to perform the grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        Returns:
        never null
      • groupBy

        <ResultContainerA_,​ResultA_,​ResultContainerB_,​ResultB_> BiConstraintStream<ResultA_,​ResultB_> groupBy​(BiConstraintCollector<A,​B,​ResultContainerA_,​ResultA_> collectorA,
                                                                                                                                      BiConstraintCollector<A,​B,​ResultContainerB_,​ResultB_> collectorB)
        Convert the BiConstraintStream to a BiConstraintStream, containing only a single tuple, the result of applying two BiConstraintCollectors.
        Type Parameters:
        ResultContainerA_ - the mutable accumulation type (often hidden as an implementation detail)
        ResultA_ - the type of the first fact in the destination BiConstraintStream's tuple
        ResultContainerB_ - the mutable accumulation type (often hidden as an implementation detail)
        ResultB_ - the type of the second fact in the destination BiConstraintStream's tuple
        Parameters:
        collectorA - never null, the collector to perform the first grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        collectorB - never null, the collector to perform the second grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        Returns:
        never null
      • groupBy

        <ResultContainerA_,​ResultA_,​ResultContainerB_,​ResultB_,​ResultContainerC_,​ResultC_> TriConstraintStream<ResultA_,​ResultB_,​ResultC_> groupBy​(BiConstraintCollector<A,​B,​ResultContainerA_,​ResultA_> collectorA,
                                                                                                                                                                                             BiConstraintCollector<A,​B,​ResultContainerB_,​ResultB_> collectorB,
                                                                                                                                                                                             BiConstraintCollector<A,​B,​ResultContainerC_,​ResultC_> collectorC)
        Convert the BiConstraintStream to a TriConstraintStream, containing only a single tuple, the result of applying three BiConstraintCollectors.
        Type Parameters:
        ResultContainerA_ - the mutable accumulation type (often hidden as an implementation detail)
        ResultA_ - the type of the first fact in the destination TriConstraintStream's tuple
        ResultContainerB_ - the mutable accumulation type (often hidden as an implementation detail)
        ResultB_ - the type of the second fact in the destination TriConstraintStream's tuple
        ResultContainerC_ - the mutable accumulation type (often hidden as an implementation detail)
        ResultC_ - the type of the third fact in the destination TriConstraintStream's tuple
        Parameters:
        collectorA - never null, the collector to perform the first grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        collectorB - never null, the collector to perform the second grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        collectorC - never null, the collector to perform the third grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        Returns:
        never null
      • groupBy

        <ResultContainerA_,​ResultA_,​ResultContainerB_,​ResultB_,​ResultContainerC_,​ResultC_,​ResultContainerD_,​ResultD_> QuadConstraintStream<ResultA_,​ResultB_,​ResultC_,​ResultD_> groupBy​(BiConstraintCollector<A,​B,​ResultContainerA_,​ResultA_> collectorA,
                                                                                                                                                                                                                                                    BiConstraintCollector<A,​B,​ResultContainerB_,​ResultB_> collectorB,
                                                                                                                                                                                                                                                    BiConstraintCollector<A,​B,​ResultContainerC_,​ResultC_> collectorC,
                                                                                                                                                                                                                                                    BiConstraintCollector<A,​B,​ResultContainerD_,​ResultD_> collectorD)
        Convert the BiConstraintStream to a QuadConstraintStream, containing only a single tuple, the result of applying four BiConstraintCollectors.
        Type Parameters:
        ResultContainerA_ - the mutable accumulation type (often hidden as an implementation detail)
        ResultA_ - the type of the first fact in the destination QuadConstraintStream's tuple
        ResultContainerB_ - the mutable accumulation type (often hidden as an implementation detail)
        ResultB_ - the type of the second fact in the destination QuadConstraintStream's tuple
        ResultContainerC_ - the mutable accumulation type (often hidden as an implementation detail)
        ResultC_ - the type of the third fact in the destination QuadConstraintStream's tuple
        ResultContainerD_ - the mutable accumulation type (often hidden as an implementation detail)
        ResultD_ - the type of the fourth fact in the destination QuadConstraintStream's tuple
        Parameters:
        collectorA - never null, the collector to perform the first grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        collectorB - never null, the collector to perform the second grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        collectorC - never null, the collector to perform the third grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        collectorD - never null, the collector to perform the fourth grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        Returns:
        never null
      • groupBy

        <GroupKey_> UniConstraintStream<GroupKey_> groupBy​(BiFunction<A,​B,​GroupKey_> groupKeyMapping)
        Convert the BiConstraintStream to a UniConstraintStream, 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 stream Objects.equals(Object, Object) any other.
        Type Parameters:
        GroupKey_ - the type of a fact in the destination UniConstraintStream's tuple
        Parameters:
        groupKeyMapping - never null, mapping function to convert each element in the stream to a different element
        Returns:
        never null
      • groupBy

        <GroupKey_,​ResultContainer_,​Result_> BiConstraintStream<GroupKey_,​Result_> groupBy​(BiFunction<A,​B,​GroupKey_> groupKeyMapping,
                                                                                                             BiConstraintCollector<A,​B,​ResultContainer_,​Result_> collector)
        Convert the BiConstraintStream to a different BiConstraintStream, consisting of unique tuples.

        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 BiConstraintCollector applied on all incoming tuples with the same first fact.

        Type Parameters:
        GroupKey_ - the type of the first fact in the destination BiConstraintStream's tuple
        ResultContainer_ - the mutable accumulation type (often hidden as an implementation detail)
        Result_ - the type of the second fact in the destination BiConstraintStream's tuple
        Parameters:
        groupKeyMapping - never null, function to convert the fact in the original tuple to a different fact
        collector - never null, the collector to perform the grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        Returns:
        never null
      • groupBy

        <GroupKey_,​ResultContainerB_,​ResultB_,​ResultContainerC_,​ResultC_> TriConstraintStream<GroupKey_,​ResultB_,​ResultC_> groupBy​(BiFunction<A,​B,​GroupKey_> groupKeyMapping,
                                                                                                                                                                       BiConstraintCollector<A,​B,​ResultContainerB_,​ResultB_> collectorB,
                                                                                                                                                                       BiConstraintCollector<A,​B,​ResultContainerC_,​ResultC_> collectorC)
        Convert the BiConstraintStream to a TriConstraintStream, 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 BiConstraintCollector applied on all incoming tuples with the same first fact.

        Type Parameters:
        GroupKey_ - the type of the first fact in the destination TriConstraintStream's tuple
        ResultContainerB_ - the mutable accumulation type (often hidden as an implementation detail)
        ResultB_ - the type of the second fact in the destination TriConstraintStream's tuple
        ResultContainerC_ - the mutable accumulation type (often hidden as an implementation detail)
        ResultC_ - the type of the third fact in the destination TriConstraintStream's tuple
        Parameters:
        groupKeyMapping - never null, function to convert the fact in the original tuple to a different fact
        collectorB - never null, the collector to perform the first grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        collectorC - never null, the collector to perform the second grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        Returns:
        never null
      • groupBy

        <GroupKey_,​ResultContainerB_,​ResultB_,​ResultContainerC_,​ResultC_,​ResultContainerD_,​ResultD_> QuadConstraintStream<GroupKey_,​ResultB_,​ResultC_,​ResultD_> groupBy​(BiFunction<A,​B,​GroupKey_> groupKeyMapping,
                                                                                                                                                                                                                              BiConstraintCollector<A,​B,​ResultContainerB_,​ResultB_> collectorB,
                                                                                                                                                                                                                              BiConstraintCollector<A,​B,​ResultContainerC_,​ResultC_> collectorC,
                                                                                                                                                                                                                              BiConstraintCollector<A,​B,​ResultContainerD_,​ResultD_> collectorD)
        Convert the BiConstraintStream to a QuadConstraintStream, 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 BiConstraintCollector applied on all incoming tuples with the same first fact.

        Type Parameters:
        GroupKey_ - the type of the first fact in the destination QuadConstraintStream's tuple
        ResultContainerB_ - the mutable accumulation type (often hidden as an implementation detail)
        ResultB_ - the type of the second fact in the destination QuadConstraintStream's tuple
        ResultContainerC_ - the mutable accumulation type (often hidden as an implementation detail)
        ResultC_ - the type of the third fact in the destination QuadConstraintStream's tuple
        ResultContainerD_ - the mutable accumulation type (often hidden as an implementation detail)
        ResultD_ - the type of the fourth fact in the destination QuadConstraintStream's tuple
        Parameters:
        groupKeyMapping - never null, function to convert the fact in the original tuple to a different fact
        collectorB - never null, the collector to perform the first grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        collectorC - never null, the collector to perform the second grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        collectorD - never null, the collector to perform the third grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        Returns:
        never null
      • groupBy

        <GroupKeyA_,​GroupKeyB_> BiConstraintStream<GroupKeyA_,​GroupKeyB_> groupBy​(BiFunction<A,​B,​GroupKeyA_> groupKeyAMapping,
                                                                                              BiFunction<A,​B,​GroupKeyB_> groupKeyBMapping)
        Convert the BiConstraintStream to a different BiConstraintStream, consisting of unique tuples.

        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.

        Type Parameters:
        GroupKeyA_ - the type of the first fact in the destination BiConstraintStream's tuple
        GroupKeyB_ - the type of the second fact in the destination BiConstraintStream's tuple
        Parameters:
        groupKeyAMapping - never null, function to convert the facts in the original tuple to a new fact
        groupKeyBMapping - never null, function to convert the facts in the original tuple to another new fact
        Returns:
        never null
      • groupBy

        <GroupKeyA_,​GroupKeyB_,​ResultContainerC_,​ResultC_,​ResultContainerD_,​ResultD_> QuadConstraintStream<GroupKeyA_,​GroupKeyB_,​ResultC_,​ResultD_> groupBy​(BiFunction<A,​B,​GroupKeyA_> groupKeyAMapping,
                                                                                                                                                                                                            BiFunction<A,​B,​GroupKeyB_> groupKeyBMapping,
                                                                                                                                                                                                            BiConstraintCollector<A,​B,​ResultContainerC_,​ResultC_> collectorC,
                                                                                                                                                                                                            BiConstraintCollector<A,​B,​ResultContainerD_,​ResultD_> collectorD)
        Combines the semantics of groupBy(BiFunction, BiFunction) and groupBy(BiConstraintCollector). That is, the first and second facts in the tuple follow the groupBy(BiFunction, BiFunction) semantics. The third fact is the result of applying the first BiConstraintCollector.finisher() on all the tuples of the original BiConstraintStream that belong to the group. The fourth fact is the result of applying the second BiConstraintCollector.finisher() on all the tuples of the original BiConstraintStream that belong to the group
        Type Parameters:
        GroupKeyA_ - the type of the first fact in the destination QuadConstraintStream's tuple
        GroupKeyB_ - the type of the second fact in the destination QuadConstraintStream's tuple
        ResultContainerC_ - the mutable accumulation type (often hidden as an implementation detail)
        ResultC_ - the type of the third fact in the destination QuadConstraintStream's tuple
        ResultContainerD_ - the mutable accumulation type (often hidden as an implementation detail)
        ResultD_ - the type of the fourth fact in the destination QuadConstraintStream's tuple
        Parameters:
        groupKeyAMapping - never null, function to convert the original tuple into a first fact
        groupKeyBMapping - never null, function to convert the original tuple into a second fact
        collectorC - never null, the collector to perform the first grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        collectorD - never null, the collector to perform the second grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        Returns:
        never null
      • groupBy

        <GroupKeyA_,​GroupKeyB_,​GroupKeyC_> TriConstraintStream<GroupKeyA_,​GroupKeyB_,​GroupKeyC_> groupBy​(BiFunction<A,​B,​GroupKeyA_> groupKeyAMapping,
                                                                                                                                 BiFunction<A,​B,​GroupKeyB_> groupKeyBMapping,
                                                                                                                                 BiFunction<A,​B,​GroupKeyC_> groupKeyCMapping)
        Convert the BiConstraintStream to a TriConstraintStream, 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.

        Type Parameters:
        GroupKeyA_ - the type of the first fact in the destination TriConstraintStream's tuple
        GroupKeyB_ - the type of the second fact in the destination TriConstraintStream's tuple
        GroupKeyC_ - the type of the third fact in the destination TriConstraintStream's tuple
        Parameters:
        groupKeyAMapping - never null, function to convert the original tuple into a first fact
        groupKeyBMapping - never null, function to convert the original tuple into a second fact
        groupKeyCMapping - never null, function to convert the original tuple into a third fact
        Returns:
        never null
      • groupBy

        <GroupKeyA_,​GroupKeyB_,​GroupKeyC_,​ResultContainerD_,​ResultD_> QuadConstraintStream<GroupKeyA_,​GroupKeyB_,​GroupKeyC_,​ResultD_> groupBy​(BiFunction<A,​B,​GroupKeyA_> groupKeyAMapping,
                                                                                                                                                                                        BiFunction<A,​B,​GroupKeyB_> groupKeyBMapping,
                                                                                                                                                                                        BiFunction<A,​B,​GroupKeyC_> groupKeyCMapping,
                                                                                                                                                                                        BiConstraintCollector<A,​B,​ResultContainerD_,​ResultD_> collectorD)
        Combines the semantics of groupBy(BiFunction, BiFunction) and groupBy(BiConstraintCollector). That is, the first three facts in the tuple follow the groupBy(BiFunction, BiFunction) semantics. The final fact is the result of applying the first BiConstraintCollector.finisher() on all the tuples of the original BiConstraintStream that belong to the group.
        Type Parameters:
        GroupKeyA_ - the type of the first fact in the destination QuadConstraintStream's tuple
        GroupKeyB_ - the type of the second fact in the destination QuadConstraintStream's tuple
        GroupKeyC_ - the type of the third fact in the destination QuadConstraintStream's tuple
        ResultContainerD_ - the mutable accumulation type (often hidden as an implementation detail)
        ResultD_ - the type of the fourth fact in the destination QuadConstraintStream's tuple
        Parameters:
        groupKeyAMapping - never null, function to convert the original tuple into a first fact
        groupKeyBMapping - never null, function to convert the original tuple into a second fact
        groupKeyCMapping - never null, function to convert the original tuple into a third fact
        collectorD - never null, the collector to perform the grouping operation with See ConstraintCollectors for common operations, such as count(), sum() and others.
        Returns:
        never null
      • groupBy

        <GroupKeyA_,​GroupKeyB_,​GroupKeyC_,​GroupKeyD_> QuadConstraintStream<GroupKeyA_,​GroupKeyB_,​GroupKeyC_,​GroupKeyD_> groupBy​(BiFunction<A,​B,​GroupKeyA_> groupKeyAMapping,
                                                                                                                                                                    BiFunction<A,​B,​GroupKeyB_> groupKeyBMapping,
                                                                                                                                                                    BiFunction<A,​B,​GroupKeyC_> groupKeyCMapping,
                                                                                                                                                                    BiFunction<A,​B,​GroupKeyD_> groupKeyDMapping)
        Convert the BiConstraintStream to a QuadConstraintStream, 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.

        Type Parameters:
        GroupKeyA_ - the type of the first fact in the destination QuadConstraintStream's tuple
        GroupKeyB_ - the type of the second fact in the destination QuadConstraintStream's tuple
        GroupKeyC_ - the type of the third fact in the destination QuadConstraintStream's tuple
        GroupKeyD_ - the type of the fourth fact in the destination QuadConstraintStream's tuple
        Parameters:
        groupKeyAMapping - never null, function to convert the original tuple into a first fact
        groupKeyBMapping - never null, function to convert the original tuple into a second fact
        groupKeyCMapping - never null, function to convert the original tuple into a third fact
        groupKeyDMapping - never null, function to convert the original tuple into a fourth fact
        Returns:
        never null
      • flattenLast

        <ResultB_> BiConstraintStream<A,​ResultB_> flattenLast​(Function<B,​Iterable<ResultB_>> mapping)
        Takes each tuple and applies a mapping on the last fact, which turns it into Iterable. Returns a constraint stream consisting of tuples of the first fact and the contents of the Iterable one after another. In other words, it will replace the current tuple with new tuples, a cartesian product of A and the individual items from the Iterable.

        This may produce a stream with duplicate tuples. See distinct() for details.

        In cases where the last fact is already Iterable, use Function.identity() as the argument.

        Simple example: assuming a constraint stream of (PersonName, Person) [(Ann, (name = Ann, roles = [USER, ADMIN])), (Beth, (name = Beth, roles = [USER])), (Cathy, (name = Cathy, roles = [ADMIN, AUDITOR]))], calling flattenLast(Person::getRoles) on such stream will produce a stream of [(Ann, USER), (Ann, ADMIN), (Beth, USER), (Cathy, ADMIN), (Cathy, AUDITOR)].

        Type Parameters:
        ResultB_ - the type of the last fact in the resulting tuples
        Parameters:
        mapping - never null, function to convert the last fact in the original tuple into Iterable
        Returns:
        never null
      • distinct

        BiConstraintStream<A,​B> distinct()
        Transforms the stream in such a way that all the tuples going through it are distinct. (No two result tuples are equal.)

        By default, tuples going through a constraint stream are distinct. However, operations such as map(BiFunction) may create a stream which breaks that promise. By calling this method on such a stream, duplicate copies of the same tuple are omitted at a performance cost.

        Returns:
        never null
      • penalizeLong

        default Constraint penalizeLong​(String constraintName,
                                        Score<?> constraintWeight,
                                        ToLongBiFunction<A,​B> matchWeigher)
        Negatively impact the Score: subtract the constraintWeight multiplied by the match weight. Otherwise as defined by ConstraintStream.penalize(String, Score).
        Parameters:
        constraintName - never null, shows up in ConstraintMatchTotal during score justification
        constraintWeight - never null
        matchWeigher - never null, the result of this function (matchWeight) is multiplied by the constraintWeight
        Returns:
        never null
      • penalizeBigDecimal

        default Constraint penalizeBigDecimal​(String constraintName,
                                              Score<?> constraintWeight,
                                              BiFunction<A,​B,​BigDecimal> matchWeigher)
        Negatively impact the Score: subtract the constraintWeight multiplied by the match weight. Otherwise as defined by ConstraintStream.penalize(String, Score).
        Parameters:
        constraintName - never null, shows up in ConstraintMatchTotal during score justification
        constraintWeight - never null
        matchWeigher - never null, the result of this function (matchWeight) is multiplied by the constraintWeight
        Returns:
        never null
      • rewardLong

        default Constraint rewardLong​(String constraintName,
                                      Score<?> constraintWeight,
                                      ToLongBiFunction<A,​B> matchWeigher)
        Positively impact the Score: add the constraintWeight multiplied by the match weight. Otherwise as defined by ConstraintStream.reward(String, Score).
        Parameters:
        constraintName - never null, shows up in ConstraintMatchTotal during score justification
        constraintWeight - never null
        matchWeigher - never null, the result of this function (matchWeight) is multiplied by the constraintWeight
        Returns:
        never null
      • rewardBigDecimal

        default Constraint rewardBigDecimal​(String constraintName,
                                            Score<?> constraintWeight,
                                            BiFunction<A,​B,​BigDecimal> matchWeigher)
        Positively impact the Score: add the constraintWeight multiplied by the match weight. Otherwise as defined by ConstraintStream.reward(String, Score).
        Parameters:
        constraintName - never null, shows up in ConstraintMatchTotal during score justification
        constraintWeight - never null
        matchWeigher - never null, the result of this function (matchWeight) is multiplied by the constraintWeight
        Returns:
        never null
      • impactLong

        default Constraint impactLong​(String constraintName,
                                      Score<?> constraintWeight,
                                      ToLongBiFunction<A,​B> matchWeigher)
        Positively or negatively impact the Score by the constraintWeight multiplied by the match weight. Otherwise as defined by ConstraintStream.impact(String, Score).

        Use penalizeLong(...) or rewardLong(...) instead, unless this constraint can both have positive and negative weights.

        Parameters:
        constraintName - never null, shows up in ConstraintMatchTotal during score justification
        constraintWeight - never null
        matchWeigher - never null, the result of this function (matchWeight) is multiplied by the constraintWeight
        Returns:
        never null
      • impactBigDecimal

        default Constraint impactBigDecimal​(String constraintName,
                                            Score<?> constraintWeight,
                                            BiFunction<A,​B,​BigDecimal> matchWeigher)
        Positively or negatively impact the Score by the constraintWeight multiplied by the match weight. Otherwise as defined by ConstraintStream.impact(String, Score).

        Use penalizeBigDecimal(...) or rewardBigDecimal(...) instead, unless this constraint can both have positive and negative weights.

        Parameters:
        constraintName - never null, shows up in ConstraintMatchTotal during score justification
        constraintWeight - never null
        matchWeigher - never null, the result of this function (matchWeight) is multiplied by the constraintWeight
        Returns:
        never null