java.lang.Object
net.finmath.singleswaprate.data.DataTableLight
- All Implemented Interfaces:
Serializable,Cloneable,DataTable
public class DataTableLight extends Object implements DataTable, Cloneable
A basic implementation of DataTable, which only allows access to data via int and provides no means of inter- or extrapolation.
- Author:
- Christian Fries, Roland Bachl
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.finmath.singleswaprate.data.DataTable
DataTable.TableConvention -
Constructor Summary
Constructors Constructor Description DataTableLight(String name, DataTable.TableConvention tableConvention)Create an empty table.DataTableLight(String name, DataTable.TableConvention tableConvention, int[] maturities, int[] terminations, double[] values)Create a table.DataTableLight(String name, DataTable.TableConvention tableConvention, List<Integer> maturities, List<Integer> terminations, List<Double> values)Create a table. -
Method Summary
Modifier and Type Method Description DataTableLightaddPoint(int maturity, int termination, double value)Add a point to the grid of the table.DataTableLightaddPoints(int[] maturities, int[] terminations, double[] values)Add an array of points to the table.DataTableLightclone()booleancontainsEntryFor(double maturity, double termination)Checks whether the table has an actual entry at the specified coordinates.booleancontainsEntryFor(int maturity, int termination)Checks whether the table has an actual entry at the specified coordinates.DataTable.TableConventiongetConvention()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.StringgetName()LocalDategetReferenceDate()The reference date of the table.SchedulePrototypegetScheduleMetaData()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.doublegetValue(double maturity, double termination)Returns the value of the table at a given time.doublegetValue(int maturity, int termination)Returns the value of the table at a given time.intsize()StringtoString()StringtoString(double unit)Transforms the table into a human readable String.
-
Constructor Details
-
DataTableLight
Create an empty table.- Parameters:
name- The name of the table.tableConvention- The convention of the table.
-
DataTableLight
public DataTableLight(String name, DataTable.TableConvention tableConvention, int[] maturities, int[] terminations, double[] values)Create a table.- Parameters:
name- The name of the table.tableConvention- The convention of the table.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.
-
DataTableLight
public DataTableLight(String name, DataTable.TableConvention tableConvention, List<Integer> maturities, List<Integer> terminations, List<Double> values)Create a table.- Parameters:
name- The name of the table.tableConvention- The convention of the table.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.
-
-
Method Details
-
addPoint
Description copied from interface:DataTableAdd a point to the grid of the table.- Specified by:
addPointin interfaceDataTable- 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
Description copied from interface:DataTableAdd an array of points to the table.- Specified by:
addPointsin interfaceDataTable- 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
public double getValue(int maturity, int termination)Description copied from interface:DataTableReturns the value of the table at a given time. Interpolates if the table is set up to do so. -
containsEntryFor
public boolean containsEntryFor(int maturity, int termination)Description copied from interface:DataTableChecks 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 callinggetValueon these coordinates as the table may interpolate/extrapolate.- Specified by:
containsEntryForin interfaceDataTable- 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.
-
getMaturities
Description copied from interface:DataTableGet a sorted set view of all maturities in the table.- Specified by:
getMaturitiesin interfaceDataTable- Returns:
- The maturities as sorted set.
-
getTerminations
Description copied from interface:DataTableGet a sorted set view of all terminations in the table.- Specified by:
getTerminationsin interfaceDataTable- Returns:
- The terminations as sorted set.
-
getTerminationsForMaturity
Description copied from interface:DataTableGet a sorted set view of all terminations for a specific maturity in the table.- Specified by:
getTerminationsForMaturityin interfaceDataTable- Parameters:
maturity- The maturity for which to get the terminations.- Returns:
- The terminations as sorted set.
-
getMaturitiesForTermination
Description copied from interface:DataTableGet a sorted set view of all maturities for a speceific termination in the table.- Specified by:
getMaturitiesForTerminationin interfaceDataTable- Parameters:
termination- The termination for which to get the maturities.- Returns:
- The maturities as sorted set.
-
getName
-
getConvention
Description copied from interface:DataTableReturns the convention the table understands its coordinates in. As offset form the reference date.- Specified by:
getConventionin interfaceDataTable- Returns:
- The convention of the table.
-
clone
-
toString
-
toString
Transforms the table into a human readable String.- Parameters:
unit- A value with which each entry of the table is multiplied before displaying.- Returns:
- A String representation of the table.
-
size
public int size() -
getValue
public double getValue(double maturity, double termination)Description copied from interface:DataTableReturns the value of the table at a given time. Interpolates if the table is set up to do so. -
containsEntryFor
public boolean containsEntryFor(double maturity, double termination)Description copied from interface:DataTableChecks 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 callinggetValueon these coordinates as the table may interpolate/extrapolate.- Specified by:
containsEntryForin interfaceDataTable- 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.
-
getReferenceDate
Description copied from interface:DataTableThe reference date of the table.- Specified by:
getReferenceDatein interfaceDataTable- Returns:
- The reference date.
-
getScheduleMetaData
- Specified by:
getScheduleMetaDatain interfaceDataTable- Returns:
- The meta data as
SchedulePrototypeused by the table to convert int and double representations.
-