-
- All Superinterfaces:
Cloneable
,Serializable
- All Known Implementing Classes:
DataTableBasic
,DataTableExtrapolated
,DataTableInterpolated
,DataTableLight
,DataTableLinear
public interface DataTable extends Serializable, Cloneable
An interface for storing double values in a tenor grid. Access is provided either as int, with maturity as offset from the reference date and termination as offset from the maturity date, both with regards to the table convention, or as double, with maturity and termination being year fractions from the reference date.- Author:
- Christian Fries, Roland Bachl
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
DataTable.TableConvention
Possible conventions for the table.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description DataTable
addPoint(int maturity, int termination, double value)
Add a point to the grid of the table.DataTable
addPoints(int[] maturities, int[] terminations, double[] values)
Add an array of points to the table.DataTable
clone()
boolean
containsEntryFor(double maturity, double termination)
Checks whether the table has an actual entry at the specified coordinates.boolean
containsEntryFor(int maturity, int termination)
Checks whether the table has an actual entry at the specified coordinates.static Map<String,Object>
exportTable(DataTable table)
Provides an overview of the contents of this table as basic java objects sorted in an unmodifiable map.DataTable.TableConvention
getConvention()
Returns the convention the table understands its coordinates in.TreeSet<Integer>
getMaturities()
Get a sorted set view of all maturities in the table.TreeSet<Integer>
getMaturitiesForTermination(int termination)
Get a sorted set view of all maturities for a speceific termination in the table.String
getName()
LocalDate
getReferenceDate()
The reference date of the table.SchedulePrototype
getScheduleMetaData()
TreeSet<Integer>
getTerminations()
Get a sorted set view of all terminations in the table.TreeSet<Integer>
getTerminationsForMaturity(int maturity)
Get a sorted set view of all terminations for a specific maturity in the table.double
getValue(double maturity, double termination)
Returns the value of the table at a given time.double
getValue(int maturity, int termination)
Returns the value of the table at a given time.int
size()
-
-
-
Method Detail
-
exportTable
static Map<String,Object> exportTable(DataTable table)
Provides an overview of the contents of this table as basic java objects sorted in an unmodifiable map. Values are provided in lists, finmath components are converted to Strings.- Parameters:
table
- The table to be exported.- Returns:
- Map of the table contents.
-
addPoint
DataTable addPoint(int maturity, int termination, double value)
Add a point to the grid of the table.- Parameters:
maturity
- The maturity of the point as offset with respect to the reference date.termination
- The termination of the point as offset with respect to the maturity date.value
- The value at the point.- Returns:
- The table with the point added.
-
addPoints
DataTable addPoints(int[] maturities, int[] terminations, double[] values)
Add an array of points to the table.- Parameters:
maturities
- The maturities of the points as offset with respect to the reference date.terminations
- The terminations of the points as offset with respect to the maturity date.values
- The values at the points.- Returns:
- The table with the point added.
-
getValue
double getValue(int maturity, int termination)
Returns the value of the table at a given time. Interpolates if the table is set up to do so.- Parameters:
maturity
- The maturity as offset with respect to the reference date.termination
- The termination as offset with respect to the maturity date.- Returns:
- Value at the given time.
-
getValue
double getValue(double maturity, double termination)
Returns the value of the table at a given time. Interpolates if the table is set up to do so.- Parameters:
maturity
- Maturity in double as year fraction with respect to reference date.termination
- Termination in double as year fraction with respect to reference date.- Returns:
- Value at the given time.
-
containsEntryFor
boolean containsEntryFor(int maturity, int termination)
Checks whether the table has an actual entry at the specified coordinates. Note that even if this returns false the table may provide a value when callinggetValue
on these coordinates as the table may interpolate/extrapolate.- Parameters:
maturity
- The maturity as offset with respect to the reference date.termination
- The termination as offset with respect to the maturity date.- Returns:
- True if the table contains a data point at the coordinates, false otherwise.
-
containsEntryFor
boolean containsEntryFor(double maturity, double termination)
Checks whether the table has an actual entry at the specified coordinates. Note that even if this returns false the table may provide a value when callinggetValue
on these coordinates as the table may interpolate/extrapolate.- Parameters:
maturity
- Maturity in double as year fraction with respect to reference date.termination
- Termination in double as year fraction with respect to reference date.- Returns:
- True if the table contains a data point at the coordinates, false otherwise.
-
getMaturities
TreeSet<Integer> getMaturities()
Get a sorted set view of all maturities in the table.- Returns:
- The maturities as sorted set.
-
getTerminations
TreeSet<Integer> getTerminations()
Get a sorted set view of all terminations in the table.- Returns:
- The terminations as sorted set.
-
getTerminationsForMaturity
TreeSet<Integer> getTerminationsForMaturity(int maturity)
Get a sorted set view of all terminations for a specific maturity in the table.- Parameters:
maturity
- The maturity for which to get the terminations.- Returns:
- The terminations as sorted set.
-
getMaturitiesForTermination
TreeSet<Integer> getMaturitiesForTermination(int termination)
Get a sorted set view of all maturities for a speceific termination in the table.- Parameters:
termination
- The termination for which to get the maturities.- Returns:
- The maturities as sorted set.
-
getName
String getName()
- Returns:
- The name of the table.
-
getConvention
DataTable.TableConvention getConvention()
Returns the convention the table understands its coordinates in. As offset form the reference date.- Returns:
- The convention of the table.
-
getReferenceDate
LocalDate getReferenceDate()
The reference date of the table.- Returns:
- The reference date.
-
clone
DataTable clone()
- Returns:
- A copy of the table.
-
size
int size()
- Returns:
- The number of data points in the table.
-
getScheduleMetaData
SchedulePrototype getScheduleMetaData()
- Returns:
- The meta data as
SchedulePrototype
used by the table to convert int and double representations.
-
-