WebCab Options and Futures Demo v2.5 (J2SE Edition)

## webcab.lib.calendar
Class AbstractBusinessCalendar

    java.lang.Object
      |
      +--webcab.lib.calendar.AbstractBusinessCalendar

All Implemented Interfaces:
  BusinessCalendar, Serializable

Direct Known Subclasses:
  DefaultBusinessCalendar, LondonBusinessCalendar, NewYorkBusinessCalendar, TokyoBusinessCalendar

public abstract class AbstractBusinessCalendar
extends Object
implements BusinessCalendar, Serializable

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.

See Also:
  Serialized Form

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

### MILLISECONDS_IN_A_SECOND

    public static final int MILLISECONDS_IN_A_SECOND

  The number of milliseconds within a second.

  See Also:
    Constant Field Values

### MILLISECONDS_IN_A_MINUTE

    public static final int MILLISECONDS_IN_A_MINUTE

  The number of milliseconds within a minute.

  See Also:
    Constant Field Values

### MILLISECONDS_IN_A_HOUR

    public static final int MILLISECONDS_IN_A_HOUR

  The number of milliseconds within a hour.

  See Also:
    Constant Field Values

### MILLISECONDS_IN_A_DAY

    public static final int MILLISECONDS_IN_A_DAY

  The number of milliseconds within a day.

  See Also:
    Constant Field Values

### DAYS_IN_A_WEEK

    public static final int DAYS_IN_A_WEEK

  The number of days within a week.

  See Also:
    Constant Field Values

Constructor Detail

### AbstractBusinessCalendar

    protected AbstractBusinessCalendar(String name)

  Default constructor. It has `protected` access so it can be overridden and made `public`.

Parameters:
  `name` - the name of the this `BusinessCalendar`

Method Detail

### getName

    public String getName()

  Return the name of the this `BusinessCalendar`.

  Specified by:
    `getName` in interface `BusinessCalendar`
  Returns:
    the name of the this `BusinessCalendar`

### isWorkingDay

    public boolean isWorkingDay(Date date)

  Returns `true` if the specified date `calendar` is a working day.

  Specified by:
    `isWorkingDay` in interface `BusinessCalendar`
  Parameters:
    `date` - the date to check
  Returns:
    `true` if the specified date `calendar` is a working day, `false` otherwise
  See Also:
    `BusinessCalendar.isWorkingDay(Date)`, `isHoliday(Date)`, `BusinessCalendar.isWorkingDay(Date)`

### isHoliday

    public boolean isHoliday(Date date)

  Returns `true` if the specified date `calendar` is a working day.

  Specified by:
    `isHoliday` in interface `BusinessCalendar`
  Parameters:
    `date` - the date to check
  Returns:
    `true` if the specified date `calendar` is a working day, `false` otherwise
  See Also:
    `BusinessCalendar.isHoliday(Date)`, `isWorkingDay(Date)`, `BusinessCalendar.isHoliday(Date)`

### isHoliday

    protected abstract boolean isHoliday(Calendar date)

  Returns `true` if the specified date `calendar` is a working day.

  Parameters:
    `date` - the date to check
  Returns:
    `true` if the specified date `calendar` is a working day, `false` otherwise
  See Also:
    `BusinessCalendar.isHoliday(Date)`, `isWorkingDay(Date)`, `BusinessCalendar.isHoliday(Date)`

### checkOrder

    protected final boolean checkOrder(Calendar start,
                                       Calendar end)

  Returns true if `start` date really is before `end` date.

  Parameters:
    `start` - the start date
    `end` - the end date
  Returns:
    true if `start` date is before `end` date

### checkDayOfWeek

    protected final boolean checkDayOfWeek(int dayOfWeek)

  Returns true if `dayOfWeek` really is a day of week.

  The `dayOfWeek` must be one of the following values:

  - `Calendar.MONDAY`
  - `Calendar.TUESDAY`
  - `Calendar.WEDNESDAY`
  - `Calendar.THURSDAY`
  - `Calendar.FRIDAY`
  - `Calendar.SATURDAY`
  - `Calendar.SUNDAY`

  Parameters:
    `dayOfWeek` - day to check
  Returns:
    true if `dayOfWeek` is a day of week, false otherwise

