Class ExternalizedIndexVariableSupply<Solution_>
- java.lang.Object
 - 
- org.optaplanner.core.impl.domain.variable.index.ExternalizedIndexVariableSupply<Solution_>
 
 
- 
- All Implemented Interfaces:
 Closeable,AutoCloseable,AbstractVariableListener<Solution_,Object>,IndexVariableSupply,SourcedVariableListener<Solution_>,ListVariableListener<Solution_,Object>,Supply
public class ExternalizedIndexVariableSupply<Solution_> extends Object implements SourcedVariableListener<Solution_>, ListVariableListener<Solution_,Object>, IndexVariableSupply
Alternative toIndexVariableListener. 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected Map<Object,Integer>indexMapprotected ListVariableDescriptor<Solution_>sourceVariableDescriptor 
- 
Constructor Summary
Constructors Constructor Description ExternalizedIndexVariableSupply(ListVariableDescriptor<Solution_> sourceVariableDescriptor) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterElementAdded(ScoreDirector<Solution_> scoreDirector, Object entity, int index)voidafterElementMoved(ScoreDirector<Solution_> scoreDirector, Object sourceEntity, int sourceIndex, Object destinationEntity, int destinationIndex)voidafterElementRemoved(ScoreDirector<Solution_> scoreDirector, Object entity, int index)voidafterEntityAdded(ScoreDirector<Solution_> scoreDirector, Object entity)voidafterEntityRemoved(ScoreDirector<Solution_> scoreDirector, Object entity)voidbeforeElementAdded(ScoreDirector<Solution_> scoreDirector, Object entity, int index)voidbeforeElementMoved(ScoreDirector<Solution_> scoreDirector, Object sourceEntity, int sourceIndex, Object destinationEntity, int destinationIndex)voidbeforeElementRemoved(ScoreDirector<Solution_> scoreDirector, Object entity, int index)voidbeforeEntityAdded(ScoreDirector<Solution_> scoreDirector, Object entity)voidbeforeEntityRemoved(ScoreDirector<Solution_> scoreDirector, Object entity)voidclose()Called before thisAbstractVariableListeneris thrown away and not used anymore.IntegergetIndex(Object element)GetplanningValue's index in thelist variableit is an element of.VariableDescriptor<Solution_>getSourceVariableDescriptor()voidresetWorkingSolution(ScoreDirector<Solution_> scoreDirector)Called when the entire working solution changes.StringtoString()- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 
- 
Methods inherited from interface org.optaplanner.core.api.domain.variable.AbstractVariableListener
requiresUniqueEntityEvents 
 - 
 
 - 
 
- 
- 
Field Detail
- 
sourceVariableDescriptor
protected final ListVariableDescriptor<Solution_> sourceVariableDescriptor
 
 - 
 
- 
Constructor Detail
- 
ExternalizedIndexVariableSupply
public ExternalizedIndexVariableSupply(ListVariableDescriptor<Solution_> sourceVariableDescriptor)
 
 - 
 
- 
Method Detail
- 
getSourceVariableDescriptor
public VariableDescriptor<Solution_> getSourceVariableDescriptor()
- Specified by:
 getSourceVariableDescriptorin interfaceSourcedVariableListener<Solution_>
 
- 
resetWorkingSolution
public void resetWorkingSolution(ScoreDirector<Solution_> scoreDirector)
Description copied from interface:AbstractVariableListenerCalled when the entire working solution changes. In this event, the other before..()/after...() methods will not be called. At this point, implementations should clear state, if any.- Specified by:
 resetWorkingSolutionin interfaceAbstractVariableListener<Solution_,Object>- Parameters:
 scoreDirector- never null
 
- 
close
public void close()
Description copied from interface:AbstractVariableListenerCalled before thisAbstractVariableListeneris thrown away and not used anymore.- Specified by:
 closein interfaceAbstractVariableListener<Solution_,Object>- Specified by:
 closein interfaceAutoCloseable- Specified by:
 closein interfaceCloseable
 
- 
beforeEntityAdded
public void beforeEntityAdded(ScoreDirector<Solution_> scoreDirector, Object entity)
- Specified by:
 beforeEntityAddedin interfaceAbstractVariableListener<Solution_,Object>- Parameters:
 scoreDirector- never nullentity- never null
 
- 
afterEntityAdded
public void afterEntityAdded(ScoreDirector<Solution_> scoreDirector, Object entity)
- Specified by:
 afterEntityAddedin interfaceAbstractVariableListener<Solution_,Object>- Parameters:
 scoreDirector- never nullentity- never null
 
- 
beforeElementAdded
public void beforeElementAdded(ScoreDirector<Solution_> scoreDirector, Object entity, int index)
- Specified by:
 beforeElementAddedin interfaceListVariableListener<Solution_,Object>
 
- 
afterElementAdded
public void afterElementAdded(ScoreDirector<Solution_> scoreDirector, Object entity, int index)
- Specified by:
 afterElementAddedin interfaceListVariableListener<Solution_,Object>
 
- 
beforeElementRemoved
public void beforeElementRemoved(ScoreDirector<Solution_> scoreDirector, Object entity, int index)
- Specified by:
 beforeElementRemovedin interfaceListVariableListener<Solution_,Object>
 
- 
afterElementRemoved
public void afterElementRemoved(ScoreDirector<Solution_> scoreDirector, Object entity, int index)
- Specified by:
 afterElementRemovedin interfaceListVariableListener<Solution_,Object>
 
- 
beforeElementMoved
public void beforeElementMoved(ScoreDirector<Solution_> scoreDirector, Object sourceEntity, int sourceIndex, Object destinationEntity, int destinationIndex)
- Specified by:
 beforeElementMovedin interfaceListVariableListener<Solution_,Object>
 
- 
afterElementMoved
public void afterElementMoved(ScoreDirector<Solution_> scoreDirector, Object sourceEntity, int sourceIndex, Object destinationEntity, int destinationIndex)
- Specified by:
 afterElementMovedin interfaceListVariableListener<Solution_,Object>
 
- 
beforeEntityRemoved
public void beforeEntityRemoved(ScoreDirector<Solution_> scoreDirector, Object entity)
- Specified by:
 beforeEntityRemovedin interfaceAbstractVariableListener<Solution_,Object>- Parameters:
 scoreDirector- never nullentity- never null
 
- 
afterEntityRemoved
public void afterEntityRemoved(ScoreDirector<Solution_> scoreDirector, Object entity)
- Specified by:
 afterEntityRemovedin interfaceAbstractVariableListener<Solution_,Object>- Parameters:
 scoreDirector- never nullentity- never null
 
- 
getIndex
public Integer getIndex(Object element)
Description copied from interface:IndexVariableSupplyGetplanningValue's index in thelist variableit is an element of.- Specified by:
 getIndexin interfaceIndexVariableSupply- Parameters:
 element- never null- Returns:
 planningValue's index in the list variable it is an element of ornullif the value is unassigned
 
 - 
 
 -