Interface ConstraintFactory

    • Method Detail

      • fromUniquePair

        default <A> BiConstraintStream<A,​A> fromUniquePair​(Class<A> fromClass)
        Create a new BiConstraintStream for every unique combination of A and another A with a higher PlanningId.

        Important: Filtering this is slower and less scalable than using a joiner, because it does barely applies hashing and/or indexing on the properties, so it creates and checks almost every combination of A and A.

        This method is syntactic sugar for UniConstraintStream.join(Class). It automatically adds a lessThan joiner on the PlanningId of A.

        Type Parameters:
        A - the type of the matched problem fact or planning entity
        Parameters:
        fromClass - never null
        Returns:
        a stream that matches every unique combination of A and another A
      • fromUniquePair

        <A> BiConstraintStream<A,​A> fromUniquePair​(Class<A> fromClass,
                                                         BiJoiner<A,​A> joiner)
        Create a new BiConstraintStream for every unique combination of A and another A with a higher PlanningId for which the BiJoiner is true (for the properties it extracts from both facts).

        Important: This is faster and more scalable than not using a fromUniquePair(Class) joiner} followed by a filter, because it applies hashing and/or indexing on the properties, so it doesn't create nor checks almost every combination of A and A.

        This method is syntactic sugar for UniConstraintStream.join(Class, BiJoiner). It automatically adds a lessThan joiner on the PlanningId of A.

        This method has overloaded methods with multiple BiJoiner parameters.

        Type Parameters:
        A - the type of the matched problem fact or planning entity
        Parameters:
        fromClass - never null
        joiner - never null
        Returns:
        a stream that matches every unique combination of A and another A for which the BiJoiner is true
      • fromUniquePair

        default <A> BiConstraintStream<A,​A> fromUniquePair​(Class<A> fromClass,
                                                                 BiJoiner<A,​A> joiner1,
                                                                 BiJoiner<A,​A> joiner2)
        Type Parameters:
        A - the type of the matched problem fact or planning entity
        Parameters:
        fromClass - never null
        joiner1 - never null
        joiner2 - never null
        Returns:
        a stream that matches every unique combination of A and another A for which all the joiners are true
      • fromUniquePair

        default <A> BiConstraintStream<A,​A> fromUniquePair​(Class<A> fromClass,
                                                                 BiJoiner<A,​A> joiner1,
                                                                 BiJoiner<A,​A> joiner2,
                                                                 BiJoiner<A,​A> joiner3)
        Type Parameters:
        A - the type of the matched problem fact or planning entity
        Parameters:
        fromClass - never null
        joiner1 - never null
        joiner2 - never null
        joiner3 - never null
        Returns:
        a stream that matches every unique combination of A and another A for which all the joiners are true
      • fromUniquePair

        default <A> BiConstraintStream<A,​A> fromUniquePair​(Class<A> fromClass,
                                                                 BiJoiner<A,​A> joiner1,
                                                                 BiJoiner<A,​A> joiner2,
                                                                 BiJoiner<A,​A> joiner3,
                                                                 BiJoiner<A,​A> joiner4)
        Type Parameters:
        A - the type of the matched problem fact or planning entity
        Parameters:
        fromClass - never null
        joiner1 - never null
        joiner2 - never null
        joiner3 - never null
        joiner4 - never null
        Returns:
        a stream that matches every unique combination of A and another A for which all the joiners are true
      • fromUniquePair

        default <A> BiConstraintStream<A,​A> fromUniquePair​(Class<A> fromClass,
                                                                 BiJoiner<A,​A>... joiners)
        As defined by fromUniquePair(Class, BiJoiner).

        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:
        A - the type of the matched problem fact or planning entity
        Parameters:
        fromClass - never null
        joiners - never null
        Returns:
        a stream that matches every unique combination of A and another A for which all the joiners are true