Interface MultiObservable

All Known Implementing Classes:
ActivityCore, FilterStorage, HashedStorage, IntStorage, ListStorage, ObjectStorage, ObservedCore, SortedStorage, Storage, StorageEnumerator, TreeStorage

public interface MultiObservable

Interface for observable objects. Observable object represents mutable 'data' in the model-view paradigm. Each time an observable object is changed, it calls update(this, argument) for every registered observer agent (in an unspecified order), where argument describes the occurred changes (as it must be specified for a particular object).

Ivan Maidanski
See Also:
Notifiable, ObservedCore

Method Summary
 void addObserver(Notifiable agent)
          Registers one more observer.
 void removeObserver(Notifiable agent)
          Unregisters a particular observer.

Method Detail


void addObserver(Notifiable agent)
                 throws java.lang.NullPointerException
Registers one more observer. An observer registration means that agent will be updated (notified) each time this observable object is changed somehow. Duplicate agents are not added (registered). If an exception is thrown then state of this object is not changed. Important notes: registered observers should not be accessible for other objects.

agent - the observer agent (must be non-null) to be registered.
java.lang.NullPointerException - if agent is null.
java.lang.OutOfMemoryError - if there is not enough memory.
See Also:


void removeObserver(Notifiable agent)
Unregisters a particular observer. If agent is not registered (or is null) then nothing is performed. Else the specified agent is removed from the observers list of this observable object (this action is just the opposite to the agent registration).

agent - the observer agent (may be null) to be unregistered.
See Also: