Class DateRange

java.lang.Object
fc.util.Range
fc.util.DateRange

public class DateRange extends Range
A range of dates.

  • Constructor Details

    • DateRange

      public DateRange(Date start, Date end)
      Constructs a date range between the specified start and end dates (both inclusive).
      Throws:
      IllegalArgumentException - if the end date is lesser (via an compareTo comparison) than the start date (equal to the start date is ok)
  • Method Details

    • getStart

      public Date getStart()
      Get the start date for this range
    • getEnd

      public Date getEnd()
      Get the end date for this range
    • inRange

      public boolean inRange(Date d)
      Returns:
      true if the passed in date is inside this range. Note, the entire date (including the milliseconds/seconds portion) is considered by this function.
      Throws:
      IllegalArgumentException - if the specified date was null
    • overlaps

      public boolean overlaps(DateRange dr)
      Returns:
      true if any part of the passed in date range overlaps this range. Note, the entire date (including the milliseconds/seconds portion) is considered by this function.
      Throws:
      IllegalArgumentException - if the specified date was null
    • setStart

      public void setStart(Date d)
      Set the start date for this range
      Throws:
      NullPointerException - if the specified date was null
      IllegalArgumentException - if the specified date is greater (via an compareTo comparison) than the currently set end date (equal to the end date is ok)
    • setEnd

      public void setEnd(Date d)
      Sets the end date for this range
      Parameters:
      d - the end date
      Throws:
      NullPointerException - if the specified date was null
      IllegalArgumentException - if the specified end date is lesser (via an compareTo comparison) than the currently set start date (equal to the start date is ok)
    • toString

      public String toString()
      Output a string representation of the date range
      Overrides:
      toString in class Object
    • main

      public static void main(String[] args)