Class AnnualCalendar

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Calendar

    public class AnnualCalendar
    extends BaseCalendar
    implements Calendar, java.io.Serializable

    This implementation of the Calendar excludes a set of days of the year. You may use it to exclude bank holidays which are on the same date every year.

    Author:
    Juergen Donnerstag
    See Also:
    Calendar, BaseCalendar, Serialized Form
    • Constructor Detail

      • AnnualCalendar

        public AnnualCalendar()
      • AnnualCalendar

        public AnnualCalendar​(Calendar baseCalendar)
      • AnnualCalendar

        public AnnualCalendar​(java.util.TimeZone timeZone)
      • AnnualCalendar

        public AnnualCalendar​(Calendar baseCalendar,
                              java.util.TimeZone timeZone)
    • Method Detail

      • getDaysExcluded

        public java.util.ArrayList<java.util.Calendar> getDaysExcluded()

        Get the array which defines the exclude-value of each day of month

      • isDayExcluded

        public boolean isDayExcluded​(java.util.Calendar day)

        Return true, if day is defined to be exluded.

      • setDaysExcluded

        public void setDaysExcluded​(java.util.ArrayList<java.util.Calendar> days)

        Redefine the list of days excluded. The ArrayList should contain java.util.Calendar objects.

      • setDayExcluded

        public void setDayExcluded​(java.util.Calendar day,
                                   boolean exclude)

        Redefine a certain day to be excluded (true) or included (false).

      • removeExcludedDay

        public void removeExcludedDay​(java.util.Calendar day)
        Remove the given day from the list of excluded days
        Parameters:
        day - the day to exclude
      • getNextIncludedTime

        public long getNextIncludedTime​(long timeStamp)

        Determine the next time (in milliseconds) that is 'included' by the Calendar after the given time. Return the original value if timeStamp is included. Return 0 if all days are excluded.

        Note that this Calendar is only has full-day precision.

        Specified by:
        getNextIncludedTime in interface Calendar
        Overrides:
        getNextIncludedTime in class BaseCalendar
        See Also:
        Calendar.getNextIncludedTime(long)