public interface ITimeSpan extends Comparable<ITimeSpan>, Serializable
Comparable
interface, which allows for easy sorting based on the
start time.TimeSpanIterator
Modifier and Type | Method and Description |
---|---|
boolean |
contains(ITimeSpan span)
Checks whether the time span contains the given time span.
|
boolean |
contains(long time)
Checks whether the time span contains the given time point.
|
boolean |
endsAfter(ITimeSpan span)
Checks whether the given time span ends after this time span.
|
boolean |
endsBefore(ITimeSpan span)
Checks whether the given time span ends before this time span.
|
boolean |
equalDuration(ITimeSpan span)
Checks whether the given time span has exactly the same duration as this
time span.
|
boolean |
equals(ITimeSpan span)
Two time spans are considered equal if their start times and their end
times are identical.
|
long |
getDuration()
Calculates the total duration of this time span.
|
long |
getEndTime()
Returns the time span's end time.
|
long |
getStartTime()
Returns the time span's start time.
|
ITimeSpan |
intersection(ITimeSpan span)
Returns the intersection between the time span and the given time span.
|
boolean |
intersects(ITimeSpan span)
Checks whether the given time span intersects with this time span.
|
boolean |
isActivity()
Determines whether this time span represents an activity.
|
boolean |
isEvent()
Determines whether this time span represents an event.
|
boolean |
isUndefined()
Checks whether this time span is undefined.
|
ITimeSpan |
move(long delta)
Constructs a new time span based on this span where the given (delta)
milliseconds are added to (or subtracted from if negative) the start and
end time of this time span.
|
boolean |
startsAfter(ITimeSpan span)
Checks whether the given time span starts after this time span.
|
boolean |
startsBefore(ITimeSpan span)
Checks whether the given time span starts before this time span.
|
String |
toString(DateFormat format)
Returns a compact string representation of the time span.
|
ITimeSpan |
union(ITimeSpan span)
The union of two time spans is a new time span, where the start time of
the new span is the minimum start time and the end time is the maximum
end time of the two spans.
|
compareTo
long getStartTime()
getEndTime()
long getEndTime()
getStartTime()
boolean contains(ITimeSpan span)
span
- the time span to test for containmentintersects(ITimeSpan)
boolean contains(long time)
time
- the time point to test for containmentcontains(ITimeSpan)
,
intersects(ITimeSpan)
boolean endsAfter(ITimeSpan span)
span
- the time span to testendsBefore(ITimeSpan)
boolean endsBefore(ITimeSpan span)
span
- the time span to testendsAfter(ITimeSpan)
boolean equalDuration(ITimeSpan span)
span
- the time span to testgetDuration()
long getDuration()
equalDuration(ITimeSpan)
boolean intersects(ITimeSpan span)
span
- the time span to test for intersectioncontains(ITimeSpan)
ITimeSpan intersection(ITimeSpan span)
isUndefined()
) if the two
time spans do not intersect at all.span
- the time span for which to calculate the intersectionboolean isActivity()
isEvent()
boolean isEvent()
isEvent()
ITimeSpan move(long delta)
delta
- the amount of milliseconds to add to or subtract from the new
time span's start and end timeboolean startsAfter(ITimeSpan span)
span
- the time span to teststartsBefore(ITimeSpan)
boolean startsBefore(ITimeSpan span)
span
- the time span to teststartsAfter(ITimeSpan)
ITimeSpan union(ITimeSpan span)
isUndefined()
). If only one of
the spans is undefined then the other span becomes the result of the
union operation. If both of them are undefined then the result will be
undefined, too.span
- the second time span for the unionboolean equals(ITimeSpan span)
span
- the time span to testboolean isUndefined()
union(ITimeSpan)
first checks
whether the span on which the method gets called is undefined. If so and
the given second time span is not undefined then the result of the union
operation will be a copy of the second span).String toString(DateFormat format)
format
- the formatter used to create a date stringCopyright © 2006–2016 Dirk Lemmermann Software & Consulting. All rights reserved.