public class TimeSequence extends java.lang.Object implements Sequential
| Constructor and Description |
|---|
TimeSequence()
Create a time sequence with no spans defined
|
TimeSequence(java.util.Collection<TimeSpan> timeSpans)
Create a time sequence from the collection of time spans
|
TimeSequence(java.util.List<java.util.Date> startDates,
java.util.List<java.util.Date> stopDates)
Create a TimeSequence by matching a set of start and stop dates.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTimeSegment(java.util.Date start,
java.util.Date stop)
Adds a time segment - a start/stop time - to the sequence's list of
start/stop times.
|
void |
addTimeSegment(java.util.Date start,
long duration)
Adds a time segment - a start/stop time - to the sequence's list of
start/stop times.
|
void |
addTimeSpan(TimeSpan span)
Adds a TimeSpan to the sequence's list of TimeSpans.
|
java.util.Date |
getActiveStartTime(java.util.Date time)
gets the start time of the time segment that includes time
|
java.util.Date |
getActiveStopTime(java.util.Date time)
gets the stop time of the time segment that includes time
|
java.util.Date |
getEarliestTime()
Returns the earliest time that this sequence is active.
|
java.util.Date |
getLatestTime()
Returns the latest time that this sequence is active.
|
java.util.SortedSet<TimeSpan> |
getTimeSpans()
returns a set of TimeSpan objects representing the sequence.
|
boolean |
isActive(java.util.Date testDate)
Returns whether the sequence of time spans is active at the test date.
|
boolean |
isActive(long millis)
Returns whether the sequence is active at the specified time.
|
public TimeSequence()
public TimeSequence(java.util.Collection<TimeSpan> timeSpans)
timeSpans - a collection of time spanspublic TimeSequence(java.util.List<java.util.Date> startDates,
java.util.List<java.util.Date> stopDates)
startDates - the list of start datesstopDates - the list of stop datespublic void addTimeSegment(java.util.Date start,
java.util.Date stop)
addTimeSegment in interface Sequentialstart - the new start timestop - the new stop timepublic void addTimeSegment(java.util.Date start,
long duration)
addTimeSegment in interface Sequentialstart - the new start timeduration - the duration of the time segment in millisecondspublic void addTimeSpan(TimeSpan span)
addTimeSpan in interface Sequentialspan - the new timespanpublic java.util.Date getActiveStartTime(java.util.Date time)
getActiveStartTime in interface Sequentialtime - the time to use to find the time segmentpublic java.util.Date getActiveStopTime(java.util.Date time)
getActiveStopTime in interface Sequentialtime - the time to use to find the time segmentpublic java.util.Date getEarliestTime()
getEarliestTime in interface Sequentialpublic java.util.Date getLatestTime()
getLatestTime in interface Sequentialpublic java.util.SortedSet<TimeSpan> getTimeSpans()
getTimeSpans in interface Sequentialpublic boolean isActive(java.util.Date testDate)
isActive in interface SequentialtestDate - the date to test to see if the sequence is active.public boolean isActive(long millis)
isActive in interface Sequentialmillis - the time, in milliseconds after Jan 1, 1970, to test to
see if the sequence is active.