java.lang.Object
net.finmath.time.TimeDiscretizationFromArray
net.finmath.time.TenorFromArray
- All Implemented Interfaces:
Serializable
,Iterable<Double>
,Tenor
,TimeDiscretization
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
ConstructorsConstructorDescriptionTenorFromArray(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
Modifier and TypeMethodDescriptiongetDate(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.toString()
Methods inherited from class net.finmath.time.TimeDiscretizationFromArray
equals, filter, 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, getFirstTime, getLastTime
-
Constructor Details
-
TenorFromArray
- 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
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 Details
-
getReferenceDate
- Specified by:
getReferenceDate
in interfaceTenor
- Returns:
- The reference date of this tenor, i.e., the date mapped to 0.0
-
getDate
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
- Overrides:
toString
in classTimeDiscretizationFromArray
-