Rewrite FDEngineAdapter

Bug #1209892 reported by Richard Gomes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
JQuantLib
New
Medium
Unassigned

Bug Description

<b>In QuantLib/C++, FDEngineAdapter is defined as</b>

<pre>
    template <typename base, typename engine>
    class FDEngineAdapter : public base, public engine { ... }
</pre>

<b>where</b>
    * base ultimately extends FDVanillaEngine::engine
    * engine ultimately extends OneAssetOption::engine

<b>and employed as examples below:</b>

<pre>
typedef FDEngineAdapter
    <FDShoutCondition<FDStepConditionEngine>, VanillaOption::engine>
FDShoutEngine;

typedef FDEngineAdapter
    <FDAmericanCondition<FDStepConditionEngine>, OneAssetOption::engine>
FDAmericanEngine;

typedef FDEngineAdapter
    <FDDividendEngine, DividendVanillaOption::engine>
FDDividendEuropeanEngine;

typedef FDEngineAdapter
    <FDDividendEngineMerton73, DividendVanillaOption::engine>
FDDividendEuropeanEngineMerton73;

typedef FDEngineAdapter
    <FDDividendEngineShiftScale, DividendVanillaOption::engine>
FDDividendEuropeanEngineShiftScale;
</pre>

<b>Note:</b>
 * Template parameter "base" maybe a simple class or a parameterized class.

<b>Translating to Java</b>
When we translate to Java, we should <i>probably</i> translate like this:

<pre>
public class FDEngineAdapter
    <Base extends FDVanillaEngine, Engine extends OneAssetOption.Engine>
    implements OneAssetOption.Engine { ... }
</pre>

and inside our implementation of FDEngineAdapter we should be able to accept Base as both a simple class and also a parameterized class.

Suggestion: Employ TypeTokenTree to help sort our generic parameters.

=============
Relationships
=============
duplicate of http://bugs.launchpad.net/bugs/jquantlib-229
related to http://bugs.launchpad.net/bugs/jquantlib-425
child of http://bugs.launchpad.net/bugs/jquantlib-394

Tags: code-review
Revision history for this message
Richard Gomes (frgomes) wrote :

At the moment the following classes are missing:
    FDDividendEuropeanEngineMerton73
    FDDividendEuropeanEngineShiftScale

Some code review was done in classes
    FDEngineAdapter
    FDAmericanEngine
    FDShoutEngine
    FDAmericanEngine
    FDDividendEuropeanEngine
    FDDividendEuropeanEngineMerton73
    FDDividendEuropeanEngineShiftScale

See related issue #425 in order to know more details about what is still pending.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.