public class TimeWindow
extends java.lang.Object
TimeWindow
represents a date and window centered around
the date.Constructor and Description |
---|
TimeWindow(java.util.Date centralDate,
long windowSize)
Creates a new time window.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.util.Date |
getCentralDate()
Gets the central date for the time window.
|
long |
getWindowSize()
Gets the window size.
|
boolean |
isInWindow(java.util.Date date)
Determines if a date is within the time window.
|
static void |
main(java.lang.String[] argv)
Tests this class.
|
java.lang.String |
toString() |
public TimeWindow(java.util.Date centralDate, long windowSize)
centralDate
- the central date for the time window.windowSize
- the time window size in milliseconds. Dates more than
this duration before or after the central date are considered to be outside
the window.public java.util.Date getCentralDate()
public long getWindowSize()
public boolean isInWindow(java.util.Date date)
date
- the date to check.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] argv) throws java.lang.Exception
argv
- the array of command line parameters.java.lang.Exception