Interface VariableDescriptorAwareScoreDirector<Solution_>

All Superinterfaces:
ScoreDirector<Solution_>
All Known Subinterfaces:
InnerScoreDirector<Solution_,Score_>, RevertableScoreDirector<Solution_>
All Known Implementing Classes:
AbstractScoreDirector, BavetConstraintStreamScoreDirector, EasyScoreDirector, IncrementalScoreDirector, VariableChangeRecordingScoreDirector

public interface VariableDescriptorAwareScoreDirector<Solution_> extends ScoreDirector<Solution_>
  • Method Details

    • getSolutionDescriptor

      SolutionDescriptor<Solution_> getSolutionDescriptor()
    • beforeVariableChanged

      void beforeVariableChanged(VariableDescriptor<Solution_> variableDescriptor, Object entity)
    • afterVariableChanged

      void afterVariableChanged(VariableDescriptor<Solution_> variableDescriptor, Object entity)
    • changeVariableFacade

      default void changeVariableFacade(VariableDescriptor<Solution_> variableDescriptor, Object entity, Object newValue)
    • beforeListVariableElementAssigned

      void beforeListVariableElementAssigned(ListVariableDescriptor<Solution_> variableDescriptor, Object element)
      Call this for each element that will be assigned (added to a list variable of one entity without being removed from a list variable of another entity).
      Parameters:
      variableDescriptor - the list variable descriptor
      element - the assigned element
    • afterListVariableElementAssigned

      void afterListVariableElementAssigned(ListVariableDescriptor<Solution_> variableDescriptor, Object element)
      Call this for each element that was assigned (added to a list variable of one entity without being removed from a list variable of another entity).
      Parameters:
      variableDescriptor - the list variable descriptor
      element - the assigned element
    • beforeListVariableElementUnassigned

      void beforeListVariableElementUnassigned(ListVariableDescriptor<Solution_> variableDescriptor, Object element)
      Call this for each element that will be unassigned (removed from a list variable of one entity without being added to a list variable of another entity).
      Parameters:
      variableDescriptor - the list variable descriptor
      element - the unassigned element
    • afterListVariableElementUnassigned

      void afterListVariableElementUnassigned(ListVariableDescriptor<Solution_> variableDescriptor, Object element)
      Call this for each element that was unassigned (removed from a list variable of one entity without being added to a list variable of another entity).
      Parameters:
      variableDescriptor - the list variable descriptor
      element - the unassigned element
    • beforeListVariableChanged

      void beforeListVariableChanged(ListVariableDescriptor<Solution_> variableDescriptor, Object entity, int fromIndex, int toIndex)
      Notify the score director before a list variable changes.

      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.
      For the sake of variable listeners' efficiency, the change notification requires an index range that contains elements affected by the change. The range starts at fromIndex (inclusive) and ends at toIndex (exclusive).

      The range has to comply with the following contract:

      1. fromIndex must be greater than or equal to 0; toIndex must be less than or equal to the list variable size.
      2. toIndex must be greater than or equal to fromIndex.
      3. The range must contain all elements that are going to be changed.
      4. The range is allowed to contain elements that are not going to be changed.
      5. The range may be empty (fromIndex equals toIndex) if none of the existing list variable elements are going to be changed.

      beforeListVariableElementUnassigned(ListVariableDescriptor, Object) must be called for each element that will be unassigned (removed from a list variable of one entity without being added to a list variable of another entity).

      Parameters:
      variableDescriptor - descriptor of the list variable being changed
      entity - the entity owning the list variable being changed
      fromIndex - low endpoint (inclusive) of the changed range
      toIndex - high endpoint (exclusive) of the changed range
    • afterListVariableChanged

      void afterListVariableChanged(ListVariableDescriptor<Solution_> variableDescriptor, Object entity, int fromIndex, int toIndex)
      Notify the score director after a list variable changes.

      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.
      For the sake of variable listeners' efficiency, the change notification requires an index range that contains elements affected by the change. The range starts at fromIndex (inclusive) and ends at toIndex (exclusive).

      The range has to comply with the following contract:

      1. fromIndex must be greater than or equal to 0; toIndex must be less than or equal to the list variable size.
      2. toIndex must be greater than or equal to fromIndex.
      3. The range must contain all elements that have changed.
      4. The range is allowed to contain elements that have not changed.
      5. The range may be empty (fromIndex equals toIndex) if none of the existing list variable elements have changed.

      afterListVariableElementUnassigned(ListVariableDescriptor, Object) must be called for each element that was unassigned (removed from a list variable of one entity without being added to a list variable of another entity).

      Parameters:
      variableDescriptor - descriptor of the list variable being changed
      entity - the entity owning the list variable being changed
      fromIndex - low endpoint (inclusive) of the changed range
      toIndex - high endpoint (exclusive) of the changed range
    • getVariableDescriptorCache

      VariableDescriptorCache<Solution_> getVariableDescriptorCache()
    • beforeVariableChanged

      default void beforeVariableChanged(Object entity, String variableName)
      Specified by:
      beforeVariableChanged in interface ScoreDirector<Solution_>
    • afterVariableChanged

      default void afterVariableChanged(Object entity, String variableName)
      Specified by:
      afterVariableChanged in interface ScoreDirector<Solution_>
    • beforeListVariableElementAssigned

      default void beforeListVariableElementAssigned(Object entity, String variableName, Object element)
      Specified by:
      beforeListVariableElementAssigned in interface ScoreDirector<Solution_>
    • afterListVariableElementAssigned

      default void afterListVariableElementAssigned(Object entity, String variableName, Object element)
      Specified by:
      afterListVariableElementAssigned in interface ScoreDirector<Solution_>
    • beforeListVariableElementUnassigned

      default void beforeListVariableElementUnassigned(Object entity, String variableName, Object element)
      Specified by:
      beforeListVariableElementUnassigned in interface ScoreDirector<Solution_>
    • afterListVariableElementUnassigned

      default void afterListVariableElementUnassigned(Object entity, String variableName, Object element)
      Specified by:
      afterListVariableElementUnassigned in interface ScoreDirector<Solution_>
    • beforeListVariableChanged

      default void beforeListVariableChanged(Object entity, String variableName, int fromIndex, int toIndex)
      Specified by:
      beforeListVariableChanged in interface ScoreDirector<Solution_>
    • afterListVariableChanged

      default void afterListVariableChanged(Object entity, String variableName, int fromIndex, int toIndex)
      Specified by:
      afterListVariableChanged in interface ScoreDirector<Solution_>