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)
Returns this map as a string.
|
String |
toString(TimeFormat timeFormat,
org.joda.time.DateTimeZone timeZone)
Returns this map as a string.
|
T[] |
toValuesArray()
Returns all the values as an array.
|
getTypeClass, isSupported
public 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)
TimeMap
public boolean remove(Interval interval)
TimeMap
public Object get(Interval interval, Estimator estimator)
TimeMap
The 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()
TimeMap
toValuesArray
in interface TimeMap<Interval,T>
public int size()
TimeMap
public boolean isEmpty()
TimeMap
public boolean contains(double timestamp)
timestamp
.timestamp
- timestamppublic boolean contains(Interval interval)
TimeMap
public Interval[] toKeysArray()
TimeMap
toKeysArray
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()
TimeMap
public String toString(TimeFormat timeFormat, org.joda.time.DateTimeZone timeZone)
TimeMap
public String toString(TimeFormat timeFormat)
TimeMap
Copyright © 2007–2017 Gephi Consortium. All rights reserved.