Interface Notification<Solution_,T extends AbstractVariableListener<Solution_,Object>>
- Type Parameters:
Solution_
- the solution type, the class with thePlanningSolution
annotationT
- the variable listener type
- All Known Subinterfaces:
BasicVariableNotification<Solution_>
,EntityNotification<Solution_>
,ListVariableNotification<Solution_>
public interface Notification<Solution_,T extends AbstractVariableListener<Solution_,Object>>
A notification represents some kind of change of a planning variable. When a score director is notified about a change,
one notification is created for each
Notifiable
registered for the subject of the change.
Each implementation is tailored to a specific AbstractVariableListener
and triggers on the listener
the pair of "before/after" methods corresponding to the type of change it represents.
For example, if there is a shadow variable sourced on the Process.computer
genuine planning variable,
then there is a notifiable F
registered for the Process.computer
planning variable, and it holds a basic
variable listener L
.
When Process X
is moved from Computer A
to Computer B
, a notification N
is created and added
to notifiable F
's queue. The notification N
triggers
L.beforeVariableChanged(scoreDirector, Process X)
immediately.
Later, when F.triggerAllNotifications()
is called, N
is taken from
the queue and triggers VariableListener.afterVariableChanged(org.optaplanner.core.api.score.director.ScoreDirector<Solution_>, Entity_)
.-
Method Summary
Modifier and TypeMethodDescriptionstatic <Solution_>
ListVariableNotification<Solution_>elementUnassigned
(Object element) An element was unassigned from a list variable.static <Solution_>
EntityNotification<Solution_>entityAdded
(Object entity) Theentity
was added.static <Solution_>
EntityNotification<Solution_>entityRemoved
(Object entity) Theentity
was removed.static <Solution_>
ListVariableNotification<Solution_>listVariableChanged
(Object entity, int fromIndex, int toIndex) A list variable change occurs onentity
betweenfromIndex
andtoIndex
.void
triggerAfter
(T variableListener, ScoreDirector<Solution_> scoreDirector) TriggervariableListener
's after method corresponding to this notification.void
triggerBefore
(T variableListener, ScoreDirector<Solution_> scoreDirector) TriggervariableListener
's before method corresponding to this notification.static <Solution_>
BasicVariableNotification<Solution_>variableChanged
(Object entity) Basic genuine or shadow planning variable changed onentity
.
-
Method Details
-
entityAdded
Theentity
was added. -
entityRemoved
Theentity
was removed. -
variableChanged
Basic genuine or shadow planning variable changed onentity
. -
elementUnassigned
An element was unassigned from a list variable. -
listVariableChanged
static <Solution_> ListVariableNotification<Solution_> listVariableChanged(Object entity, int fromIndex, int toIndex) A list variable change occurs onentity
betweenfromIndex
andtoIndex
. -
triggerBefore
TriggervariableListener
's before method corresponding to this notification. -
triggerAfter
TriggervariableListener
's after method corresponding to this notification.
-