### daysBetween

    public int daysBetween(Date start,
                           Date end)

  Calculates and returns the number of days between two dates.

  Specified by:
    `daysBetween` in interface `BusinessCalendar`
  Parameters:
    `start` - the start date
    `end` - the end date
  Returns:
    the number of days between two dates
  Throws:
    `IllegalArgumentException` - if `start` date is after `end` date
  See Also:
    `BusinessCalendar.daysBetween(Date, Date)`

### daysOfWeekBetween

    public 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.

  Specified by:
    `daysOfWeekBetween` in interface `BusinessCalendar`
  Parameters:
    `dayOfWeek` - one of the `Date.MONDAY`,...,`Date.SUNDAY` values
    `start` - the start date
    `end` - the end date
  Returns:
    the number of a certain day of week between two dates
  Throws:
    `IllegalArgumentException` - if <ocde>start date is after `end` date or `dayOfWeek` is not a day of week
  See Also:
    `BusinessCalendar.daysOfWeekBetween(int, Date, Date)`

### workingDaysBetween

    public int workingDaysBetween(Date start,
                                  Date end)

  Calculates and returns the number of working days between two dates. The number of working days between two working dates is the number of days between the two dates less the number of holidays between the two dates.

  Specified by:
    `workingDaysBetween` in interface `BusinessCalendar`
  Parameters:
    `start` - the start date
    `end` - the end date
  Returns:
    the number of days between two dates
  Throws:
    `IllegalArgumentException` - if <ocde>start date is after `end` date or if one of the dates is not a working day
  See Also:
    `BusinessCalendar.workingDaysBetween(Date, Date)`

### daysBetweenAsPercentAtYear

    public 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.

  Specified by:
    `daysBetweenAsPercentAtYear` in interface `BusinessCalendar`
  Parameters:
    `start` - the start date
    `end` - the end date
  Returns:
    the number of days between `start` and `end` dates as percent at year
  Throws:
    `IllegalArgumentException` - if <ocde>start date is after `end` date
  See Also:
    `BusinessCalendar.daysBetweenAsPercentAtYear(Date, Date)`

### yearsBetween

    public double yearsBetween(Date start,
                               Date end)

  Calculates and Returns the number of years between a `start` and `end` date.

  Specified by:
    `yearsBetween` in interface `BusinessCalendar`
  Parameters:
    `start` - the start date
    `end` - the end date
  Returns:
    the number of years between `start` and `end` dates
  Throws:
    `IllegalArgumentException` - if <ocde>start date is after `end` date
  See Also:
    `BusinessCalendar.yearsBetween(Date, Date)`

### nextWorkingDay

    public Date nextWorkingDay(Date date)

  Returns the next working day after a given `date`.

  Specified by:
    `nextWorkingDay` in interface `BusinessCalendar`
  Parameters:
    `date` - the date used to calculate the next working day
  Returns:
    the next working day after `date` date
  See Also:
    `BusinessCalendar.nextWorkingDay(Date)`

### nextHoliday

    public Date nextHoliday(Date date)

  Returns the next holiday day after a given `date`.

  Specified by:
    `nextHoliday` in interface `BusinessCalendar`
  Parameters:
    `date` - the date used to calculate the next holiday day
  Returns:
    the next holiday day after `date` date
  See Also:
    `BusinessCalendar.nextHoliday(Date)`

### previousPaymentDate

    public 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.

  Specified by:
    `previousPaymentDate` in interface `BusinessCalendar`
  Parameters:
    `payments` - the payment dates
    `date` - the date we are interested in
  Returns:
    the index of the previous payment date related to `date`
  Throws:
    `IllegalArgumentException` - if date is before the first payment date or no payments date are passed
  See Also:
    `nextPaymentDate(Date[], Date)`, `BusinessCalendar.previousPaymentDate(Date[], Date)`

### nextPaymentDate

    public 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.

  Specified by:
    `nextPaymentDate` in interface `BusinessCalendar`
  Parameters:
    `payments` - the payment dates
    `date` - the date we are interested in
  Returns:
    the index of the next payment date related to `date`
  Throws:
    `IllegalArgumentException` - if date is before the first payment date or no payments date are passed
  See Also:
    `previousPaymentDate(Date[], Date)`, `BusinessCalendar.nextPaymentDate(Date[], Date)`

WebCab Options and Futures Demo v2.5 (J2SE Edition)