com.ftlabs.fisa
Class DayCountBasis

java.lang.Object
  extended by com.ftlabs.fisa.DayCountBasis
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DayCountBasis_30_360, DayCountBasis_30E_360, DayCountBasis_Actual

public abstract class DayCountBasis
extends java.lang.Object
implements java.io.Serializable

Defines an abstract class that is used to calculate the number of days between two dates.

See Also:
Serialized Form

Field Summary
static DayCountBasis _30_360
          30/360 DayCountBasis implementation
static DayCountBasis _30E_360
          30E/360 DayCountBasis implementation
static DayCountBasis ACT_360
          Actual/360 DayCountBasis implementation
static DayCountBasis ACT_365
          Actual/365 DayCountBasis implementation
static DayCountBasis ACT_365_NL
          Actual/365_NL DayCountBasis implementation Actual/365, but ignores leap days for both accrued and days remaining.
static DayCountBasis ACT_ACT
          Actual/Actual DayCountBasis implementation
 
Constructor Summary
DayCountBasis()
           
 
Method Summary
abstract  double calculateDays(FISADate earlierDate, FISADate laterDate, int interestFrequency, boolean eomAdjust)
          Calculates the number of days between two dates using the implemented Day Count method.
abstract  double calculateDaysAccrued(FISADate previousCouponDate, FISADate nextCouponDate, FISADate settlementDate, int interestFrequency, boolean eomAdjust)
          Calculate the number of days accrued within a coupon period.
abstract  double calculateDaysInPeriod(FISADate previousCouponDate, FISADate nextCouponDate, int interestFrequency, boolean eomAdjust)
          Calculate the total number of days in a coupon period.
abstract  double calculateDaysRemaining(FISADate previousCouponDate, FISADate nextCouponDate, FISADate settlementDate, int interestFrequency, boolean eomAdjust)
          Calculate the number of days remaining in a coupon period.
static DayCountBasis getByName(java.lang.String name)
          Get a DayCountBasis implementations for a given name.
abstract  int getDaysInYear(FISADate date)
          Calculate the number of days for a given year.
static java.util.Collection getSupportedDayCountBases()
          Get a Collection of all the supported DayCountBases.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_30_360

public static final DayCountBasis _30_360
30/360 DayCountBasis implementation


_30E_360

public static final DayCountBasis _30E_360
30E/360 DayCountBasis implementation


ACT_ACT

public static final DayCountBasis ACT_ACT
Actual/Actual DayCountBasis implementation


ACT_360

public static final DayCountBasis ACT_360
Actual/360 DayCountBasis implementation


ACT_365

public static final DayCountBasis ACT_365
Actual/365 DayCountBasis implementation


ACT_365_NL

public static final DayCountBasis ACT_365_NL
Actual/365_NL DayCountBasis implementation Actual/365, but ignores leap days for both accrued and days remaining.

Constructor Detail

DayCountBasis

public DayCountBasis()
Method Detail

getByName

public static DayCountBasis getByName(java.lang.String name)
Get a DayCountBasis implementations for a given name. Supported implementation names are :

Parameters:
name - The name of the desired DayCountBasis implementations.
Returns:
A DayCountBasis implementations for the given name. If an implementation doesn't exist for a given name, then null will be returned.

getSupportedDayCountBases

public static java.util.Collection getSupportedDayCountBases()
Get a Collection of all the supported DayCountBases.

Returns:
a Collection of all the supported DayCountBases.

calculateDaysInPeriod

public abstract double calculateDaysInPeriod(FISADate previousCouponDate,
                                             FISADate nextCouponDate,
                                             int interestFrequency,
                                             boolean eomAdjust)
Calculate the total number of days in a coupon period.

Parameters:
previousCouponDate - the previous coupon date.
nextCouponDate - the next coupon date.
interestFrequency - the interestFrequency.
eomAdjust - determines whether the end of month adjustment rule is used.
Returns:
the number of days within the given period.

calculateDaysAccrued

public abstract double calculateDaysAccrued(FISADate previousCouponDate,
                                            FISADate nextCouponDate,
                                            FISADate settlementDate,
                                            int interestFrequency,
                                            boolean eomAdjust)
Calculate the number of days accrued within a coupon period.

Parameters:
previousCouponDate - the previous coupon date.
nextCouponDate - the next coupon date.
settlementDate - the date on which settlement occurs.
interestFrequency - the interestFrequency.
eomAdjust - determines whether the end of month adjustment rule is used.
Returns:
the number of days accrued within the given period.

calculateDaysRemaining

public abstract double calculateDaysRemaining(FISADate previousCouponDate,
                                              FISADate nextCouponDate,
                                              FISADate settlementDate,
                                              int interestFrequency,
                                              boolean eomAdjust)
Calculate the number of days remaining in a coupon period.

Parameters:
previousCouponDate - the previous coupon date.
nextCouponDate - the next coupon date.
settlementDate - the date on which settlement occurs.
interestFrequency - the interestFrequency.
eomAdjust - determines whether the end of month adjustment rule is used.
Returns:
the number of days remaining in the given period.

calculateDays

public abstract double calculateDays(FISADate earlierDate,
                                     FISADate laterDate,
                                     int interestFrequency,
                                     boolean eomAdjust)
Calculates the number of days between two dates using the implemented Day Count method.

Parameters:
earlierDate - The starting date of the period.
laterDate - The ending date of the period.
interestFrequency - the interestFrequency.
eomAdjust - determines whether the end of month adjustment rule is used.
Returns:
the number of days within the specified period.

getDaysInYear

public abstract int getDaysInYear(FISADate date)
Calculate the number of days for a given year.

Parameters:
date - The date for which the number of days per year will be returned.
Returns:
the number of days in the given year.