public interface ScoreDirector
Modifier and Type | Method and Description |
---|---|
void |
afterEntityAdded(Object entity) |
void |
afterEntityRemoved(Object entity) |
void |
afterProblemFactAdded(Object problemFact) |
void |
afterProblemFactChanged(Object problemFact) |
void |
afterProblemFactRemoved(Object problemFact) |
void |
afterVariableChanged(Object entity,
String variableName) |
void |
afterVariableChanged(VariableDescriptor variableDescriptor,
Object entity) |
void |
beforeEntityAdded(Object entity) |
void |
beforeEntityRemoved(Object entity) |
void |
beforeProblemFactAdded(Object problemFact) |
void |
beforeProblemFactChanged(Object problemFact) |
void |
beforeProblemFactRemoved(Object problemFact) |
void |
beforeVariableChanged(Object entity,
String variableName) |
void |
beforeVariableChanged(VariableDescriptor variableDescriptor,
Object entity) |
Score |
calculateScore()
Calculates the
Score and updates the workingSolution accordingly. |
void |
changeVariableFacade(VariableDescriptor variableDescriptor,
Object entity,
Object newValue) |
void |
dispose()
Needs to be called after use because some implementations needs to clean up their resources.
|
Collection<ConstraintMatchTotal> |
getConstraintMatchTotals() |
Solution |
getWorkingSolution()
|
boolean |
isConstraintMatchEnabled() |
void |
setWorkingSolution(Solution workingSolution)
The
workingSolution must never be the same instance as the bestSolution ,
it should be a (un)changed clone. |
Solution getWorkingSolution()
Solution
that is used to calculate the Score
.
Because a Score
is best calculated incrementally (by delta's),
the ScoreDirector
needs to be notified when it's workingSolution
changes.
If the Solution
has been changed since calculateScore()
has been called,
the Solution.getScore()
of this Solution
won't be correct.void setWorkingSolution(Solution workingSolution)
workingSolution
must never be the same instance as the bestSolution
,
it should be a (un)changed clone.
Only call this method on a separate ScoreDirector
instance,
build by Solver.getScoreDirectorFactory()
,
not on the one used inside the Solver
itself.workingSolution
- never nullScore calculateScore()
Score
and updates the workingSolution
accordingly.Score
of the workingSolution
boolean isConstraintMatchEnabled()
getConstraintMatchTotals()
can be calledCollection<ConstraintMatchTotal> getConstraintMatchTotals()
IllegalStateException
- if isConstraintMatchEnabled()
returns falsevoid beforeEntityAdded(Object entity)
void afterEntityAdded(Object entity)
void beforeVariableChanged(VariableDescriptor variableDescriptor, Object entity)
void afterVariableChanged(VariableDescriptor variableDescriptor, Object entity)
void changeVariableFacade(VariableDescriptor variableDescriptor, Object entity, Object newValue)
void beforeEntityRemoved(Object entity)
void afterEntityRemoved(Object entity)
void beforeProblemFactAdded(Object problemFact)
void afterProblemFactAdded(Object problemFact)
void beforeProblemFactChanged(Object problemFact)
void afterProblemFactChanged(Object problemFact)
void beforeProblemFactRemoved(Object problemFact)
void afterProblemFactRemoved(Object problemFact)
void dispose()
Copyright © 2006-2015 JBoss by Red Hat. All Rights Reserved.