Class VariableListenerSupport<Solution_>
- java.lang.Object
-
- org.optaplanner.core.impl.domain.variable.listener.support.VariableListenerSupport<Solution_>
-
- Type Parameters:
Solution_- the solution type, the class with thePlanningSolutionannotation
- All Implemented Interfaces:
SupplyManager<Solution_>
public class VariableListenerSupport<Solution_> extends Object implements SupplyManager<Solution_>
-
-
Field Summary
Fields Modifier and Type Field Description protected intnextGlobalOrderprotected List<VariableListenerNotifiable>notifiableListprotected booleannotificationQueuesAreEmptyprotected InnerScoreDirector<Solution_,?>scoreDirectorprotected Map<EntityDescriptor<Solution_>,List<VariableListenerNotifiable>>sourceEntityToNotifiableMapprotected Map<VariableDescriptor<Solution_>,List<VariableListenerNotifiable>>sourceVariableToNotifiableMapprotected Map<Demand<Solution_,?>,Supply>supplyMap
-
Constructor Summary
Constructors Constructor Description VariableListenerSupport(InnerScoreDirector<Solution_,?> scoreDirector)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterEntityAdded(EntityDescriptor<Solution_> entityDescriptor, Object entity)voidafterEntityRemoved(EntityDescriptor<Solution_> entityDescriptor, Object entity)voidafterVariableChanged(VariableDescriptor<Solution_> variableDescriptor, Object entity)voidassertNotificationQueuesAreEmpty()voidbeforeEntityAdded(EntityDescriptor<Solution_> entityDescriptor, Object entity)voidbeforeEntityRemoved(EntityDescriptor<Solution_> entityDescriptor, Object entity)voidbeforeVariableChanged(VariableDescriptor<Solution_> variableDescriptor, Object entity)voidclearWorkingSolution()<Supply_ extends Supply>
Supply_demand(Demand<Solution_,Supply_> demand)voidlinkVariableListeners()voidresetWorkingSolution()voidtriggerAllVariableListeners()voidtriggerVariableListenersInNotificationQueues()
-
-
-
Field Detail
-
scoreDirector
protected final InnerScoreDirector<Solution_,?> scoreDirector
-
notifiableList
protected final List<VariableListenerNotifiable> notifiableList
-
sourceVariableToNotifiableMap
protected final Map<VariableDescriptor<Solution_>,List<VariableListenerNotifiable>> sourceVariableToNotifiableMap
-
sourceEntityToNotifiableMap
protected final Map<EntityDescriptor<Solution_>,List<VariableListenerNotifiable>> sourceEntityToNotifiableMap
-
nextGlobalOrder
protected int nextGlobalOrder
-
notificationQueuesAreEmpty
protected boolean notificationQueuesAreEmpty
-
-
Constructor Detail
-
VariableListenerSupport
public VariableListenerSupport(InnerScoreDirector<Solution_,?> scoreDirector)
-
-
Method Detail
-
linkVariableListeners
public void linkVariableListeners()
-
demand
public <Supply_ extends Supply> Supply_ demand(Demand<Solution_,Supply_> demand)
Description copied from interface:SupplyManagerReturns theSupplyfor aDemand, preferably an existing one. If theSupplydoesn't exist yet (as part of the domain model or externalized), it creates and attaches it.- Specified by:
demandin interfaceSupplyManager<Solution_>- Type Parameters:
Supply_- Subclass ofSupply- Parameters:
demand- never null- Returns:
- never null
-
resetWorkingSolution
public void resetWorkingSolution()
-
clearWorkingSolution
public void clearWorkingSolution()
-
beforeEntityAdded
public void beforeEntityAdded(EntityDescriptor<Solution_> entityDescriptor, Object entity)
-
afterEntityAdded
public void afterEntityAdded(EntityDescriptor<Solution_> entityDescriptor, Object entity)
-
beforeVariableChanged
public void beforeVariableChanged(VariableDescriptor<Solution_> variableDescriptor, Object entity)
-
afterVariableChanged
public void afterVariableChanged(VariableDescriptor<Solution_> variableDescriptor, Object entity)
-
beforeEntityRemoved
public void beforeEntityRemoved(EntityDescriptor<Solution_> entityDescriptor, Object entity)
-
afterEntityRemoved
public void afterEntityRemoved(EntityDescriptor<Solution_> entityDescriptor, Object entity)
-
triggerVariableListenersInNotificationQueues
public void triggerVariableListenersInNotificationQueues()
-
triggerAllVariableListeners
public void triggerAllVariableListeners()
-
assertNotificationQueuesAreEmpty
public void assertNotificationQueuesAreEmpty()
-
-