|
WebCab Bonds v2.01 (J2SE Edition) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--webcab.lib.calendar.AbstractBusinessCalendar
This abstract class provides default implementation for most of the methods in the BusinessCalendar
interface. Subclasses of this one class must take care of specifying the holidays.
| Field Summary | |
static int |
DAYS_IN_A_WEEK
The number of days within a week. |
static int |
MILLISECONDS_IN_A_DAY
The number of milliseconds within a day. |
static int |
MILLISECONDS_IN_A_HOUR
The number of milliseconds within a hour. |
static int |
MILLISECONDS_IN_A_MINUTE
The number of milliseconds within a minute. |
static int |
MILLISECONDS_IN_A_SECOND
The number of milliseconds within a second. |
| Constructor Summary | |
protected |
AbstractBusinessCalendar(String name)
Default constructor. |
| Method Summary | |
protected boolean |
checkDayOfWeek(int dayOfWeek)
Returns true if dayOfWeek really is a day of week.
|
protected boolean |
checkOrder(Calendar start,
Calendar end)
Returns true if start date really is before end date. |
int |
daysBetween(Date start,
Date end)
Calculates and returns the number of days between two dates. |
double |
daysBetweenAsPercentAtYear(Date start,
Date end)
Calculates and returns the number of days between a start and end date as
a percentage of a year. |
int |
daysOfWeekBetween(int dayOfWeek,
Date start,
Date end)
Calculates and returns the number of a certain day (Monday's or Tuesday's etc) of a week which lie between between two dates. |
String |
getName()
Return the name of the this BusinessCalendar. |
protected abstract boolean |
isHoliday(Calendar date)
Returns true if the specified date calendar is a working day. |
boolean |
isHoliday(Date date)
Returns true if the specified date calendar is a working day. |
boolean |
isWorkingDay(Date date)
Returns true if the specified date calendar is a working day. |
Date |
nextHoliday(Date date)
Returns the next holiday day after a given date. |
int |
nextPaymentDate(Date[] payments,
Date date)
Returns the index of the next payment date related to a given date,
when the array of all payment dates is known. |
Date |
nextWorkingDay(Date date)
Returns the next working day after a given date. |
int |
previousPaymentDate(Date[] payments,
Date date)
Returns the index of the previous payment date related to a given date,
when the array of payments dates is known. |
int |
workingDaysBetween(Date start,
Date end)
Calculates and returns the number of working days between two dates. |
double |
yearsBetween(Date start,
Date end)
Calculates and Returns the number of years between a start and end date. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int MILLISECONDS_IN_A_SECOND
public static final int MILLISECONDS_IN_A_MINUTE
public static final int MILLISECONDS_IN_A_HOUR
public static final int MILLISECONDS_IN_A_DAY
public static final int DAYS_IN_A_WEEK
| Constructor Detail |
protected AbstractBusinessCalendar(String name)
protected access so it can be overridden and made public.
name - the name of the this BusinessCalendar| Method Detail |
public String getName()
BusinessCalendar.
getName in interface BusinessCalendarBusinessCalendarpublic boolean isWorkingDay(Date date)
true if the specified date calendar is a working day.
isWorkingDay in interface BusinessCalendardate - the date to check
true if the specified date calendar is a working day,
false otherwiseBusinessCalendar.isWorkingDay(Date),
isHoliday(Date),
BusinessCalendar.isWorkingDay(Date)public boolean isHoliday(Date date)
true if the specified date calendar is a working day.
isHoliday in interface BusinessCalendardate - the date to check
true if the specified date calendar is a working day,
false otherwiseBusinessCalendar.isHoliday(Date),
isWorkingDay(Date),
BusinessCalendar.isHoliday(Date)protected abstract boolean isHoliday(Calendar date)
true if the specified date calendar is a working day.
date - the date to check
true if the specified date calendar is a working day,
false otherwiseBusinessCalendar.isHoliday(Date),
isWorkingDay(Date),
BusinessCalendar.isHoliday(Date)
protected final boolean checkOrder(Calendar start,
Calendar end)
start date really is before end date.
start - the start dateend - the end date
start date is before end dateprotected final boolean checkDayOfWeek(int dayOfWeek)
dayOfWeek really is a day of week.
The dayOfWeek must be one of the following values:
Calendar.MONDAYCalendar.TUESDAYCalendar.WEDNESDAYCalendar.THURSDAYCalendar.FRIDAYCalendar.SATURDAYCalendar.SUNDAY
dayOfWeek - day to check
dayOfWeek is a day of week, false otherwise
public int daysBetween(Date start,
Date end)
daysBetween in interface BusinessCalendarstart - the start dateend - the end date
IllegalArgumentException - if start date is after end dateBusinessCalendar.daysBetween(Date, Date)
public int daysOfWeekBetween(int dayOfWeek,
Date start,
Date end)
daysOfWeekBetween in interface BusinessCalendardayOfWeek - one of the Date.MONDAY,...,Date.SUNDAY valuesstart - the start dateend - the end date
IllegalArgumentException - if end date
or dayOfWeek is not a day of weekBusinessCalendar.daysOfWeekBetween(int, Date, Date)
public int workingDaysBetween(Date start,
Date end)
workingDaysBetween in interface BusinessCalendarstart - the start dateend - the end date
IllegalArgumentException - if end date
or if one of the dates is not a working dayBusinessCalendar.workingDaysBetween(Date, Date)
public double daysBetweenAsPercentAtYear(Date start,
Date end)
start and end date as
a percentage of a year.
daysBetweenAsPercentAtYear in interface BusinessCalendarstart - the start dateend - the end date
start and end dates as percent at year
IllegalArgumentException - if end dateBusinessCalendar.daysBetweenAsPercentAtYear(Date, Date)
public double yearsBetween(Date start,
Date end)
start and end date.
yearsBetween in interface BusinessCalendarstart - the start dateend - the end date
start and end dates
IllegalArgumentException - if end dateBusinessCalendar.yearsBetween(Date, Date)public Date nextWorkingDay(Date date)
date.
nextWorkingDay in interface BusinessCalendardate - the date used to calculate the next working day
date dateBusinessCalendar.nextWorkingDay(Date)public Date nextHoliday(Date date)
date.
nextHoliday in interface BusinessCalendardate - the date used to calculate the next holiday day
date dateBusinessCalendar.nextHoliday(Date)
public int previousPaymentDate(Date[] payments,
Date date)
date,
when the array of payments dates is known.
previousPaymentDate in interface BusinessCalendarpayments - the payment datesdate - the date we are interested in
date
IllegalArgumentException - if date is before the first payment date or
no payments date are passednextPaymentDate(Date[], Date),
BusinessCalendar.previousPaymentDate(Date[], Date)
public int nextPaymentDate(Date[] payments,
Date date)
date,
when the array of all payment dates is known.
nextPaymentDate in interface BusinessCalendarpayments - the payment datesdate - the date we are interested in
date
IllegalArgumentException - if date is before the first payment date or
no payments date are passedpreviousPaymentDate(Date[], Date),
BusinessCalendar.nextPaymentDate(Date[], Date)
|
WebCab Bonds v2.01 (J2SE Edition) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||