|
||||||||||
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
.
TimeFrame
s 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 TimeOfDay s. |
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 TimeFrame s 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 Time s. |
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 TimeOfDay
s.
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 daypublic static TimeFrame valueOf(Time start, Duration duration)
TimeFrame
for a start Time
and Duration
.
start
- the start Time
duration
- the Duration
TimeFrame
IllegalArgumentException
- thrown if start Time
value is before end Time
valuepublic static TimeFrame valueOf(Time start, Time end)
TimeFrame
for given start and end Time
s.
start
- the start Time
end
- 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 TimeFrame
public Time getEnd()
Time
of this TimeFrame
.
TimeFrame
public Time getStart()
Time
of this TimeFrame
.
TimeFrame
public TimeFrame getTimeFrame()
ITimeFrameSource
that simply returns this
TimeFrame
.
getTimeFrame
in interface ITimeFrameSource
TimeFrame
public boolean overlaps(TimeFrame timeframe)
TimeFrame
s overlap.
timeframe
- the TimeFrame
to test
true
if the given TimeFrame
overlaps this onepublic int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public String toString()
TimeFrame
to a String
representation.
toString
in class Object
String
representation of this object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |