This repository has been archived by the owner on Jul 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Implement VariableListener using base classes instead of decor…
…ators - Made all methods as optional, since 99% of the time, they do nothing
- Loading branch information
1 parent
45132a1
commit bd011c1
Showing
7 changed files
with
208 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
timefold-solver-python-core/src/main/python/api/_score_director.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
class ScoreDirector: | ||
def __init__(self, delegate): | ||
self._delegate = delegate | ||
|
||
def after_entity_added(self, entity) -> None: | ||
self._delegate.afterEntityAdded(entity) | ||
|
||
def after_entity_removed(self, entity) -> None: | ||
self._delegate.afterEntityRemoved(entity) | ||
|
||
def after_list_variable_changed(self, entity, variable_name: str, start: int, end: int) -> None: | ||
self._delegate.afterListVariableChanged(entity, variable_name, start, end) | ||
|
||
def after_list_variable_element_assigned(self, entity, variable_name: str, element) -> None: | ||
self._delegate.afterListVariableElementAssigned(entity, variable_name, element) | ||
|
||
def after_list_variable_element_unassigned(self, entity, variable_name: str, element) -> None: | ||
self._delegate.afterListVariableElementUnassigned(entity, variable_name, element) | ||
|
||
def after_problem_fact_added(self, entity) -> None: | ||
self._delegate.afterProblemFactAdded(entity) | ||
|
||
def after_problem_fact_removed(self, entity) -> None: | ||
self._delegate.afterProblemFactRemoved(entity) | ||
|
||
def after_problem_property_changed(self, entity) -> None: | ||
self._delegate.afterProblemPropertyChanged(entity) | ||
|
||
def after_variable_changed(self, entity, variable_name: str) -> None: | ||
self._delegate.afterVariableChanged(entity, variable_name) | ||
|
||
def before_entity_added(self, entity) -> None: | ||
self._delegate.beforeEntityAdded(entity) | ||
|
||
def before_entity_removed(self, entity) -> None: | ||
self._delegate.beforeEntityRemoved(entity) | ||
|
||
def before_list_variable_changed(self, entity, variable_name: str, start: int, end: int) -> None: | ||
self._delegate.beforeListVariableChanged(entity, variable_name, start, end) | ||
|
||
def before_list_variable_element_assigned(self, entity, variable_name: str, element) -> None: | ||
self._delegate.beforeListVariableElementAssigned(entity, variable_name, element) | ||
|
||
def before_list_variable_element_unassigned(self, entity, variable_name: str, element) -> None: | ||
self._delegate.beforeListVariableElementUnassigned(entity, variable_name, element) | ||
|
||
def before_problem_fact_added(self, entity) -> None: | ||
self._delegate.beforeProblemFactAdded(entity) | ||
|
||
def before_problem_fact_removed(self, entity) -> None: | ||
self._delegate.beforeProblemFactRemoved(entity) | ||
|
||
def before_problem_property_changed(self, entity) -> None: | ||
self._delegate.beforeProblemPropertyChanged(entity) | ||
|
||
def before_variable_changed(self, entity, variable_name: str) -> None: | ||
self._delegate.beforeVariableChanged(entity, variable_name) | ||
|
||
def get_working_solution(self): | ||
return self._delegate.getWorkingSolution() | ||
|
||
def look_up_working_object(self, working_object): | ||
return self._delegate.lookUpWorkingObject(working_object) | ||
|
||
def look_up_working_object_or_return_none(self, working_object): | ||
return self._delegate.lookUpWorkingObject(working_object) | ||
|
||
def trigger_variable_listeners(self) -> None: | ||
self._delegate.triggerVariableListeners() | ||
|
||
|
||
__all__ = ['ScoreDirector'] |
Oops, something went wrong.