fc.util
Class DateRange

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

public class DateRange
extends Range

A range of dates.


Constructor Summary
DateRange(java.util.Date start, java.util.Date end)
          Constructs a date range between the specified start and end dates (both inclusive).
 
Method Summary
 java.util.Date getEnd()
          Get the end date for this range
 java.util.Date getStart()
          Get the start date for this range
 boolean inRange(java.util.Date d)
           
static void main(java.lang.String[] args)
           
 boolean overlaps(DateRange dr)
           
 void setEnd(java.util.Date d)
          Sets the end date for this range
 void setStart(java.util.Date d)
          Set the start date for this range
 java.lang.String toString()
          Output a string representation of the date range
 
Methods inherited from class fc.util.Range
isNegated, setNegated
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DateRange

public DateRange(java.util.Date start,
                 java.util.Date end)
Constructs a date range between the specified start and end dates (both inclusive).

Throws:
java.lang.IllegalArgumentException - if the end date is lesser (via an compareTo comparison) than the start date (equal to the start date is ok)
Method Detail

getStart

public java.util.Date getStart()
Get the start date for this range


getEnd

public java.util.Date getEnd()
Get the end date for this range


inRange

public boolean inRange(java.util.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:
java.lang.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:
java.lang.IllegalArgumentException - if the specified date was null

setStart

public void setStart(java.util.Date d)
Set the start date for this range

Throws:
java.lang.NullPointerException - if the specified date was null
java.lang.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(java.util.Date d)
Sets the end date for this range

Parameters:
d - the end date
Throws:
java.lang.NullPointerException - if the specified date was null
java.lang.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 java.lang.String toString()
Output a string representation of the date range

Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)