net.objectlab.kit.datecalc.common
Interface PeriodCountCalculator<E>

Package class diagram package PeriodCountCalculator
Type Parameters:
E - a representation of a date, typically JDK: Date, Calendar; Joda:LocalDate, YearMonthDay

public interface PeriodCountCalculator<E>

Interface that defines a financial market way of calculating difference in days, month (or part of) and year (or part of).

Version:
$Revision: 200 $ $Date: 2006-10-10 16:15:58 -0400 (Tue, 10 Oct 2006) $
Author:
Benoit Xhenseval, $LastChangedBy: benoitx $

Field Summary
static int MONTH_30_DAYS
           
static int MONTH_31_DAYS
           
static int MONTHS_IN_YEAR
           
static int YEAR_360
           
static double YEAR_360_0
           
static double YEAR_365_0
           
 
Method Summary
 int dayDiff(E start, E end, PeriodCountBasis basis)
          This calculates the number of days between 2 dates, it follows the given basis which means that the result could vary between the same 2 dates if the basis is different.
 double monthDiff(E start, E end, PeriodCountBasis basis)
          This calculates the number of months (or fraction) between 2 dates, it follows the given basis which means that the result could vary between the same 2 dates if the basis is different.
 double yearDiff(E start, E end, PeriodCountBasis basis)
          This calculates the number of years (or fraction) between 2 dates, it follows the given basis which means that the result could vary between the same 2 dates if the basis is different.
 

Field Detail

YEAR_360

static final int YEAR_360
See Also:
Constant Field Values

MONTHS_IN_YEAR

static final int MONTHS_IN_YEAR
See Also:
Constant Field Values

YEAR_365_0

static final double YEAR_365_0
See Also:
Constant Field Values

YEAR_360_0

static final double YEAR_360_0
See Also:
Constant Field Values

MONTH_31_DAYS

static final int MONTH_31_DAYS
See Also:
Constant Field Values

MONTH_30_DAYS

static final int MONTH_30_DAYS
See Also:
Constant Field Values
Method Detail

dayDiff

int dayDiff(E start,
            E end,
            PeriodCountBasis basis)
This calculates the number of days between 2 dates, it follows the given basis which means that the result could vary between the same 2 dates if the basis is different.

Parameters:
start - the start date
end - the end date
basis - the basis to use
Returns:
number of days between end and start.

monthDiff

double monthDiff(E start,
                 E end,
                 PeriodCountBasis basis)
This calculates the number of months (or fraction) between 2 dates, it follows the given basis which means that the result could vary between the same 2 dates if the basis is different.

Parameters:
start - the start date
end - the end date
basis - the basis to use
Returns:
number of months between end and start.

yearDiff

double yearDiff(E start,
                E end,
                PeriodCountBasis basis)
This calculates the number of years (or fraction) between 2 dates, it follows the given basis which means that the result could vary between the same 2 dates if the basis is different.

Parameters:
start - the start date
end - the end date
basis - the basis to use
Returns:
number of months between end and start.


Copyright © 2006-2010 Appendium - Portfolio Financing Platform. All Rights Reserved.