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(Date start, Date end)
          Constructs a date range between the specified start and end dates (both inclusive).
 
Method Summary
 Date getEnd()
          Get the end date for this range
 Date getStart()
          Get the start date for this range
 boolean inRange(Date d)
           
static void main(String[] args)
           
 boolean overlaps(DateRange dr)
           
 void setEnd(Date d)
          Sets the end date for this range
 void setStart(Date d)
          Set the start date for this range
 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(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 Detail

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)