|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--infosapient.system.ObservableImpl
This class represents an observable object, or "data" in the model-view paradigm.
An observable object can have one or more observers. After an
observable instance changes, an application calling the
Observable
's notifyObservers
method
causes all of its observers to be notified of the change by a call
to their update
method.
Field Summary | |
private Observer[] |
arr
|
private boolean |
changed
|
private java.util.Vector |
obs
|
(package private) static long |
serialVersionUID
|
Constructor Summary | |
ObservableImpl()
Construct an Observable with zero Observers |
Method Summary | |
void |
addObserver(Observer o)
Adds an observer to the set of observers for this object. |
void |
clearChanged()
Indicates that this object has no longer changed, or that it has already notified all of its observers of its most recent change. |
boolean |
containsObserver(Observer o)
Test if the Observer exists within the list of observers of this object. |
int |
countObservers()
Returns the number of observers of this 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(java.lang.Object 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. |
void |
setChanged()
Indicates that this object has changed. |
Methods inherited from class java.lang.Object |
|
Field Detail |
static final long serialVersionUID
private boolean changed
private java.util.Vector obs
private Observer[] arr
Constructor Detail |
public ObservableImpl()
Method Detail |
public void addObserver(Observer o)
o
- an observer to be added.public void clearChanged()
notifyObservers
methods.infosapient.system.Observable#notifyObservers()
,
Observable.notifyObservers(java.lang.Object)
public boolean containsObserver(Observer o)
the
- object to be tested.true
if the object exists within the list of observers;
else false
public int countObservers()
public void deleteObserver(Observer o)
o
- the observer to be deleted.public void deleteObservers()
public boolean hasChanged()
true
if the setChanged
method
has been called more recently than the clearChanged
method on this object; false
otherwise.Observable.clearChanged()
,
Observable.setChanged()
public void notifyObservers()
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
.
Observable.clearChanged()
,
Observable.hasChanged()
,
Observer.update(infosapient.system.Observable, java.lang.Object)
public void notifyObservers(java.lang.Object arg)
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.
arg
- any object.Observable.clearChanged()
,
Observable.hasChanged()
,
Observer.update(infosapient.system.Observable, java.lang.Object)
public void setChanged()
|
License to use this program is provided under the TERMS OF THE COMMON PUBLIC LICENSE 0.5. ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |