com.ftlabs.fisa
Class DiscreteInterestRateSchedule

java.lang.Object
  extended by com.ftlabs.fisa.DiscreteInterestRateSchedule
All Implemented Interfaces:
InterestRateSchedule

public class DiscreteInterestRateSchedule
extends java.lang.Object
implements InterestRateSchedule


Constructor Summary
DiscreteInterestRateSchedule()
           
DiscreteInterestRateSchedule(double firstInterestRate, FISADate conversionDate, double newInterestRate)
          A convenience constructor to create a DiscreteInterestRateSchedule with an initial interest rate and a single step.
 
Method Summary
 void add(FISADate conversionDate, double interestRate)
          Adds a new InterestRateStep to this DiscreteInterestRateSchedule, created using the provided date and interestRate.
 void clear()
          Clears this DiscreteInterestRateSchedule.
 int getCount()
          Get the total number of interest rates in this schedule.
 FISADate getDate(int index)
          Get the conversionDate for the specified index.
 int getIndex(FISADate date)
          Get the index of the given date.
 double getInterestRate(FISADate date)
          Get the interest rate that would be applicable for the given date.
 double getInterestRate(int index)
          Get the interest reate for the specified index.
 void setSingleStep(double firstInterestRate, FISADate conversionDate, double newInterestRate)
          A convenience method to clear this schedule and set an initial interest rate with a single step.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiscreteInterestRateSchedule

public DiscreteInterestRateSchedule()

DiscreteInterestRateSchedule

public DiscreteInterestRateSchedule(double firstInterestRate,
                                    FISADate conversionDate,
                                    double newInterestRate)
A convenience constructor to create a DiscreteInterestRateSchedule with an initial interest rate and a single step.

Parameters:
firstInterestRate - the interestRate to use from settlementDate until the conversionDate.
conversionDate - the date on which the newInterestRate takes effect.
newInterestRate - the interest rate to be used from conversionDate to maturity.
Method Detail

setSingleStep

public void setSingleStep(double firstInterestRate,
                          FISADate conversionDate,
                          double newInterestRate)
A convenience method to clear this schedule and set an initial interest rate with a single step.

Parameters:
firstInterestRate - the interestRate to use from settlementDate until the conversionDate.
conversionDate - the date on which the newInterestRate takes effect.
newInterestRate - the interest rate to be used from conversionDate to maturity.

getIndex

public int getIndex(FISADate date)
Get the index of the given date.

Specified by:
getIndex in interface InterestRateSchedule
Parameters:
date - a date
Returns:
the index of the given date.

getInterestRate

public double getInterestRate(FISADate date)
Get the interest rate that would be applicable for the given date.

Specified by:
getInterestRate in interface InterestRateSchedule
Parameters:
date - a date
Returns:
the interest rate that is applicable for the given date.

add

public void add(FISADate conversionDate,
                double interestRate)
Adds a new InterestRateStep to this DiscreteInterestRateSchedule, created using the provided date and interestRate.

Parameters:
conversionDate - the date that the provided interestRate takes effect.
interestRate - the new interestRate.

getCount

public int getCount()
Get the total number of interest rates in this schedule.

Specified by:
getCount in interface InterestRateSchedule
Returns:
the totla number of interest rates in this schedule.

getDate

public FISADate getDate(int index)
Get the conversionDate for the specified index.

Specified by:
getDate in interface InterestRateSchedule
Parameters:
index - the interest rate index
Returns:
the conversionDate for the specified index.

getInterestRate

public double getInterestRate(int index)
Get the interest reate for the specified index.

Specified by:
getInterestRate in interface InterestRateSchedule
Parameters:
index - the interest rate index
Returns:
the interest rate for the specified index.

clear

public void clear()
Clears this DiscreteInterestRateSchedule.