org.jfin.date.accrual
Class AccrualPeriod
- java.lang.Object
-
- org.jfin.date.Period
-
- org.jfin.date.accrual.AccrualPeriod
-
- All Implemented Interfaces:
- java.lang.Comparable, Initialisable
- Direct Known Subclasses:
- FixedAccrualPeriod, FloatAccrualPeriod
public abstract class AccrualPeriod extends Period implements Initialisable
Abstract class that provides the basis of concrete accrual periods.
-
-
Constructor Summary
Constructors Constructor and Description AccrualPeriod()Default constructorAccrualPeriod(Period toCopy)Copy constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description BusinessDayConventiongetAccrualBusinessDayConvention()Gets the accrual business day conventionHolidayCalendargetAccrualHolidayCalendar()Gets the accrual holiday calendardoublegetAdjustedDaycountFraction()Gets the daycount fraction for the adjusted period.java.util.CalendargetAdjustedEndCalendar()Returns the end calendar adjusted based upon the accrual holiday calendar and business day convention.java.util.CalendargetAdjustedPaymentCalendar()java.util.CalendargetAdjustedStartCalendar()Returns the start calendar adjusted based upon the accrual holiday calendar and business day convention.DaycountCalculatorgetDaycountCalculator()Gets the day count calculator used to calculate the value of the accrual period.abstract doublegetPaymentAmount(double notional)Return the payment amount for a given notionalBusinessDayConventiongetPaymentBusinessDayConvention()Gets the business day convention used to adjust the payment date.java.util.CalendargetPaymentCalendar()Gets the payment dateHolidayCalendargetPaymentHolidayCalendar()Gets the holiday calendar used to adjust the payment date.PaymentTypegetPaymentType()Gets the payment type (IN_ARREARS, IN_ADVANCE) which determines whether the payment date is the start of the period (IN_ADVANCE) or the end of the period (IN_ARREARS).voidinitialise()Initialises the payment date after the start and end dates have been set.abstract booleanisPaymentPossible()voidsetAccrualBusinessDayConvention(BusinessDayConvention accrualBusinessDayConvention)Sets the accrual business day conventionvoidsetAccrualHolidayCalendar(HolidayCalendar accrualHolidayCalendar)Sets the accrual holiday calendarvoidsetDaycountCalculator(DaycountCalculator daycountCalculator)Sets the day count calculator used to calculate the value of the accrual period.voidsetPaymentBusinessDayConvention(BusinessDayConvention paymentBusinessDayConvention)Sets the business day convention used to adjust the payment date.voidsetPaymentCalendar(java.util.Calendar paymentCalendar)Sets the payment datevoidsetPaymentHolidayCalendar(HolidayCalendar paymentHolidayCalendar)Sets the holiday calendar used to adjust the payment date.voidsetPaymentType(PaymentType paymentType)Sets the payment type (IN_ARREARS, IN_ADVANCE) which determines whether the payment date is the start of the period (IN_ADVANCE) or the end of the period (IN_ARREARS).-
Methods inherited from class org.jfin.date.Period
clone, compareTo, getEndCalendar, getReferenceEndCalendar, getReferenceStartCalendar, getStartCalendar, setEndCalendar, setReferenceEndCalendar, setReferenceStartCalendar, setStartCalendar, toString
-
-
-
-
Constructor Detail
-
AccrualPeriod
public AccrualPeriod()
Default constructor
-
AccrualPeriod
public AccrualPeriod(Period toCopy)
Copy constructor- Parameters:
toCopy- the Period to copy
-
-
Method Detail
-
initialise
public void initialise()
Initialises the payment date after the start and end dates have been set.- Specified by:
initialisein interfaceInitialisable
-
getPaymentAmount
public abstract double getPaymentAmount(double notional) throws java.lang.ExceptionReturn the payment amount for a given notional- Parameters:
notional- The notional- Returns:
- The payment amount for the given notional
- Throws:
java.lang.Exception- Throws an Exception if there are problems calculating the payment amount
-
isPaymentPossible
public abstract boolean isPaymentPossible()
-
getPaymentCalendar
public java.util.Calendar getPaymentCalendar()
Gets the payment date- Returns:
- Calendar representing the payment date
-
getAdjustedPaymentCalendar
public java.util.Calendar getAdjustedPaymentCalendar() throws AccrualException- Throws:
AccrualException
-
setPaymentCalendar
public void setPaymentCalendar(java.util.Calendar paymentCalendar)
Sets the payment date- Parameters:
paymentCalendar- The Calendar representing the payment date
-
getPaymentType
public PaymentType getPaymentType()
Gets the payment type (IN_ARREARS, IN_ADVANCE) which determines whether the payment date is the start of the period (IN_ADVANCE) or the end of the period (IN_ARREARS).- Returns:
- The payment type
-
setPaymentType
public void setPaymentType(PaymentType paymentType)
Sets the payment type (IN_ARREARS, IN_ADVANCE) which determines whether the payment date is the start of the period (IN_ADVANCE) or the end of the period (IN_ARREARS).- Parameters:
paymentType- The payment type
-
getPaymentBusinessDayConvention
public BusinessDayConvention getPaymentBusinessDayConvention()
Gets the business day convention used to adjust the payment date.- Returns:
- The payment business day convention
-
setPaymentBusinessDayConvention
public void setPaymentBusinessDayConvention(BusinessDayConvention paymentBusinessDayConvention)
Sets the business day convention used to adjust the payment date.- Parameters:
paymentBusinessDayConvention- The payment business day convention
-
getAccrualBusinessDayConvention
public BusinessDayConvention getAccrualBusinessDayConvention()
Gets the accrual business day convention- Returns:
- The accrual business day convention
-
setAccrualBusinessDayConvention
public void setAccrualBusinessDayConvention(BusinessDayConvention accrualBusinessDayConvention)
Sets the accrual business day convention- Parameters:
accrualBusinessDayConvention- The accrual business day convention
-
getPaymentHolidayCalendar
public HolidayCalendar getPaymentHolidayCalendar()
Gets the holiday calendar used to adjust the payment date.- Returns:
- The payment holiday calendar
-
setPaymentHolidayCalendar
public void setPaymentHolidayCalendar(HolidayCalendar paymentHolidayCalendar)
Sets the holiday calendar used to adjust the payment date.- Parameters:
paymentHolidayCalendar- The payment holiday calendar
-
getAccrualHolidayCalendar
public HolidayCalendar getAccrualHolidayCalendar()
Gets the accrual holiday calendar- Returns:
- The accrual holiday calendar
-
setAccrualHolidayCalendar
public void setAccrualHolidayCalendar(HolidayCalendar accrualHolidayCalendar)
Sets the accrual holiday calendar- Parameters:
accrualHolidayCalendar- The accrual holiday calendar
-
getDaycountCalculator
public DaycountCalculator getDaycountCalculator()
Gets the day count calculator used to calculate the value of the accrual period.- Returns:
- The day count calculator
-
setDaycountCalculator
public void setDaycountCalculator(DaycountCalculator daycountCalculator)
Sets the day count calculator used to calculate the value of the accrual period.- Parameters:
daycountCalculator- The day count calculator
-
getAdjustedStartCalendar
public java.util.Calendar getAdjustedStartCalendar() throws AccrualExceptionReturns the start calendar adjusted based upon the accrual holiday calendar and business day convention.- Returns:
- The adjusted start calendar
- Throws:
AccrualException- If the start calendar, payment business day convention or payment holiday are null
-
getAdjustedEndCalendar
public java.util.Calendar getAdjustedEndCalendar() throws AccrualExceptionReturns the end calendar adjusted based upon the accrual holiday calendar and business day convention.- Returns:
- The adjusted end calendar
- Throws:
AccrualException- If the start calendar, payment business day convention or payment holiday are null
-
getAdjustedDaycountFraction
public double getAdjustedDaycountFraction() throws AccrualExceptionGets the daycount fraction for the adjusted period.- Returns:
- The day count fraction of the adjusted accrual period
- Throws:
AccrualException- If there is a problem creating the adjusted day count fraction
-
-
DataMelt 3.0 © DataMelt by jWork.ORG