Interface ScoreDirector<Solution_>
- Type Parameters:
Solution_
- the solution type, the class with thePlanningSolution
annotation
- All Known Subinterfaces:
InnerScoreDirector<Solution_,
Score_>
- All Known Implementing Classes:
AbstractScoreDirector
,DrlScoreDirector
,EasyScoreDirector
,IncrementalScoreDirector
public interface ScoreDirector<Solution_>
The ScoreDirector holds the
working solution
and calculates the Score
for it.-
Method Summary
Modifier and TypeMethodDescriptionvoid
afterEntityAdded
(Object entity) void
afterEntityRemoved
(Object entity) void
afterListVariableChanged
(Object entity, String variableName, int fromIndex, int toIndex) void
afterListVariableElementAssigned
(Object entity, String variableName, Object element) void
afterListVariableElementUnassigned
(Object entity, String variableName, Object element) void
afterProblemFactAdded
(Object problemFact) void
afterProblemFactRemoved
(Object problemFact) void
afterProblemPropertyChanged
(Object problemFactOrEntity) void
afterVariableChanged
(Object entity, String variableName) void
beforeEntityAdded
(Object entity) void
beforeEntityRemoved
(Object entity) void
beforeListVariableChanged
(Object entity, String variableName, int fromIndex, int toIndex) void
beforeListVariableElementAssigned
(Object entity, String variableName, Object element) void
beforeListVariableElementUnassigned
(Object entity, String variableName, Object element) void
beforeProblemFactAdded
(Object problemFact) void
beforeProblemFactRemoved
(Object problemFact) void
beforeProblemPropertyChanged
(Object problemFactOrEntity) void
beforeVariableChanged
(Object entity, String variableName) ThePlanningSolution
that is used to calculate theScore
.<E> E
lookUpWorkingObject
(E externalObject) Translates an entity or fact instance (often from anotherThread
or JVM) to thisScoreDirector
's internal working instance.<E> E
lookUpWorkingObjectOrReturnNull
(E externalObject) As defined bylookUpWorkingObject(Object)
, but doesn't fail fast if no workingObject was ever added for the externalObject.void
-
Method Details
-
getWorkingSolution
Solution_ getWorkingSolution()ThePlanningSolution
that is used to calculate theScore
.Because a
Score
is best calculated incrementally (by deltas), theScoreDirector
needs to be notified when itsworking solution
changes.- Returns:
- never null
-
beforeEntityAdded
-
afterEntityAdded
-
beforeVariableChanged
-
afterVariableChanged
-
beforeListVariableElementAssigned
-
afterListVariableElementAssigned
-
beforeListVariableElementUnassigned
-
afterListVariableElementUnassigned
-
beforeListVariableChanged
-
afterListVariableChanged
-
triggerVariableListeners
void triggerVariableListeners() -
beforeEntityRemoved
-
afterEntityRemoved
-
beforeProblemFactAdded
-
afterProblemFactAdded
-
beforeProblemPropertyChanged
-
afterProblemPropertyChanged
-
beforeProblemFactRemoved
-
afterProblemFactRemoved
-
lookUpWorkingObject
<E> E lookUpWorkingObject(E externalObject) Translates an entity or fact instance (often from anotherThread
or JVM) to thisScoreDirector
's internal working instance. Useful for move rebasing and in aProblemChange
.Matching is determined by the
LookUpStrategyType
onPlanningSolution
. Matching uses aPlanningId
by default.- Type Parameters:
E
- the object type- Parameters:
externalObject
- sometimes null- Returns:
- null if externalObject is null
- Throws:
IllegalArgumentException
- if there is no workingObject for externalObject, if it cannot be looked up or if the externalObject's class is not supportedIllegalStateException
- if it cannot be looked up
-
lookUpWorkingObjectOrReturnNull
<E> E lookUpWorkingObjectOrReturnNull(E externalObject) As defined bylookUpWorkingObject(Object)
, but doesn't fail fast if no workingObject was ever added for the externalObject. It's recommended to uselookUpWorkingObject(Object)
instead, especially in move rebasing code.- Type Parameters:
E
- the object type- Parameters:
externalObject
- sometimes null- Returns:
- null if externalObject is null or if there is no workingObject for externalObject
- Throws:
IllegalArgumentException
- if it cannot be looked up or if the externalObject's class is not supportedIllegalStateException
- if it cannot be looked up
-