public class TimeInterval extends java.lang.Object implements java.lang.Comparable<TimeInterval>, java.lang.Cloneable
| Constructor and Description |
|---|
TimeInterval()
Default constructor that produces an infinite TimeInterval.
|
TimeInterval(java.util.Date start,
java.util.Date end)
Constructs a TimeInterval from the given start and end time values.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone() |
int |
compareTo(TimeInterval value)
Compares this object with the specified object for order.
|
boolean |
contains(TimeInterval value)
Determines if the given TimeInterval is inclusively contained
within this TimeInterval.
|
java.util.Date |
getEnd()
Provides the end Date of this time interval.
|
long |
getIntervalMilliseconds()
Provides the number of milliseconds in this time interval.
|
java.util.Date |
getStart()
Provides the start Date of this time interval.
|
static void |
main(java.lang.String[] args)
Provides a method of testing this class.
|
boolean |
overlaps(TimeInterval value)
Determines if the given TimeInterval overlaps in time with this
TimeInterval.
|
void |
setEnd(java.util.Date value)
Sets the end Date of this time interval.
|
void |
setStart(java.util.Date value)
Sets the start Date of this time interval.
|
java.lang.String |
toString()
Returns a String object representing this TimeInterval's value.
|
public TimeInterval()
public TimeInterval(java.util.Date start,
java.util.Date end)
start - beginning Date of time intervalend - ending Date of time intervalpublic java.util.Date getStart()
setStart(java.util.Date)public void setStart(java.util.Date value)
value - start Date of time intervalgetStart()public java.util.Date getEnd()
setEnd(java.util.Date)public void setEnd(java.util.Date value)
value - end Date of time interval.getEnd()public long getIntervalMilliseconds()
public int compareTo(TimeInterval value) throws java.lang.ClassCastException, java.lang.UnsupportedOperationException
compareTo in interface java.lang.Comparable<TimeInterval>value - the Object to be compared.java.lang.UnsupportedOperationException - if both the start time of this
interval and the start time of the given interval are
infinite (null).java.lang.ClassCastException - if the specified object's type prevents
it from being compared to this Object.public java.lang.String toString()
toString in class java.lang.Objectpublic boolean overlaps(TimeInterval value)
value - the TimeInterval to evaluate.public boolean contains(TimeInterval value)
value - the TimeInterval to evaluate.public java.lang.Object clone()
clone in class java.lang.Objectpublic static void main(java.lang.String[] args)
throws java.lang.Exception
args - command-line arguments. Currently ignored.java.lang.Exception - if any Exception occursCDAS Feedback.
Copyright © 2003-2021 United States Government as represented by the National Aeronautics and Space Administration. No copyright is claimed in the United States under Title 17, U.S.Code. All Other Rights Reserved.