public class BaseWeakReferencingObservable extends Object implements ComplexWeakReferencingObservable, Cloneable
| Constructor and Description |
|---|
BaseWeakReferencingObservable() |
| Modifier and Type | Method and Description |
|---|---|
void |
addObserver(Observer observer)
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.
|
void |
addObserver(Reference ref) |
void |
addObservers(BaseWeakReferencingObservable observable) |
void |
beginComplexNotification()
Sets the Observable in complex notification mode.
|
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.
|
Object |
clone() |
int |
countObservers()
Returns the number of observers of this object.
|
void |
deleteObserver(Observer observer)
Deletes an observer from the set of observers of this object.
|
void |
deleteObserver(Reference ref) |
void |
deleteObservers()
Clears the observer list so that this object no longer has any observers.
|
void |
disableNotifications()
Disable the notification of events to registered Observers.
|
void |
enableNotifications()
Enable (default) the notification of events to registered Observers.
|
void |
endComplexNotification()
Ends the complex notification mode.
|
protected boolean |
hasChanged()
Tests if this object has changed.
|
boolean |
inComplex() |
boolean |
isEnabledNotifications() |
protected void |
notify(WeakReferencingObservable observable,
Object notification) |
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. |
protected void |
setChanged()
Marks this DefaultObservable object as having been changed; the
hasChanged method will now return true.
|
public void addObserver(Observer observer)
addObserver in interface Observableobserver - an observer to be added.NullPointerException - if the parameter o is null.public void addObserver(Reference ref)
public void addObservers(BaseWeakReferencingObservable observable)
public void deleteObserver(Observer observer)
null to this method will have no effect.deleteObserver in interface Observableobserver - the observer to be deleted.public void deleteObserver(Reference ref)
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. 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 visit(Object obj)
throws VisitCanceledException, BaseException {
// TODO Auto-generated method stub
}
arg - any object.Observable.clearChanged(),
Observable.hasChanged(),
Observer.update(java.util.Observable, java.lang.Object)public void deleteObservers()
deleteObservers in interface Observablepublic int countObservers()
public void enableNotifications()
ComplexObservableenableNotifications in interface ComplexObservablepublic void disableNotifications()
ComplexObservabledisableNotifications in interface ComplexObservablepublic boolean isEnabledNotifications()
public boolean inComplex()
public void beginComplexNotification()
ComplexObservablebeginComplexNotification in interface ComplexObservablepublic void endComplexNotification()
ComplexObservable
If a observer is a ComplexObserver, it will be notified with a
single DefaultComplexNotification instead of each of the notifications.
Some important notes to take into account when calling this method.
Observer is processing a notification another Observer is
registered to the source Observable, it won't get any of the
notifications currently being notified, but future ones.endComplexNotification in interface ComplexObservablepublic Object clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionprotected void notify(WeakReferencingObservable observable, Object notification)
protected boolean hasChanged()
true if and only if the setChanged
method has been called more recently than the
clearChanged method on this object;
false otherwise.Observable.clearChanged(),
Observable.setChanged()protected void setChanged()
protected void clearChanged()
notifyObservers methods.