public IInterpolate FactoryMethod(OneDimensionInterpolation i, double[] xarr, double[] yarr) { // many more interpolators can be added in switch, this is for demonstration purposes only switch (i) { case OneDimensionInterpolation.Linear: return(new LinearInterpolator(xarr, yarr)); case OneDimensionInterpolation.LogLinear: return(new LogLinearInterpolator(xarr, yarr)); case OneDimensionInterpolation.SimpleCubic: return(new SimpleCubicInterpolator(xarr, yarr)); default: break; } return(null); }
private SortedList <double, double> DateDf; // SerialDate as Key, DF as value, used in constructor to collect data coming from PreProcessedData // Constructor public SingleCurveBuilderStandard(RateSet rateSet, OneDimensionInterpolation missingRateInterp) : base(rateSet) { // Constructor arguments // RateSet rateSet: market data input // OneDimensionInterpolation missingRateInterp: interpolation used to find missing data // it interpolates directly on markets rate // To Data Member MissingRateInterp = missingRateInterp; // 1)Prepare data to be used in Solve() (output is: PreProcessedData) PreProcessInputs(); // 2)Do Calculus: from PreProcessedData calculate post processed data (output is: DataDF) Solve(); // 3)Inizialize final Interpolator: from post processed DataDF set up final interpolator (output is: PostProcessInterpo) PostProcessData(); }