com.anthonyeden.lib.util
Class DateRange

java.lang.Object
  extended bycom.anthonyeden.lib.util.DateRange

public class DateRange
extends java.lang.Object

* This class represents a continuous date range. * * @author Anthony Eden


Constructor Summary
DateRange()
          * Construct a new DateRange with null values for the start and * end date.
DateRange(java.util.Date startDate, java.util.Date endDate)
          * Construct a new DateRanger with the given start and end date.
 
Method Summary
 java.util.Date getEndDate()
          * Get the end date.
 double getSegmentCount(int segmentLength)
          * Return the number of segments in the range given that * a segment is segmentLength milliseconds.
 java.util.Date getStartDate()
          * Get the start date.
 boolean isWithinRange(java.util.Date date)
          * Return true if the given Date is after the start date and before the end * date.
 void setEndDate(java.util.Date endDate)
          * Set the end date.
 void setStartDate(java.util.Date startDate)
          * Set the start date.
 java.lang.String toString()
          * Return a String representation of the DateRange.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DateRange

public DateRange()
* Construct a new DateRange with null values for the start and * end date.


DateRange

public DateRange(java.util.Date startDate,
                 java.util.Date endDate)
* Construct a new DateRanger with the given start and end date. * * @param startDate The start date * @param endDate The end date

Method Detail

getStartDate

public java.util.Date getStartDate()
* Get the start date. This value may be null. * * @return The start date


setStartDate

public void setStartDate(java.util.Date startDate)
* Set the start date. This value may be null. * * @param startDate The new start date


getEndDate

public java.util.Date getEndDate()
* Get the end date. This value may be null. * * @return The end date


setEndDate

public void setEndDate(java.util.Date endDate)
* Set the end date. This value may be null. * * @param endDate The new end date


isWithinRange

public boolean isWithinRange(java.util.Date date)
* Return true if the given Date is after the start date and before the end * date. If either date is null then that part of the test will * automatically be true. * * @param date The Date to test * @return true if the Date is between the start and end date


getSegmentCount

public double getSegmentCount(int segmentLength)
                       throws java.lang.IllegalStateException
* Return the number of segments in the range given that * a segment is segmentLength milliseconds. * * @param segmentLength Segment length in milliseconds * @return The number of segments * @throws IllegalStateException If either the start or end date are not set

Throws:
java.lang.IllegalStateException

toString

public java.lang.String toString()
* Return a String representation of the DateRange. * * @return A String representing the date range



Copyright (c) 2000-2003 Anthony Eden. All Rights Reserved.