Class AbstractCalendar

java.lang.Object
com.illumon.util.calendar.AbstractCalendar
All Implemented Interfaces:
Calendar
Direct Known Subclasses:
AbstractBusinessCalendar

public abstract class AbstractCalendar
extends Object
implements Calendar
  • Constructor Details

  • Method Details

    • previousDay

      public String previousDay​(DBDateTime time)
      Description copied from interface: Calendar
      Gets the previous date.
      Specified by:
      previousDay in interface Calendar
      Parameters:
      time - time; if null, return null
      Returns:
      the day before time
    • previousDay

      public String previousDay​(DBDateTime time, int days)
      Description copied from interface: Calendar
      Gets the date the specified number of days prior to the input date.
      Specified by:
      previousDay in interface Calendar
      Parameters:
      time - time; if null, return null
      days - number of days;
      Returns:
      the date days before date
    • previousDay

      public String previousDay​(String date)
      Description copied from interface: Calendar
      Gets the previous date.
      Specified by:
      previousDay in interface Calendar
      Parameters:
      date - date; if null, return null
      Returns:
      the date before date
    • previousDay

      public String previousDay​(String date, int days)
      Description copied from interface: Calendar
      Gets the date the specified number of days prior to the input date.
      Specified by:
      previousDay in interface Calendar
      Parameters:
      date - date; if null, return null
      days - number of days;
      Returns:
      the date days before date
    • nextDay

      public String nextDay​(DBDateTime time)
      Description copied from interface: Calendar
      Gets the next date.
      Specified by:
      nextDay in interface Calendar
      Parameters:
      time - time; if null, return null
      Returns:
      the day after time
    • nextDay

      public String nextDay​(DBDateTime time, int days)
      Description copied from interface: Calendar
      Gets the date days after the input time.
      Specified by:
      nextDay in interface Calendar
      Parameters:
      time - time; if null, return null
      days - number of days;
      Returns:
      the day after time
    • nextDay

      public String nextDay​(String date)
      Description copied from interface: Calendar
      Gets the next date.
      Specified by:
      nextDay in interface Calendar
      Parameters:
      date - date; if null, return null
      Returns:
      the date after time
    • nextDay

      public String nextDay​(String date, int days)
      Description copied from interface: Calendar
      Gets the date days after the input date.
      Specified by:
      nextDay in interface Calendar
      Parameters:
      date - time; if null, return null
      days - number of days;
      Returns:
      the day after time
    • daysInRange

      public String[] daysInRange​(DBDateTime start, DBDateTime end)
      Description copied from interface: Calendar
      Gets the days in a given range.
      Specified by:
      daysInRange in interface Calendar
      Parameters:
      start - start of a time range; if null, return empty array
      end - end of a time range; if null, return empty array
      Returns:
      the inclusive days between start and end
    • daysInRange

      public String[] daysInRange​(String start, String end)
      Description copied from interface: Calendar
      Gets the days in a given range.
      Specified by:
      daysInRange in interface Calendar
      Parameters:
      start - start of a time range; if null, return empty array
      end - end of a time range; if null, return empty array
      Returns:
      the inclusive days between start and end
    • numberOfDays

      public int numberOfDays​(DBDateTime start, DBDateTime end)
      Description copied from interface: Calendar
      Gets the number of days in a given range, end date exclusive.
      Specified by:
      numberOfDays in interface Calendar
      Parameters:
      start - start of a time range; if null, return NULL_INT
      end - end of a time range; if null, return NULL_INT
      Returns:
      the number days between start and end, inclusive and exclusive respectively.
    • numberOfDays

      public int numberOfDays​(DBDateTime start, DBDateTime end, boolean endInclusive)
      Description copied from interface: Calendar
      Gets the number of days in a given range.
      Specified by:
      numberOfDays in interface Calendar
      Parameters:
      start - start of a time range; if null, return NULL_INT
      end - end of a time range; if null, return NULL_INT
      endInclusive - whether to treat the end inclusive or exclusively
      Returns:
      the number of days between start and end, inclusive and endInclusive respectively.
    • numberOfDays

      public int numberOfDays​(String start, String end)
      Description copied from interface: Calendar
      Gets the number of days in a given range, end date exclusive.
      Specified by:
      numberOfDays in interface Calendar
      Parameters:
      start - start of a time range; if null, return NULL_INT
      end - end of a time range; if null, return NULL_INT
      Returns:
      the number of days between start and end, inclusive and exclusive respectively.
    • numberOfDays

      public int numberOfDays​(String start, String end, boolean endInclusive)
      Description copied from interface: Calendar
      Gets the number of days in a given range.
      Specified by:
      numberOfDays in interface Calendar
      Parameters:
      start - start of a time range; if null, return NULL_INT
      end - end of a time range; if null, return NULL_INT
      endInclusive - whether to treat the end inclusive or exclusively
      Returns:
      the number of days between start and end, inclusive and endInclusive respectively.
    • diffNanos

      public long diffNanos​(DBDateTime start, DBDateTime end)
      Description copied from interface: Calendar
      Returns the amount of time in nanoseconds between start and end.
      Specified by:
      diffNanos in interface Calendar
      Parameters:
      start - start time; if null, return NULL_LONG
      end - end time; if null, return NULL_LONG
      Returns:
      the amount of time in nanoseconds between the start and end
    • diffDay

      public double diffDay​(DBDateTime start, DBDateTime end)
      Description copied from interface: Calendar
      Returns the amount of time in days between start and end.
      Specified by:
      diffDay in interface Calendar
      Parameters:
      start - start time; if null, return NULL_LONG
      end - end time; if null, return NULL_LONG
      Returns:
      the amount of time in days between the start and end
    • diffYear

      public double diffYear​(DBDateTime start, DBDateTime end)
      Description copied from interface: Calendar
      Returns the number of years between start and end.
      Specified by:
      diffYear in interface Calendar
      Parameters:
      start - start; if null, return null
      end - end; if null, return null
      Returns:
      the amount of time in years between the start and end
    • dayOfWeek

      public DayOfWeek dayOfWeek​(DBDateTime time)
      Description copied from interface: Calendar
      Gets the day of the week for a time.
      Specified by:
      dayOfWeek in interface Calendar
      Parameters:
      time - time; if null, return null
      Returns:
      the day of the week of time
    • dayOfWeek

      public DayOfWeek dayOfWeek​(String date)
      Description copied from interface: Calendar
      Gets the day of the week for a time.
      Specified by:
      dayOfWeek in interface Calendar
      Parameters:
      date - date; if null, return null
      Returns:
      the day of the week of date