public class WeakObservable extends Observable
WeakObservable class.
| Constructor and Description |
|---|
WeakObservable()
Constructor for WeakObservable.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
protected 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,
so that the hasChanged method will now return false.
|
int |
countObservers()
Returns the number of observers of this Observable 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(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()
Marks this Observable object as having been changed; the
hasChanged method will now return true.
|
public void addObserver(Observer o)
addObserver in class Observablepublic void deleteObserver(Observer o)
null to this method will have no effect.deleteObserver in class Observablepublic 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. In other
words, this method is equivalent to:
notifyObservers(null)
public void notifyObservers(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.
public void deleteObservers()
deleteObservers in class Observablepublic void setChanged()
setChanged in class Observableprotected void clearChanged()
notifyObservers methods.public boolean hasChanged()
hasChanged in class ObservableObservable.clearChanged(),
Observable.setChanged(),
Observable.clearChanged(),
Observable.setChanged()public int countObservers()
countObservers in class ObservableCopyright © 2016. All Rights Reserved.