public final class DroolsConstraintFactory<Solution_> extends Object implements InnerConstraintFactory<Solution_>
Constructor and Description |
---|
DroolsConstraintFactory(SolutionDescriptor<Solution_> solutionDescriptor) |
Modifier and Type | Method and Description |
---|---|
ConstraintSessionFactory<Solution_> |
buildSessionFactory(Constraint[] constraints)
This method is thread-safe.
|
<A> UniConstraintStream<A> |
fromUnfiltered(Class<A> fromClass)
Like
ConstraintFactory.from(Class) ,
but without any filtering of uninitialized planning entities . |
<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). |
String |
getDefaultConstraintPackage()
This is
ConstraintConfiguration.constraintPackage() if available,
otherwise the package of the PlanningSolution class. |
SolutionDescriptor<Solution_> |
getSolutionDescriptor() |
LongSupplier |
getVariableIdSupplier()
In order to guarantee that all variables have unique names within the context of a rule, we need to be able to
uniquely identify them.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
from
fromUniquePair, fromUniquePair, fromUniquePair, fromUniquePair, fromUniquePair
public DroolsConstraintFactory(SolutionDescriptor<Solution_> solutionDescriptor)
public <A> UniConstraintStream<A> fromUnfiltered(Class<A> fromClass)
ConstraintFactory
ConstraintFactory.from(Class)
,
but without any filtering of uninitialized planning entities
.fromUnfiltered
in interface ConstraintFactory
A
- the type of the matched problem fact or planning entity
fromClass
- never nullpublic <A> BiConstraintStream<A,A> fromUniquePair(Class<A> fromClass, BiJoiner<A,A> joiner)
ConstraintFactory
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 ConstraintFactory.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.
fromUniquePair
in interface ConstraintFactory
A
- the type of the matched problem fact or planning entity
fromClass
- never nulljoiner
- never nullBiJoiner
is truepublic ConstraintSessionFactory<Solution_> buildSessionFactory(Constraint[] constraints)
InnerConstraintFactory
buildSessionFactory
in interface InnerConstraintFactory<Solution_>
constraints
- never nullpublic SolutionDescriptor<Solution_> getSolutionDescriptor()
getSolutionDescriptor
in interface InnerConstraintFactory<Solution_>
public LongSupplier getVariableIdSupplier()
public String getDefaultConstraintPackage()
ConstraintFactory
ConstraintConfiguration.constraintPackage()
if available,
otherwise the package of the PlanningSolution
class.getDefaultConstraintPackage
in interface ConstraintFactory
Copyright © 2006–2020 JBoss by Red Hat. All rights reserved.