com.ftlabs.fisa
Class Redemption

java.lang.Object
  extended by com.ftlabs.fisa.Redemption
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

public class Redemption
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable

A class to represent any redemption date and rate. This could be maturity, a call, a put etc...

See Also:
Serialized Form

Constructor Summary
Redemption(FISADate date, double value)
          Creates a new instance of Redemption
Redemption(FISADate date, double value, FISADate lastInterestDate)
          Creates a new instance of Redemption
 
Method Summary
 int compareTo(java.lang.Object object)
          An implementation of compareTo that allows the natural order of a Redemption to be that of its redemption date.
 boolean equals(java.lang.Object object)
          Compares this Redemption to another object.
 FISADate generateLastInterestDate(FISADate synchronizeDate, InterestFrequency interestFrequency, boolean eomAdjust)
          Generates a date that would be the interest/dividend date just prior to redemption.
 FISADate getDate()
          Get the redemption Date.
 FISADate getLastInterestDate()
          Returns the interest date just prior to redemption, or null if it has not been set.
 double getValue()
          Returns the redemption value.
 int hashCode()
           
 void setDate(FISADate date)
          Sets the redemption Date.
 void setLastInterestDate(FISADate lastInterestDate)
          Sets the interest date just prior to redemption.
 void setValue(double value)
          Sets the redemption value.
 java.lang.String toString()
          Returns a description of this Redemption.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Redemption

public Redemption(FISADate date,
                  double value,
                  FISADate lastInterestDate)
Creates a new instance of Redemption

Parameters:
date - redemption date.
value - redemption value.
lastInterestDate - the interest date just prior to redemption.

Redemption

public Redemption(FISADate date,
                  double value)
Creates a new instance of Redemption

Parameters:
date - Redemption Date
value - Redemption Value
Method Detail

getDate

public FISADate getDate()
Get the redemption Date.

Returns:
the redemption Date.

setDate

public void setDate(FISADate date)
Sets the redemption Date.

Parameters:
date - the redemption Date.

getValue

public double getValue()
Returns the redemption value.

Returns:
the redemption value.

setValue

public void setValue(double value)
Sets the redemption value.

Parameters:
value - the redemption value.

getLastInterestDate

public FISADate getLastInterestDate()
Returns the interest date just prior to redemption, or null if it has not been set.

Returns:
the interest date just prior to redemption, or null if it has not been set.

setLastInterestDate

public void setLastInterestDate(FISADate lastInterestDate)
Sets the interest date just prior to redemption.

Parameters:
lastInterestDate - the interest date just prior to redemption.

generateLastInterestDate

public FISADate generateLastInterestDate(FISADate synchronizeDate,
                                         InterestFrequency interestFrequency,
                                         boolean eomAdjust)
Generates a date that would be the interest/dividend date just prior to redemption. This method stores the generated lastInterestDate to this Redemption object and returns the result.

Parameters:
synchronizeDate - A date to synchronize the lastInterestDate to. This will usually be a datedDate, firstInterestDate, or dividendPayDate. If synchronizeDate is null, then a date that is in sync with the redemption date is generated.
interestFrequency - The interestFrequency to use.
eomAdjust - Determines whether or not the end of month adjust rule is used.
Returns:
The generated lastInterestDate.

toString

public java.lang.String toString()
Returns a description of this Redemption.

Overrides:
toString in class java.lang.Object
Returns:
a description of this Redemption in the form of "MM-dd-yyyy @ ###.000"

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object object)
Compares this Redemption to another object.

Overrides:
equals in class java.lang.Object
Parameters:
object - the Object to which this Redemption is compared.
Returns:
true if this Redemption equals the supplied Object, otherwise false.

compareTo

public int compareTo(java.lang.Object object)
An implementation of compareTo that allows the natural order of a Redemption to be that of its redemption date. null dates are considered to be less than non null dates.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
object - The object to compare this Redemption to.
Returns:
-1 if the date of this Redemption is before the date of the passed Redemption date, 0 if the dates are equal, or 1 if the date of this Redemption is after the date of the passed Redemption.