Review FDVanillaEngine hierarchy

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

Bug Description

This issue consists on:
1. translating the missing classes;
2. review the class hierarchy and make the necessary changes on type parameters in order to properly mimic Quantlib/C++

<b>This is the basic hierarchy of FDVanillaEngine</b>
<pre>
FDVanillaEngine
 |--FDEuropeanEngine
 |--FDMultipePeriodEngine
     |--FDBermudanEngine
     |--FDDividendEngineBase
     | |--FDDividendEngineMerton73
     | | |--FDDividendEngine
     | |--FDDividenEngineShiftScale
     |-- FDStepConditionEngine
</pre>

<b>Class FDAmericanCondition derives conditionally from other classes</b>
<pre>
FDDividendEngine------------|
FDDividendEngineMerton73----|
FDDividenEngineShiftScale---|
FDStepConditionEngine-------|o---FDAmericanCondition
</pre>

<b>Class FDShoutCondition derives conditionally from other classes</b>
<pre>
FDDividendEngine------------|
FDDividendEngineMerton73----|
FDDividenEngineShiftScale---|
FDStepConditionEngine-------|o---FDShoutCondition
</pre>

Observe that class FDAmericanCondition and FDShoutCondition can accept 4 kinds of type parameters where 3 of then ultimately extend FDDividendEngineBase whilst the 4th of them can be a StepConditionEngine.

Probably the easiest way to solve this problem is:
a.1. Extract the interface from FDDividendEngineBase
a.2. Create an abstract implementation of FDDividendEngineBase
a.3. Make FDDividendEngineMerton73 and FDDividenEngineShiftScale extend this abstract implementation
a.4. FDDividendEngine remains an extension of FDDividendEngineMerton73, so no changes are required regarding this subject

b.1. Extract the interface from StepConditionEngine
b.2. Create an abstract implementation of StepConditionEngine
b.3. Make StepConditionEngine extend this abstract implementation

c.1. Change FDAmericanCondition to accept both interfaces as type parameters:
<pre>
public class FDAmericanCondition
        <T extends FDDividendEngineBase & FDStepConditionEngine>
        implements FDStepConditionEngine, FDStepConditionEngine { ... }
</pre>

d.1. Change FDShoutCondition to accept both interfaces as type parameters:
<pre>
public class FDShoutCondition
        <T extends FDDividendEngineBase & FDStepConditionEngine>
        implements FDStepConditionEngine, FDStepConditionEngine { ... }
</pre>

=============
Relationships
=============
related to http://bugs.launchpad.net/bugs/jquantlib-405
has duplicate http://bugs.launchpad.net/bugs/jquantlib-294
child of http://bugs.launchpad.net/bugs/jquantlib-394

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

At the moment class FDDividenEngineShiftScale is missing.

Revision history for this message
Richard Gomes (frgomes) wrote :

back to the pot

Revision history for this message
Richard Gomes (frgomes) wrote :

Kicked to v0.1.4

Please let me know if you have comments regarding his issue.

Thanks

Richard Gomes

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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