net.finmath.modelling.descriptor.AnalyticModelDescriptor Maven / Gradle / Ivy
package net.finmath.modelling.descriptor;
import java.time.LocalDate;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import net.finmath.marketdata.model.curves.Curve;
import net.finmath.marketdata.model.volatilities.VolatilitySurface;
/**
* @author Christian Fries
* @author Roland Bachl
*
*/
public class AnalyticModelDescriptor implements InterestRateModelDescriptor {
private final LocalDate referenceDate;
private final Map curvesMap;
private final Map volatilitySurfaceMap;
/**
* Construct an AnalyticModelDescriptor mapping the collections of curves and volatility surfaces provided.
*
* @param referenceDate The date corresponding to time \( t = 0 \).
* @param curves The collection of curves.
* @param surfaces The collection of volatility surfaces.
*/
public AnalyticModelDescriptor(final LocalDate referenceDate, final Collection curves, final Collection surfaces) {
super();
this.referenceDate = referenceDate;
curvesMap = new HashMap<>();
volatilitySurfaceMap = new HashMap<>();
if(curves != null) {
for(final Curve curve : curves) {
curvesMap.put(curve.getName(), curve);
}
}
if (surfaces != null) {
for (final VolatilitySurface surface : surfaces) {
volatilitySurfaceMap.put(surface.getName(), surface);
}
}
}
/**
* Construct an AnalyticModelDescriptor holding copies of the maps provided.
*
* @param referenceDate The date corresponding to time \( t = 0 \).
* @param curvesMap The map of curves.
* @param volatilitySurfaceMap The map of volatility surfaces.
*/
public AnalyticModelDescriptor(final LocalDate referenceDate, final Map curvesMap, final Map volatilitySurfaceMap) {
super();
this.referenceDate = referenceDate;
this.curvesMap = new HashMap<>();
this.volatilitySurfaceMap = new HashMap<>();
this.curvesMap.putAll(curvesMap);
this.volatilitySurfaceMap.putAll(volatilitySurfaceMap);
}
@Override
public Integer version() {
return 1;
}
@Override
public String name() {
return "Analytic model";
}
public LocalDate getReferenceDate() {
return referenceDate;
}
public Map getCurvesMap() {
return Collections.unmodifiableMap(curvesMap);
}
public Map getVolatilitySurfaceMap() {
return Collections.unmodifiableMap(volatilitySurfaceMap);
}
}