public class Timeline extends TimelineList<java.lang.Object>
TimelineList
.
Note: this also overrides some functions to provide correct support for TimeOfDay style values (ie, times, not full dates). Specifically, that means that functions like getClosest, nextEvent, getSegment, will roll over to the earliest time if necessary. As a consequence, anyone calling these should note whether the return is earlier than the requested time, and accordingly adjust their calculations by 1 day.
Modifier and Type | Class and Description |
---|---|
protected static class |
Timeline.BaseParser |
protected static class |
Timeline.CalandarParser |
static interface |
Timeline.TimelineParser |
static class |
Timeline.TimelineStyle |
protected static class |
Timeline.TimeOfDayParser |
TimelineList.TimeSegment
Modifier and Type | Field and Description |
---|---|
protected Timeline.TimelineStyle |
style |
Constructor and Description |
---|
Timeline() |
Timeline(Timeline.TimelineStyle style)
Specifies the style of timeline that this is (in other words, what the times represent).
|
Modifier and Type | Method and Description |
---|---|
void |
addSegment(long start,
long end)
Adds a segment for the specified start and end times.
|
static Timeline.TimelineParser |
createParser(Timeline.TimelineStyle style) |
java.lang.Object |
getClosest(long time)
Returns the value for the given time, or the next defined value.
|
TimelineList.TimeSegment |
getSegment(long time,
boolean allowClosest)
Returns the segment that contains the time.
|
Timeline.TimelineStyle |
getStyle()
Returns the style defined for this timeline
|
Timeline |
invert()
Returns a timeline whose elements cover the inverse of the source timeline.
|
long |
nextEvent(long time)
Returns the next time that something interesting happens after the given time.
|
add, add, add, add, covered, get, get, getSegment, getSegment, getSegments, indexOf, mergeSegments, nextEvent, size, sort, toString
protected Timeline.TimelineStyle style
public Timeline()
public Timeline(Timeline.TimelineStyle style)
public Timeline.TimelineStyle getStyle()
public void addSegment(long start, long end)
public TimelineList.TimeSegment getSegment(long time, boolean allowClosest)
TimelineList
getSegment
in class TimelineList<java.lang.Object>
public java.lang.Object getClosest(long time)
TimelineList
getClosest
in class TimelineList<java.lang.Object>
public long nextEvent(long time)
TimelineList
nextEvent
in class TimelineList<java.lang.Object>
public static Timeline.TimelineParser createParser(Timeline.TimelineStyle style)
public Timeline invert()