|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.wicket.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)
Determines if this TimeFrame contains a given point in time. |
static ITimeFrameSource |
eachDay(TimeOfDay startTimeOfDay,
TimeOfDay endTimeOfDay)
Creates an ITimeFrameSource source for start and end TimeOfDays. |
boolean |
equals(Object obj)
|
Duration |
getDuration()
Retrieves the Duration of this TimeFrame. |
Time |
getEnd()
Retrieves the end Time of this TimeFrame. |
Time |
getStart()
Retrieves the start Time of this TimeFrame. |
TimeFrame |
getTimeFrame()
Implementation of ITimeFrameSource that simply returns this
TimeFrame. |
int |
hashCode()
|
boolean |
overlaps(TimeFrame timeframe)
Determines if two TimeFrames overlap. |
String |
toString()
Converts this TimeFrame to a String representation. |
static TimeFrame |
valueOf(Time start,
Duration duration)
Creates a TimeFrame for a start Time and Duration. |
static TimeFrame |
valueOf(Time start,
Time end)
Creates a TimeFrame for given start and end Times. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static ITimeFrameSource eachDay(TimeOfDay startTimeOfDay,
TimeOfDay endTimeOfDay)
ITimeFrameSource source for start and end TimeOfDays.
For example, called with 3pm and 5pm as parameters, the TimeFrame source
returned would produce TimeFrame objects representing 3pm-5pm on whatever day it
is when the caller calls the TimeFrameSource interface.
startTimeOfDay - the start TimeOfDay for this TimeFrame each dayendTimeOfDay - the end TimeOfDay for this TimeFrame each day
TimeFrameSource which will return the specified TimeFrame
each day
public static TimeFrame valueOf(Time start,
Duration duration)
TimeFrame for a start Time and Duration.
start - the start Timeduration - the Duration
TimeFrame
IllegalArgumentException - thrown if start Time value is before end Time value
public static TimeFrame valueOf(Time start,
Time end)
TimeFrame for given start and end Times.
start - the start Timeend - the end Time
TimeFrame
IllegalArgumentException - thrown if start Time value is before end Time valuepublic boolean contains(Time time)
TimeFrame contains a given point in time.
time - the Time to check
true if this TimeFrame contains the given timepublic Duration getDuration()
Duration of this TimeFrame.
Duration of this TimeFramepublic Time getEnd()
Time of this TimeFrame.
TimeFramepublic Time getStart()
Time of this TimeFrame.
TimeFramepublic TimeFrame getTimeFrame()
ITimeFrameSource that simply returns this
TimeFrame.
getTimeFrame in interface ITimeFrameSourceTimeFramepublic boolean overlaps(TimeFrame timeframe)
TimeFrames overlap.
timeframe - the TimeFrame to test
true if the given TimeFrame overlaps this onepublic int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic String toString()
TimeFrame to a String representation.
toString in class ObjectString representation of this object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||