EventCode
class Event: """An abstraction for events."""
def __init__(self, aReason, aCallback): """Construct the instance."""
self.__reason = aReason self.__callback = aCallback return
def getReason(self): """Returns the reason that the event is interested in."""
return self.__reason
def getCallback(self): """Returns the method to invoke for the event."""
return self.__callback
def execute(self, aReason): """Execute the event for the given model."""
self.getCallback().execute(aReason) return