T - Value typepublic abstract class IntervalMap<T> extends Object implements TimeMap<Interval,T>
Implementations which extend this class customize the map for a unique type,
which is represented by the T parameter.
| Constructor and Description |
|---|
IntervalMap()
Default constructor.
|
IntervalMap(int capacity)
Constructor with capacity.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Empties this map.
|
boolean |
contains(double timestamp)
Returns true if this map contains an interval that starts or ends at
timestamp. |
boolean |
contains(Interval interval)
Returns true if this map contains the given key.
|
boolean |
equals(Object obj) |
Object |
get(Interval interval,
Estimator estimator)
Get the estimated value for the given interval.
|
T |
get(Interval interval,
T defaultValue)
Get the value for the given key.
|
double[] |
getIntervals()
Returns an array of all intervals in this set.
|
int |
hashCode() |
boolean |
isEmpty()
Returns true if this map is empty.
|
boolean |
put(Interval interval,
T value)
Put the value at the given key.
|
boolean |
remove(Interval interval)
Remove the value at the given key.
|
int |
size()
Returns the size.
|
Interval[] |
toKeysArray()
Returns all the keys as an array.
|
String |
toString() |
String |
toString(TimeFormat timeFormat) |
String |
toString(TimeFormat timeFormat,
DateTimeZone timeZone) |
T[] |
toValuesArray()
Returns all the values as an array.
|
getTypeClass, isSupportedpublic IntervalMap()
The map is empty with zero capacity.
public IntervalMap(int capacity)
Using this constructor can improve performances if the number of timestamps is known in advance as it minimizes array resizes.
capacity - timestamp capacitypublic boolean put(Interval interval, T value)
TimeMappublic boolean remove(Interval interval)
TimeMappublic Object get(Interval interval, Estimator estimator)
TimeMapThe estimator is used to determine the way multiple interval values are merged together (e.g average, first, median).
public T get(Interval interval, T defaultValue)
TimeMap
Return defaultValue if the value is not found.
public T[] toValuesArray()
TimeMaptoValuesArray in interface TimeMap<Interval,T>public int size()
TimeMappublic boolean isEmpty()
TimeMappublic boolean contains(double timestamp)
timestamp.timestamp - timestamppublic boolean contains(Interval interval)
TimeMappublic Interval[] toKeysArray()
TimeMaptoKeysArray in interface TimeMap<Interval,T>public double[] getIntervals()
The intervals are represented in a flat and sorted array (e.g. {[1.0,2.0], [5.0,6.0]}) returns [1.0,2.0,5.0,6.0]).
This method may return a reference to the underlying array so clients should make a copy if the array is written to.
public void clear()
TimeMappublic String toString(TimeFormat timeFormat, DateTimeZone timeZone)
public String toString(TimeFormat timeFormat)
Copyright © 2013–2015. All rights reserved.