|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectwicket.util.time.TimeFrame
public final class TimeFrame
Immutable class which represents an interval of time with a beginning and an end. The beginning value is inclusive and the end value is exclusive. In other words, the time frame of 1pm to 2pm includes 1pm, but not 2pm. 1:59:59 is the last value in the timeframe.
TimeFrames can be constructed by calling the valueOf static factory methods valueOf(Time, Time) (yielding a TimeFrame between two absolute times) and valueOf(Time, Duration) yielding a TimeFrame starting at an absolute time and having a given length.
The start and end of a TimeFrame can be retrieved by calling getStart() and getEnd(). Its duration can be retrieved by calling getDuration().
The contains(Time) method can be called to determine if a TimeFrame contains a given point in time. The overlaps(TimeFrame) method can be called to determine if two TimeFrames overlap.
The eachDay(TimeOfDay, TimeOfDay) will return a TimeFrameSource which generates a timeframe using the two times of day. In other words, if the start is 3pm and the end is 4pm, the TimeFrameSource returned will yield 3-4pm on the day it is called (each day).
| Method Summary | |
|---|---|
boolean |
contains(Time time)
|
static ITimeFrameSource |
eachDay(TimeOfDay startTimeOfDay,
TimeOfDay endTimeOfDay)
Returns a timeframe source for a start and end time-of-day. |
Duration |
getDuration()
|
Time |
getEnd()
|
Time |
getStart()
|
TimeFrame |
getTimeFrame()
Implementation of ITimeFrameSource that simply returns this timeframe |
boolean |
overlaps(TimeFrame timeframe)
|
java.lang.String |
toString()
|
static TimeFrame |
valueOf(Time start,
Duration duration)
Creates a time frame for a start and duration |
static TimeFrame |
valueOf(Time start,
Time end)
Creates a time frame for a start and end time |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static ITimeFrameSource eachDay(TimeOfDay startTimeOfDay,
TimeOfDay endTimeOfDay)
startTimeOfDay - The start time for this time frame each dayendTimeOfDay - The end time for this time frame each day
public static TimeFrame valueOf(Time start,
Duration duration)
start - The start timeduration - The duration
java.lang.IllegalArgumentException - Thrown if start time is before end time
public static TimeFrame valueOf(Time start,
Time end)
start - The start timeend - The end time
java.lang.IllegalArgumentException - Thrown if start time is before end timepublic boolean contains(Time time)
time - The time to check
public Duration getDuration()
public Time getEnd()
public Time getStart()
public TimeFrame getTimeFrame()
getTimeFrame in interface ITimeFrameSourcepublic boolean overlaps(TimeFrame timeframe)
timeframe - The timeframe to test
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||