Re-factor org.jquantlib.time.Period class to match with QL097, implement all operator methods
Bug #1209858 reported by
Zahid Hussain
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
JQuantLib |
Fix Released
|
Medium
|
Richard Gomes |
Bug Description
Many operator related methods are missing in org.jquantlib.
Example:
C++:
inline Period operator-(const Period& p) {
return Period(
}
This function simply creates a new instances using passed Period.
I don't see any equivalent method in Java. However, there is a minus() method but it uses instances variables.
public Period minus() {
return new Period(
}
Note: many operator related methods in Period are required to implement Schedule.java
=============
Relationships
=============
child of http://
To post a comment you must log in.
Ideally, we should mimic QuantLib/C++ API as close as possible. ------- ------- ------- ---
Below you can see an skeleton produced by our Python script:
-------
public class Period {
//
// private fields
//
private int length_;
private TimeUnit units_;
//
// public methods
//
public Period() { ationException( );
throw new UnsupportedOper
}
public Period(int n, TimeUnit units) { ationException( );
throw new UnsupportedOper
}
public Period(Frequency f) { ationException( );
throw new UnsupportedOper
}
public int length() /* @ReadOnly */ { ationException( );
throw new UnsupportedOper
}
public TimeUnit units() /* @ReadOnly */ { ationException( );
throw new UnsupportedOper
}
public Frequency frequency() /* @ReadOnly */ { ationException( );
throw new UnsupportedOper
}
public Period addAssign(final Period p) { ationException( );
throw new UnsupportedOper
}
public Period subAssign(final Period p) { ationException( );
throw new UnsupportedOper
}
public Period divAssign(int n) { ationException( );
throw new UnsupportedOper
}
public void normalize() { ationException( );
throw new UnsupportedOper
}
public double years(final Period ref) { ationException( );
throw new UnsupportedOper
}
public double months(final Period ref) { ationException( );
throw new UnsupportedOper
}
public double weeks(final Period ref) { ationException( );
throw new UnsupportedOper
}
public double days(final Period ref) { ationException( );
throw new UnsupportedOper
}
public Period mul(T n, TimeUnit units) { ationException( );
throw new UnsupportedOper
}
public Period mul(TimeUnit units, T n) { ationException( );
throw new UnsupportedOper
}
public Period sub(final Period ref) { ationException( );
throw new UnsupportedOper
}
public Period mul(int n, final Period ref) { ationException( );
throw new UnsupportedOper
}
public Period mul(final Period ref, int n) { ationException( );
throw new UnsupportedOper
}
public Period div(final Period ref, int n) { ationException( );
throw new UnsupportedOper
}
public Period add(final Period ref, final Period ref) { ationException( );
throw new UnsupportedOper
}
public Period sub(final Period ref, final Period ref) { ationException( );
throw new UnsupportedOper
}
public boolean lt(final Period ref, final Period ref) { ationException( );
throw new UnsupportedOper
}
public boolean eq(final Period ref, final Period ref) { ationException( );
throw new UnsupportedOper
}
public boolean ne(final Period ref, final Period ref) { ationException( );
throw new UnsupportedOper
}
public boolean gt(final Period ref, final Period ref) { ationException( );
throw new UnsupportedOper
}
public boolean le(final Period ref, final Period ref) { ationException( );
throw new UnsupportedOper
}
public boolean ge(fi...