THE PACKAGE JAVA.UTIL
java.util.Observable
21.7
21.7 The Class
java.util.Observable
Each instance of class
Observable
maintains a set of observers that are notified
whenever the
Observable
object changes in some significant way. An observer
may be any object that implements interface
Observer
( 21.8).
Note that this notification mechanism is has nothing to do with threads
( 20.20) and is completely separate from the
wait
and
notify
mechanism of
class
Object
( 20.1).
public class Observable {
public void addObserver(Observer o);
public void deleteObserver(Observer o);
public void deleteObservers();
public int countObservers();
public void notifyObservers();
public void notifyObservers(Object arg);
protected void setChanged();
protected void clearChanged();
public boolean hasChanged();
}
When an observable object is newly created, its set of observers is empty.
Two observers are considered the same if and only if the
equals
method
( 20.1.3) returns
true
for them.
21.7.1
public void addObserver(Observer o)
The observer
o
is added to this
Observable
object's set of observers, provided
that it is not the same as some observer already in the set.
21.7.2
public void deleteObserver(Observer o)
The observer
o
is removed from this
Observable
object's set of observers.
21.7.3
public void deleteObservers()
All observers are removed from this
Observable
object's set of observers.
21.7.4
public int countObservers()
The number of observers in this
Observable
object's set of observers is returned.
643
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved