Class AbstractTermStructure
- java.lang.Object
-
- org.jquantlib.termstructures.AbstractTermStructure
-
- All Implemented Interfaces:
- Extrapolator, TermStructure, Observable, Observer
- Direct Known Subclasses:
- AbstractYieldTermStructure, CapVolatilityStructure, InflationTermStructure, SwaptionVolatilityStructure, VolatilityTermStructure
public abstract class AbstractTermStructure extends java.lang.Object implements TermStructure
Basic term-structure functionality.More Details about constructors:
There are three ways in which a term structure can keep track of its reference date:
- such date is fixed;
- such date is determined by advancing the current date of a given number of business days;
- such date is based on the reference date of some other structure.
Case 1: The constructor taking a date is to be used. The default implementation of
TermStructure.referenceDate()will then return such date.Case 2: The constructor taking a number of days and a calendar is to be used so that
TermStructure.referenceDate()will return a date calculated based on the current evaluation date and the term structure and observers will be notified when the evaluation date changes.Case 3: The
TermStructure.referenceDate()method must be overridden in derived classes so that it fetches and return the appropriate date.
-
-
Constructor Summary
Constructors Constructor and Description AbstractTermStructure()This constructor requires an override of methodTermStructure.referenceDate()in derived classes so that it fetches and return the appropriate reference date.AbstractTermStructure(Date referenceDate, Calendar calendar)Initialize with a fixed reference dateAbstractTermStructure(Date referenceDate, Calendar calendar, DayCounter dc)Initialize with a fixed reference dateAbstractTermStructure(DayCounter dc)This constructor requires an override of methodTermStructure.referenceDate()in derived classes so that it fetches and return the appropriate reference date.AbstractTermStructure(int settlementDays, Calendar calendar)Calculate the reference date based on the global evaluation dateAbstractTermStructure(int settlementDays, Calendar calendar, DayCounter dc)Calculate the reference date based on the global evaluation date
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddObserver(Observer observer)Attaches a observer to the Observable.booleanallowsExtrapolation()tells whether extrapolation is enabledCalendarcalendar()Return the calendar used for reference date calculationintcountObservers()Counts how many Observers were attached to this class.DayCounterdayCounter()Return the day counter used for date/double conversionvoiddeleteObserver(Observer observer)Detaches a previously attached observer to the observable.voiddeleteObservers()Detaches all previously attached observer to the observable.voiddisableExtrapolation()disable extrapolation in subsequent callsvoidenableExtrapolation()enable extrapolation in subsequent callsjava.util.List<Observer>getObservers()Returns list of observers registered with the Observable.doublemaxTime()Returns the latest double for which the curve can return valuesvoidnotifyObservers()Notifies all attached observers about changes in the observable.voidnotifyObservers(java.lang.Object arg)Notifies all attached observers about changes in the observable.DatereferenceDate()Returns the Date at which discount = 1.0 and/or variance = 0.0intsettlementDays()Returns the settlementDays used for reference date calculationdoubletimeFromReference(Date date)This method performs a date to double conversion which represents the fraction of the year between the reference date and the date passed as parameter.voidupdate()This method is called whenever the observed object is changed.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jquantlib.termstructures.TermStructure
maxDate
-
-
-
-
Constructor Detail
-
AbstractTermStructure
public AbstractTermStructure()
This constructor requires an override of method
TermStructure.referenceDate()in derived classes so that it fetches and return the appropriate reference date. This is the Case 3 described on the top of this class.
-
AbstractTermStructure
public AbstractTermStructure(DayCounter dc)
This constructor requires an override of method
TermStructure.referenceDate()in derived classes so that it fetches and return the appropriate reference date. This is the Case 3 described on the top of this class.
-
AbstractTermStructure
public AbstractTermStructure(Date referenceDate, Calendar calendar)
Initialize with a fixed reference dateThis constructor takes a date to be used. The default implementation of
TermStructure.referenceDate()will then return such date. This is the Case 1 described on the top of this class.
-
AbstractTermStructure
public AbstractTermStructure(Date referenceDate, Calendar calendar, DayCounter dc)
Initialize with a fixed reference dateThis constructor takes a date to be used. The default implementation of
TermStructure.referenceDate()will then return such date. This is the Case 1 described on the top of this class.
-
AbstractTermStructure
public AbstractTermStructure(int settlementDays, Calendar calendar)Calculate the reference date based on the global evaluation dateThis constructor takes a number of days and a calendar to be used so that
TermStructure.referenceDate()will return a date calculated based on the current evaluation date and the term structure. This class will be notified when the evaluation date changes. This is the Case 2 described on the top of this class.
-
AbstractTermStructure
public AbstractTermStructure(int settlementDays, Calendar calendar, DayCounter dc)Calculate the reference date based on the global evaluation dateThis constructor takes a number of days and a calendar to be used so that
TermStructure.referenceDate()will return a date calculated based on the current evaluation date and the term structure. This class will be notified when the evaluation date changes. This is the Case 2 described on the top of this class.
-
-
Method Detail
-
calendar
public Calendar calendar()
Description copied from interface:TermStructureReturn the calendar used for reference date calculation- Specified by:
calendarin interfaceTermStructure- Returns:
- the calendar used for reference date calculation
-
settlementDays
public int settlementDays()
Description copied from interface:TermStructureReturns the settlementDays used for reference date calculation- Specified by:
settlementDaysin interfaceTermStructure- Returns:
- the settlementDays used for reference date calculation
-
timeFromReference
public final double timeFromReference(Date date)
Description copied from interface:TermStructureThis method performs a date to double conversion which represents the fraction of the year between the reference date and the date passed as parameter.- Specified by:
timeFromReferencein interfaceTermStructure- Returns:
- the fraction of the year as a double
-
dayCounter
public DayCounter dayCounter()
Description copied from interface:TermStructureReturn the day counter used for date/double conversion- Specified by:
dayCounterin interfaceTermStructure- Returns:
- the day counter used for date/double conversion
-
maxTime
public double maxTime()
Description copied from interface:TermStructureReturns the latest double for which the curve can return values- Specified by:
maxTimein interfaceTermStructure- Returns:
- the latest double for which the curve can return values
-
referenceDate
public Date referenceDate()
Description copied from interface:TermStructureReturns the Date at which discount = 1.0 and/or variance = 0.0- Specified by:
referenceDatein interfaceTermStructure
-
allowsExtrapolation
public final boolean allowsExtrapolation()
Description copied from interface:Extrapolatortells whether extrapolation is enabled- Specified by:
allowsExtrapolationin interfaceExtrapolator- Returns:
-
disableExtrapolation
public void disableExtrapolation()
Description copied from interface:Extrapolatordisable extrapolation in subsequent calls- Specified by:
disableExtrapolationin interfaceExtrapolator
-
enableExtrapolation
public void enableExtrapolation()
Description copied from interface:Extrapolatorenable extrapolation in subsequent calls- Specified by:
enableExtrapolationin interfaceExtrapolator
-
update
public void update()
Description copied from interface:ObserverThis method is called whenever the observed object is changed.
-
addObserver
public 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 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 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 void notifyObservers()
Description copied from interface:ObservableNotifies all attached observers about changes in the observable.- Specified by:
notifyObserversin interfaceObservable
-
notifyObservers
public 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 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 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