org.jquantlib.quotes
Class Handle<T extends Observable>
- java.lang.Object
-
- org.jquantlib.quotes.Handle<T>
-
- All Implemented Interfaces:
- Observable
- Direct Known Subclasses:
- RelinkableHandle
public class Handle<T extends Observable> extends java.lang.Object implements Observable
Shared handle to an observableAll copies of an instance of this class refer to the same observable by means of a relinkable weak reference. When such pointer is relinked to another observable, the change will be propagated to all the copies.
-
-
Constructor Summary
Constructors Constructor and Description Handle()Handle(T observable)Handle(T observable, boolean registerAsObserver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddObserver(Observer observer)Attaches a observer to the Observable.intcountObservers()Counts how many Observers were attached to this class.TcurrentLink()voiddeleteObserver(Observer observer)Detaches a previously attached observer to the observable.voiddeleteObservers()Detaches all previously attached observer to the observable.booleanempty()java.util.List<Observer>getObservers()Returns list of observers registered with the Observable.voidlinkTo(T observable)voidlinkTo(T observable, boolean registerAsObserver)voidnotifyObservers()Notifies all attached observers about changes in the observable.voidnotifyObservers(java.lang.Object arg)Notifies all attached observers about changes in the observable.java.lang.StringtoString()
-
-
-
Constructor Detail
-
Handle
public Handle()
-
Handle
public Handle(T observable)
-
Handle
public Handle(T observable, boolean registerAsObserver)
-
-
Method Detail
-
empty
public final boolean empty()
-
currentLink
public final T currentLink()
-
linkTo
public void linkTo(T observable)
-
linkTo
public void linkTo(T observable, boolean registerAsObserver)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
addObserver
public final void addObserver(Observer observer)
Description copied from interface:ObservableAttaches a observer to the Observable. After attachment the observer gets informed about changes in the Observable.- Specified by:
addObserverin interfaceObservable- Parameters:
observer- The observer to attach to the observable
-
countObservers
public final int countObservers()
Description copied from interface:ObservableCounts how many Observers were attached to this class.- Specified by:
countObserversin interfaceObservable- Returns:
- the number of Observers
- See Also:
Observer
-
deleteObserver
public final void deleteObserver(Observer observer)
Description copied from interface:ObservableDetaches a previously attached observer to the observable. After detachment the observer does no longer receive change notifications from the observable.- Specified by:
deleteObserverin interfaceObservable- Parameters:
observer- The observer to detach from the observable
-
notifyObservers
public final void notifyObservers()
Description copied from interface:ObservableNotifies all attached observers about changes in the observable.- Specified by:
notifyObserversin interfaceObservable
-
notifyObservers
public final void notifyObservers(java.lang.Object arg)
Description copied from interface:ObservableNotifies all attached observers about changes in the observable.- Specified by:
notifyObserversin interfaceObservable- Parameters:
arg- an arbitrary Object to be passed to the Observer
-
deleteObservers
public final void deleteObservers()
Description copied from interface:ObservableDetaches all previously attached observer to the observable. After detachment observers do not longer receive change notifications from the observable.- Specified by:
deleteObserversin interfaceObservable
-
getObservers
public final java.util.List<Observer> getObservers()
Description copied from interface:ObservableReturns list of observers registered with the Observable. List returned is unmodifiable list.- Specified by:
getObserversin interfaceObservable- Returns:
- list of observers
-
-
DataMelt 3.0 © DataMelt by jWork.ORG