/* * @(#) MultiObservable.java - Interface for observable objects. * (c) 2000 Ivan Maidanski http://ivmai.chat.ru * Freeware class library sources. All rights reserved. ** * Language: Java [pure] * Tested with: JDK v1.1.6 * Last modified: 2000-12-13 17:15:00 GMT+03:00 */ /* * This software is the proprietary information of the author. ** * Permission to use, copy, and distribute this software and its * documentation for non-commercial purposes and without fee is * hereby granted provided that this copyright notice appears in all * copies. ** * This software should not be modified in any way; any found bug * should be reported to the author. ** * The author disclaims all warranties with regard to this software, * including all implied warranties of merchantability and fitness. * In no event shall the author be liable for any special, indirect * or consequential damages or any damages whatsoever resulting from * loss of use, data or profits, whether in an action of contract, * negligence or other tortuous action, arising out of or in * connection with the use or performance of this software. */ package ivmai.util; /** * 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). ** * @see Notifiable * @see ObservedCore ** * @version 2.0 * @author Ivan Maidanski */ public interface MultiObservable { /** * 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. ** * @param agent * the observer agent (must be non-null) to be * registered. * @exception NullPointerException * if agent is null. * @exception OutOfMemoryError * if there is not enough memory. ** * @see #removeObserver(ivmai.util.Notifiable) */ public abstract void addObserver(Notifiable agent) throws NullPointerException; /** * 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). ** * @param agent * the observer agent (may be null) to be unregistered. ** * @see #addObserver(ivmai.util.Notifiable) */ public abstract void removeObserver(Notifiable agent); }