Class DateRange

    • Field Detail

      • INCLUSIVE_START

        public static final int INCLUSIVE_START
        A flag indicating whether to include the start of the period in test functions.
        See Also:
        Constant Field Values
      • INCLUSIVE_END

        public static final int INCLUSIVE_END
        A flag indicating whether to include the end of the period in test functions.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DateRange

        public DateRange​(Date start,
                         Date end)
        Parameters:
        start - the start of the range
        end - the end of the range
    • Method Detail

      • getRangeStart

        public Date getRangeStart()
        Returns:
        the rangeStart
      • getRangeEnd

        public Date getRangeEnd()
        Returns:
        the rangeEnd
      • includes

        public final boolean includes​(Date date)
        Determines if the specified date occurs within this period (inclusive of period start and end).
        Parameters:
        date - a date to test for inclusion
        Returns:
        true if the specified date occurs within the current period
      • includes

        public final boolean includes​(Date date,
                                      int inclusiveMask)
        Decides whether a date falls within this period.
        Parameters:
        date - the date to be tested
        inclusiveMask - specifies whether period start and end are included in the calculation
        Returns:
        true if the date is in the period, false otherwise
        See Also:
        INCLUSIVE_START, INCLUSIVE_END
      • before

        public final boolean before​(DateRange range)
        Decides whether this period is completed before the given period starts.
        Parameters:
        range - a period that may or may not start after this period ends
        Returns:
        true if the specified period starts after this periods ends, otherwise false
      • after

        public final boolean after​(DateRange range)
        Decides whether this period starts after the given period ends.
        Parameters:
        range - a period that may or may not end before this period starts
        Returns:
        true if the specified period end before this periods starts, otherwise false
      • intersects

        public final boolean intersects​(DateRange range)
        Decides whether this period intersects with another one.
        Parameters:
        range - a possible intersecting period
        Returns:
        true if the specified period intersects this one, false otherwise.
      • adjacent

        public final boolean adjacent​(DateRange range)
        Decides whether these periods are serial without a gap.
        Parameters:
        range - a period to test for adjacency
        Returns:
        true if one period immediately follows the other, false otherwise
      • contains

        public final boolean contains​(DateRange range)
        Decides whether the given period is completely contained within this one.
        Parameters:
        range - the period that may be contained by this one
        Returns:
        true if this period covers all the dates of the specified period, otherwise false
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object