- java.lang.Object
-
- net.finmath.time.TimeDiscretizationFromArray
-
- net.finmath.time.TenorFromArray
-
- All Implemented Interfaces:
Serializable
,Iterable<Double>
,Tenor
,TimeDiscretization
public class TenorFromArray extends TimeDiscretizationFromArray implements Tenor
Implements a time discretization based on dates using a reference date and an daycount convention / year fraction. The time as a double is represented as the year fraction from the reference date.- Version:
- 1.0
- Author:
- Christian Fries
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.finmath.time.TimeDiscretizationFromArray
TimeDiscretizationFromArray.ShortPeriodLocation
-
-
Constructor Summary
Constructors Constructor Description TenorFromArray(double[] timeDiscretization)
Construct a tenor from a time discretization.TenorFromArray(double initial, double last, double deltaT, TimeDiscretizationFromArray.ShortPeriodLocation shortPeriodLocation)
Construct a tenor from meta data.TenorFromArray(double initial, int numberOfTimeSteps, double deltaT)
Construct a tenor from meta data.TenorFromArray(Double[] timeDiscretization)
Construct a tenor from a time discretization.TenorFromArray(LocalDate[] dates, LocalDate referenceDate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LocalDate
getDate(int timeIndex)
Returns the date for the given time index.double
getDaycountFraction(int timeIndex)
Returns the day count fraction for the period form timeIndex to to timeIndex+1.LocalDate
getReferenceDate()
String
toString()
-
Methods inherited from class net.finmath.time.TimeDiscretizationFromArray
equals, getAsArrayList, getAsDoubleArray, getNumberOfTimes, getNumberOfTimeSteps, getTickSize, getTime, getTimeIndex, getTimeIndexNearestGreaterOrEqual, getTimeIndexNearestLessOrEqual, getTimeShiftedTimeDiscretization, getTimeStep, hashCode, intersect, iterator, union
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface net.finmath.time.TimeDiscretization
doubleStream
-
-
-
-
Constructor Detail
-
TenorFromArray
public TenorFromArray(LocalDate[] dates, LocalDate referenceDate)
- Parameters:
dates
- A set of dates.referenceDate
- The reference date, which defines t=0 with respect to the internal double representation.
-
TenorFromArray
public TenorFromArray(double[] timeDiscretization)
Construct a tenor from a time discretization.- Parameters:
timeDiscretization
- A time discretization.
-
TenorFromArray
public TenorFromArray(Double[] timeDiscretization)
Construct a tenor from a time discretization.- Parameters:
timeDiscretization
- A time discretization.
-
TenorFromArray
public TenorFromArray(double initial, int numberOfTimeSteps, double deltaT)
Construct a tenor from meta data.- Parameters:
initial
- First discretization point.numberOfTimeSteps
- Number of time steps.deltaT
- Time step size.
-
TenorFromArray
public TenorFromArray(double initial, double last, double deltaT, TimeDiscretizationFromArray.ShortPeriodLocation shortPeriodLocation)
Construct a tenor from meta data.- Parameters:
initial
- First discretization point.last
- Last time steps.deltaT
- Time step size.shortPeriodLocation
- Placement of the stub period.
-
-
Method Detail
-
getReferenceDate
public LocalDate getReferenceDate()
- Specified by:
getReferenceDate
in interfaceTenor
- Returns:
- The reference date of this tenor, i.e., the date mapped to 0.0
-
getDate
public LocalDate getDate(int timeIndex)
Description copied from interface:Tenor
Returns the date for the given time index.
-
getDaycountFraction
public double getDaycountFraction(int timeIndex)
Description copied from interface:Tenor
Returns the day count fraction for the period form timeIndex to to timeIndex+1.- Specified by:
getDaycountFraction
in interfaceTenor
- Parameters:
timeIndex
- Time index- Returns:
- Returns the day count fraction.
-
toString
public String toString()
- Overrides:
toString
in classTimeDiscretizationFromArray
-
-