sure, please let me know if you are looking for anything specific
times
is an object of class MJArray. MJArray is a class that's based on the STL
<valarray>
. Its purpose is to store the reset times for when barrier events are tested. Hence it is an argument to barrierOption.
Declaration and definition for MJArray below (although times is confirmed to work in other objects which are a child of base class PathDependent).
Header
1 2 3 4 5 6 7
|
/* ... */
class MJArray
{
public:
explicit MJArray(unsigned long size=0);
MJArray(const MJArray& original);
/* ... */
|
Source
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
MJArray::MJArray(unsigned long size)
{
Size = size;
Capacity = size;
if (Size>0)
{
ValuesPtr = new double[size];
EndPtr = ValuesPtr;
EndPtr += size;
}
else
{
ValuesPtr = 0;
EndPtr = 0;
}
}
MJArray::MJArray(const MJArray& original)
{
Size = original.Size;
Capacity = original.Size;
if (Size>0)
{
ValuesPtr = new double[Size];
EndPtr = ValuesPtr;
EndPtr += Size;
std::copy(original.ValuesPtr, original.EndPtr, ValuesPtr);
}
else
{
ValuesPtr = EndPtr =0;
}
}
|
barrierOption
is an object of class PathDependentBarrier. Its constructor is written to take the following arguments:
- an MJArray object (by reference)
- PayOff object (by reference)
- OptionType argument (enumerated within class PathDependentBarrier)
- and 2 x double arguments
the definition for PathDependentBarrier constructor (declaration as above) is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
PathDependentBarrier::PathDependentBarrier(
const MJArray& LookAtTimes_,
PayOffBridge& ThePayOff_,
OptionType TheOptionType_,
double Barrier_,
double Rebate_)
: PathDependent(LookAtTimes_),
ThePayOff(ThePayOff_),
TheOptionType(TheOptionType_),
Barrier(Barrier_),
Rebate(Rebate_),
NumberOfTimes(LookAtTimes_.size())
{
}
|