Class ExternalizedIndexVariableSupply<Solution_>
java.lang.Object
org.optaplanner.core.impl.domain.variable.index.ExternalizedIndexVariableSupply<Solution_>
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- AbstractVariableListener<Solution_,,- Object> - ListVariableListener<Solution_,,- Object, - Object> - IndexVariableSupply,- SourcedVariableListener<Solution_>,- Supply
public class ExternalizedIndexVariableSupply<Solution_>
extends Object
implements SourcedVariableListener<Solution_>, ListVariableListener<Solution_,Object,Object>, IndexVariableSupply  
Alternative to 
IndexVariableListener.- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionExternalizedIndexVariableSupply(ListVariableDescriptor<Solution_> sourceVariableDescriptor) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidafterEntityAdded(ScoreDirector<Solution_> scoreDirector, Object entity) voidafterEntityRemoved(ScoreDirector<Solution_> scoreDirector, Object entity) voidafterListVariableChanged(ScoreDirector<Solution_> scoreDirector, Object entity, int fromIndex, int toIndex) Tells the listener that some elements within the range starting atfromIndex(inclusive) and ending attoIndex(exclusive) changed.voidafterListVariableElementUnassigned(ScoreDirector<Solution_> scoreDirector, Object element) The listener must unset all shadow variables it is responsible for when an element is unassigned from the source list variable.voidbeforeEntityAdded(ScoreDirector<Solution_> scoreDirector, Object entity) voidbeforeEntityRemoved(ScoreDirector<Solution_> scoreDirector, Object entity) voidbeforeListVariableChanged(ScoreDirector<Solution_> scoreDirector, Object entity, int fromIndex, int toIndex) Tells the listener that some elements within the range starting atfromIndex(inclusive) and ending attoIndex(exclusive) will change.voidclose()Called before thisAbstractVariableListeneris thrown away and not used anymore.GetplanningValue's index in thelist variableit is an element of.voidresetWorkingSolution(ScoreDirector<Solution_> scoreDirector) Called when the entire working solution changes.toString()
- 
Field Details- 
sourceVariableDescriptor
- 
indexMap
 
- 
- 
Constructor Details- 
ExternalizedIndexVariableSupply
 
- 
- 
Method Details- 
getSourceVariableDescriptor- Specified by:
- getSourceVariableDescriptorin interface- SourcedVariableListener<Solution_>
 
- 
resetWorkingSolutionDescription 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 interface- AbstractVariableListener<Solution_,- Object> 
- Parameters:
- scoreDirector- never null
 
- 
closepublic void close()Description copied from interface:AbstractVariableListenerCalled before thisAbstractVariableListeneris thrown away and not used anymore.- Specified by:
- closein interface- AbstractVariableListener<Solution_,- Object> 
- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
- 
beforeEntityAdded- Specified by:
- beforeEntityAddedin interface- AbstractVariableListener<Solution_,- Object> 
- Parameters:
- scoreDirector- never null
- entity- never null
 
- 
afterEntityAdded- Specified by:
- afterEntityAddedin interface- AbstractVariableListener<Solution_,- Object> 
- Parameters:
- scoreDirector- never null
- entity- never null
 
- 
afterListVariableElementUnassignedpublic void afterListVariableElementUnassigned(ScoreDirector<Solution_> scoreDirector, Object element) Description copied from interface:ListVariableListenerThe listener must unset all shadow variables it is responsible for when an element is unassigned from the source list variable. For example, aTask'sstartTimeshadow variable must be reset tonullafter a task is unassigned fromEmployee.taskswhen the move that assigned it there is undone during Construction Heuristic phase.- Specified by:
- afterListVariableElementUnassignedin interface- ListVariableListener<Solution_,- Object, - Object> 
- Parameters:
- scoreDirector- score director
- element- the unassigned element
 
- 
beforeListVariableChangedpublic void beforeListVariableChanged(ScoreDirector<Solution_> scoreDirector, Object entity, int fromIndex, int toIndex) Description copied from interface:ListVariableListenerTells the listener that some elements within the range starting atfromIndex(inclusive) and ending attoIndex(exclusive) will change. Be aware that theListVariableListener.afterListVariableChanged(org.optaplanner.core.api.score.director.ScoreDirector<Solution_>, Entity_, int, int)call after the change is done often has a differentfromIndexandtoIndexbecause the number of elements in the list variable can change.The list variable change includes: - Changing position (index) of one or more elements.
- Removing one or more elements from the list variable.
- Adding one or more elements to the list variable.
- Any mix of the above. The range has the following properties:
 fromIndexis greater than or equal to 0;toIndexis less than or equal to the list variable size.toIndexis greater than or equal tofromIndex.
- The range contains all elements that are going to be changed.
- The range may contain elements that are not going to be changed.
- The range may be empty (
fromIndexequalstoIndex) if none of the existing list variable elements are going to be changed.- Specified by:
- beforeListVariableChangedin interface- ListVariableListener<Solution_,- Object, - Object> 
- Parameters:
- scoreDirector- score director
- entity- entity with the changed list variable
- fromIndex- low endpoint (inclusive) of the changed range
- toIndex- high endpoint (exclusive) of the changed range
 
- 
afterListVariableChangedpublic void afterListVariableChanged(ScoreDirector<Solution_> scoreDirector, Object entity, int fromIndex, int toIndex) Description copied from interface:ListVariableListenerTells the listener that some elements within the range starting atfromIndex(inclusive) and ending attoIndex(exclusive) changed.The list variable change includes: - Changing position (index) of one or more elements.
- Removing one or more elements from the list variable.
- Adding one or more elements to the list variable.
- Any mix of the above. The range has the following properties:
 fromIndexis greater than or equal to 0;toIndexis less than or equal to the list variable size.toIndexis greater than or equal tofromIndex.
- The range contains all elements that have changed.
- The range may contain elements that have not changed.
- The range may be empty (
fromIndexequalstoIndex) if none of the existing list variable elements have changed.- Specified by:
- afterListVariableChangedin interface- ListVariableListener<Solution_,- Object, - Object> 
- Parameters:
- scoreDirector- score director
- entity- entity with the changed list variable
- fromIndex- low endpoint (inclusive) of the changed range
- toIndex- high endpoint (exclusive) of the changed range
 
- 
beforeEntityRemoved- Specified by:
- beforeEntityRemovedin interface- AbstractVariableListener<Solution_,- Object> 
- Parameters:
- scoreDirector- never null
- entity- never null
 
- 
afterEntityRemoved- Specified by:
- afterEntityRemovedin interface- AbstractVariableListener<Solution_,- Object> 
- Parameters:
- scoreDirector- never null
- entity- never null
 
- 
getIndexDescription copied from interface:IndexVariableSupplyGetplanningValue's index in thelist variableit is an element of.- Specified by:
- getIndexin interface- IndexVariableSupply
- Parameters:
- element- never null
- Returns:
- planningValue's index in the list variable it is an element of or- nullif the value is unassigned
 
- 
toString
 
-