net.sourceforge.rpgee.utility
Interface Observable<E>

All Known Subinterfaces:
NetworkMessageTransporter
All Known Implementing Classes:
BaseObservable, Client, ClientNetworkMessageTransporter, DefaultRpgMessageHandler, NetworkMessageHub, ObserverObservingThread, ServerDesktop, ServerNetworkMessageTransporter

public interface Observable<E>


Method Summary
 void addObserver(Observer o)
          Adds an observer to the set of observers for this object, provided that it is not the same as some observer already in the set.
 int countObservers()
          Returns the number of observers of this BaseObservable object.
 void deleteObserver(Observer o)
          Deletes an observer from the set of observers of this object.
 void deleteObservers()
          Clears the observer list so that this object no longer has any observers.
 boolean hasChanged()
          Tests if this object has changed.
 void notifyObservers()
          If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed.
 void notifyObservers(E arg)
          If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed.
 

Method Detail

addObserver

void addObserver(Observer o)
Adds an observer to the set of observers for this object, provided that it is not the same as some observer already in the set. The order in which notifications will be delivered to multiple observers is not specified. See the class comment.

Parameters:
o - an observer to be added.
Throws:
java.lang.NullPointerException - if the parameter o is null.

deleteObserver

void deleteObserver(Observer o)
Deletes an observer from the set of observers of this object. Passing null to this method will have no effect.

Parameters:
o - the observer to be deleted.

notifyObservers

void notifyObservers()
                     throws java.lang.Exception
If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed.

Each observer has its update method called with two arguments: this observable object and null. In other words, this method is equivalent to:

notifyObservers(null)

Throws:
java.lang.Exception
See Also:
Observable.clearChanged(), Observable.hasChanged(), Observer.update(java.util.Observable, java.lang.Object)

notifyObservers

void notifyObservers(E arg)
                     throws java.lang.Exception
If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed.

Each observer has its update method called with two arguments: this observable object and the arg argument.

Parameters:
arg - any object.
Throws:
java.lang.Exception
See Also:
Observable.clearChanged(), Observable.hasChanged(), Observer.update(java.util.Observable, java.lang.Object)

deleteObservers

void deleteObservers()
Clears the observer list so that this object no longer has any observers.


hasChanged

boolean hasChanged()
Tests if this object has changed.

Returns:
true if and only if the setChanged method has been called more recently than the clearChanged method on this object; false otherwise.
See Also:
Observable.clearChanged(), Observable.setChanged()

countObservers

int countObservers()
Returns the number of observers of this BaseObservable object.

Returns:
the number of observers of this object.


Copyright © 2006 An Infinite Number of Monkeys. All Rights Reserved.