The Event interface describes an interrupt style event. Each event must have access to a thread to monitor or wait for the event to occur. When it does, it queues the event to it's agent's event queue, and this agent is responsible for eventually executing its {@link casa.event.Event#fireEvent()} method which informs all observers of the event. The agents queue fits into the grand scheme of things as follows:
All events have an event type (a string that should be in the agent's ontology), which may be used by the event observers to distinguish between multiple events it is observing.
If an observer wishes to be informed of the occurrence of the event, it must implement the {@link casa.event.EventObserver} interface. The observer object must also be passed on to {@link casa.event.Event#addEventObserver(EventObserver)}. If the observer is added before {@link casa.event.Event#start()} is called, it is guaranteed to be informed of the event's occurrence. If not, there is no guarantee. When the event occurs, {@link casa.event.EventObserver#notifyEventOccurred(String,Event,Object)} is called for all registered observers.
A simple class diagram of events follows:
Copyright: Copyright (c) 2002-2008, Knowledge Science Group, University of Calgary. Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The Knowledge Science Group makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. |