public interface ConstraintFactory
The factory to create every ConstraintStream (for example with from(Class))
which ends in a Constraint returned by ConstraintProvider.defineConstraints(ConstraintFactory).
| Modifier and Type | Method and Description |
|---|---|
<A> UniConstraintStream<A> |
from(Class<A> fromClass)
Start a
ConstraintStream of all instances of the fromClass
that are known as problem facts or planning entities. |
<A> UniConstraintStream<A> |
fromUnfiltered(Class<A> fromClass)
Like
from(Class),
but without any filtering of uninitialized planning entities. |
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. |
default <A> BiConstraintStream<A,A> |
fromUniquePair(Class<A> fromClass,
BiJoiner<A,A>... joiners)
As defined by
fromUniquePair(Class, BiJoiner). |
<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). |
default <A> BiConstraintStream<A,A> |
fromUniquePair(Class<A> fromClass,
BiJoiner<A,A> joiner1,
BiJoiner<A,A> joiner2)
As defined by
fromUniquePair(Class, BiJoiner). |
default <A> BiConstraintStream<A,A> |
fromUniquePair(Class<A> fromClass,
BiJoiner<A,A> joiner1,
BiJoiner<A,A> joiner2,
BiJoiner<A,A> joiner3)
As defined by
fromUniquePair(Class, BiJoiner). |
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)
As defined by
fromUniquePair(Class, BiJoiner). |
String |
getDefaultConstraintPackage()
This is
ConstraintConfiguration.constraintPackage() if available,
otherwise the package of the PlanningSolution class. |
String getDefaultConstraintPackage()
ConstraintConfiguration.constraintPackage() if available,
otherwise the package of the PlanningSolution class.<A> UniConstraintStream<A> from(Class<A> fromClass)
ConstraintStream of all instances of the fromClass
that are known as problem facts or planning entities.
If the fromClass is a PlanningEntity, then it will be automatically
filtered to only contain fully initialized entities,
for which each genuine PlanningVariable (of the fromClass or a superclass thereof) is initialized
(so when the value is not null - unless PlanningVariable.nullable() is modified).
This filtering will NOT automatically apply to genuine planning variables of subclass planning entities of the fromClass.
A - the type of the matched problem fact or planning entityfromClass - never null<A> UniConstraintStream<A> fromUnfiltered(Class<A> fromClass)
from(Class),
but without any filtering of uninitialized planning entities.A - the type of the matched problem fact or planning entityfromClass - never nulldefault <A> BiConstraintStream<A,A> fromUniquePair(Class<A> fromClass)
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.
A - the type of the matched problem fact or planning entityfromClass - never null<A> BiConstraintStream<A,A> fromUniquePair(Class<A> fromClass, BiJoiner<A,A> joiner)
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.
A - the type of the matched problem fact or planning entityfromClass - never nulljoiner - never nullBiJoiner is truedefault <A> BiConstraintStream<A,A> fromUniquePair(Class<A> fromClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2)
fromUniquePair(Class, BiJoiner).A - the type of the matched problem fact or planning entityfromClass - never nulljoiner1 - never nulljoiner2 - never nulljoiners are
truedefault <A> BiConstraintStream<A,A> fromUniquePair(Class<A> fromClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3)
fromUniquePair(Class, BiJoiner).A - the type of the matched problem fact or planning entityfromClass - never nulljoiner1 - never nulljoiner2 - never nulljoiner3 - never nulljoiners are
truedefault <A> BiConstraintStream<A,A> fromUniquePair(Class<A> fromClass, BiJoiner<A,A> joiner1, BiJoiner<A,A> joiner2, BiJoiner<A,A> joiner3, BiJoiner<A,A> joiner4)
fromUniquePair(Class, BiJoiner).A - the type of the matched problem fact or planning entityfromClass - never nulljoiner1 - never nulljoiner2 - never nulljoiner3 - never nulljoiner4 - never nulljoiners are
truedefault <A> BiConstraintStream<A,A> fromUniquePair(Class<A> fromClass, BiJoiner<A,A>... joiners)
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.
A - the type of the matched problem fact or planning entityfromClass - never nulljoiners - never nulljoiners are
trueCopyright © 2006–2021 JBoss by Red Hat. All rights reserved.