Class StoreQueryMaturityConverter
- java.lang.Object
-
- com.activeviam.risk.core.dates.impl.StoreQueryMaturityConverter
-
- All Implemented Interfaces:
IMaturityConverter
public class StoreQueryMaturityConverter extends Object implements IMaturityConverter
Implementation of a maturity converter that queries a store for the number of days represented by a tenor. (does not include support for support business day convention or calendar).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StoreQueryMaturityConverter.StoreDescription
-
Constructor Summary
Constructors Constructor Description StoreQueryMaturityConverter(Map<BucketType,StoreQueryMaturityConverter.StoreDescription> storeDescriptionMap, IMaturityConverter backupMaturityConverter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.quartetfs.biz.pivot.query.IQueryCache
getQueryCache(com.quartetfs.biz.pivot.IActivePivot pivot)
Return the query cache bound to the current query.LocalDate
toDate(com.quartetfs.biz.pivot.IActivePivot pivot, LocalDate asOfDate, BucketType bucketType, String tenorSet, String tenorOrDate, List<Object> leafCoordinates)
Convert tenorOrDate to a LocalDate.double
toFraction(com.quartetfs.biz.pivot.IActivePivot pivot, LocalDate asOfDate, BucketType bucketType, String tenorSet, String tenorOrDate, List<Object> leafCoordinates)
Calculate the days between the asOfDate and the tenorOrDate.
-
-
-
Constructor Detail
-
StoreQueryMaturityConverter
public StoreQueryMaturityConverter(Map<BucketType,StoreQueryMaturityConverter.StoreDescription> storeDescriptionMap, IMaturityConverter backupMaturityConverter)
-
-
Method Detail
-
getQueryCache
protected com.quartetfs.biz.pivot.query.IQueryCache getQueryCache(com.quartetfs.biz.pivot.IActivePivot pivot)
Return the query cache bound to the current query. This cache contains values that can be shared among post processors involved in a query. The values in this cache are never shared with other queries.The query cache itself is thread-safe, actually implementing the concurrent map interface.
- Parameters:
pivot
- ActivePivot instance- Returns:
- current query cache, it is never null
-
toFraction
public double toFraction(com.quartetfs.biz.pivot.IActivePivot pivot, LocalDate asOfDate, BucketType bucketType, String tenorSet, String tenorOrDate, List<Object> leafCoordinates)
Calculate the days between the asOfDate and the tenorOrDate. Extra parameters are required for query-time conversion.- Specified by:
toFraction
in interfaceIMaturityConverter
- Parameters:
pivot
- The ActivePivot instance.asOfDate
- The initial as-of-date.tenorSet
- The tenor set.tenorOrDate
- The String representation of a tenor or number of days.leafCoordinates
- Leaf coordinates required for query-time conversion.bucketType
- The tenor store.- Returns:
- a long representing a number of days
-
toDate
public LocalDate toDate(com.quartetfs.biz.pivot.IActivePivot pivot, LocalDate asOfDate, BucketType bucketType, String tenorSet, String tenorOrDate, List<Object> leafCoordinates)
Convert tenorOrDate to a LocalDate. Extra parameters are required for query-time conversion. The toFraction method is used to compute the number of days between tenorOrDate and asOfDate. That method returns a double value that is floored so that it represents a long value and not a double.- Specified by:
toDate
in interfaceIMaturityConverter
- Parameters:
pivot
- The ActivePivot instance.asOfDate
- The initial as-of-date, for use with tenors.tenorSet
- The tenor set.tenorOrDate
- The String representation of a tenor or date.leafCoordinates
- Leaf coordinates required for query-time conversion.bucketType
- The tenor store.- Returns:
- The LocalDate represented by tenorOrDate.
-
-