JQuantLib v0.1.2-SNAPSHOT API Javadocs

org.jquantlib.util
Interface Observable

Package class diagram package Observable
All Known Subinterfaces:
Date, PricingEngine
All Known Implementing Classes:
AnalyticContinuousGeometricAveragePriceasianEngine, AnalyticDiscreteGeometricAveragePriceAsianEngine, AnalyticEuropeanEngine, BaseDate, BjerksundStenslandApproximationEngine, BlackConstantVol, BlackScholesMertonProcess, BlackVarianceCurve, BlackVarianceSurface, BlackVarianceTermStructure, BlackVolatilityTermStructure, BlackVolTermStructure, Bond, CashFlow, ContinuousAveragingAsianOption, ContinuousAveragingAsianOptionEngine, DefaultDate, DefaultObservable, DepositRateHelper, DiscreteAveragingAsianOption, DiscreteAveragingAsianOptionEngine, Euribor, Euribor.DailyTenorEuribor, Euribor.DailyTenorEuribor365, Euribor.Euribor365, EuropeanOption, Event, FixedRateBondHelper, FlatForward, ForwardRateStructure, FraRateHelper, FuturesRateHelper, GeneralizedBlackScholesProcess, GenericEngine, Handle, Handle.Link, IborIndex, ImpliedTermStructure, ImpliedVolTermStructure, Index, Instrument, IntegralEngine, InterestRateIndex, InterpolatedDiscountCurve, InterpolatedForwardCurve, InterpolatedZeroCurve, LazyObject, LocalConstantVol, LocalVolCurve, LocalVolSurface, LocalVolTermStructure, NewInstrument, ObservableValue, OldInstrument, OneAssetOption, OneAssetOptionEngine, OneAssetStrikedOption, OneAssetStrikedOptionEngine, Option, PiecewiseYieldDiscountCurve, PiecewiseYieldDiscountCurve.PiecewiseYieldLazyCurve, Quote, RateHelper, RelativeDateRateHelper, RelinkableHandle, SimpleQuote, StochasticProcess, StochasticProcess1D, Stock, SwapRateHelper, TermStructure, VanillaOption, VanillaOptionEngine, WeakReferenceObservable, YieldTermStructure, ZeroYieldStructure

public interface Observable

This interface is intended to provide more flexibility to complex object models when multiple inheritance is needed.

By providing Observable as an interface, instead of the JDK'a Observable class, client classes have the option to mimic multiple inheritance by means of a delegate pattern which uses an inner private class which implements this interface.

This class is based on the work done by Martin Fischer, with only minor changes. See references below.

Author:
Martin Fischer (original author), Richard Gomes
See Also:
Martin Fischer: Observer and Observable interfaces, Improved Observer/Observable

Method Summary
 void addObserver(Observer observer)
          Attaches a observer to the Observable.
 int countObservers()
          Counts how many Observers were attached to this class.
 void deleteObserver(Observer observer)
          Detaches a previously attached observer to the observable.
 void deleteObservers()
          Detaches all previously attached observer to the observable.
 java.util.List<Observer> getObservers()
          Returns list of observers registered with the Observable.
 void notifyObservers()
          Notifies all attached observers about changes in the observable.
 void notifyObservers(java.lang.Object arg)
          Notifies all attached observers about changes in the observable.
 

Method Detail

addObserver

void addObserver(Observer observer)
Attaches a observer to the Observable. After attachment the observer gets informed about changes in the Observable.

Parameters:
observer - The observer to attach to the observable

countObservers

int countObservers()
Counts how many Observers were attached to this class.

Returns:
the number of Observers
See Also:
Observer

getObservers

java.util.List<Observer> getObservers()
Returns list of observers registered with the Observable. List returned is unmodifiable list.

Returns:
list of observers

deleteObserver

void deleteObserver(Observer observer)
Detaches a previously attached observer to the observable. After detachment the observer does no longer receive change notifications from the observable.

Parameters:
observer - The observer to detach from the observable

deleteObservers

void deleteObservers()
Detaches all previously attached observer to the observable. After detachment observers do not longer receive change notifications from the observable.


notifyObservers

void notifyObservers()
Notifies all attached observers about changes in the observable.


notifyObservers

void notifyObservers(java.lang.Object arg)
Notifies all attached observers about changes in the observable.

Parameters:
arg - an arbitrary Object to be passed to the Observer

JQuantLib v0.1.2-SNAPSHOT API Javadocs

Submit a bug or feature

JQuantLib is free software: you can redistribute it and/or modify it under the terms of the QuantLib license. You should have received a copy of the license along with this program; if not, please email mailto:jquant-devel@lists.sourceforge.net. The license is also available online at http://www.jquantlib.org/index.php/LICENSE.TXT.