public class ResponseObservable extends Object
| Constructor and Description |
|---|
ResponseObservable() |
| Modifier and Type | Method and Description |
|---|---|
void |
addObservers(ResponseObserver ro)
Adds an observer to the Map of responseObservers for this response, 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(ResponseObserver ro)
Deletes an observer from a map of observers of this object.
|
boolean |
hasChanged()
Tests if this object has changed.
|
<T extends AbstractResponse> |
notifyObservers(T r)
If this object has changed, as indicated by the
hasChanged method, then find and notify only one Observer
and then call the clearChanged method to indicate
that this object has no longer changed. |
protected void |
setChanged()
Marks this Observable object as having been changed; the
hasChanged method will now return true.
|
public void addObservers(ResponseObserver ro)
ro - responseObserver to be addedNullPointerException - non-null observersIllegalStateException - unique requestspublic void deleteObserver(ResponseObserver ro)
null to this method will have no effect.ro - the observer to be deleted.public <T extends AbstractResponse> void notifyObservers(T r)
hasChanged method, then find and notify only one Observer
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 r argument.
T - typer - any child object of AbstractResponse.clearChanged(),
hasChanged(),
ResponseObserver.applyResponse(ResponseObservable, AbstractResponse)protected void setChanged()
protected void clearChanged()
notifyObservers methods.public boolean hasChanged()
true if and only if the setChanged
method has been called more recently than the
clearChanged method on this object;
false otherwise.clearChanged(),
setChanged()public int countObservers()
Copyright © 2016. All rights reserved.