Package org.gephi.graph.api.types
Class TimestampMap<T>
- java.lang.Object
-
- org.gephi.graph.api.types.TimestampMap<T>
-
- Type Parameters:
T
- Value type
- Direct Known Subclasses:
TimestampBooleanMap
,TimestampByteMap
,TimestampCharMap
,TimestampDoubleMap
,TimestampFloatMap
,TimestampIntegerMap
,TimestampLongMap
,TimestampShortMap
,TimestampStringMap
public abstract class TimestampMap<T> extends Object implements TimeMap<Double,T>
Abstract class that implement a sorted map between timestamp and attribute values.Implementations which extend this class customize the map for a unique type, which is represented by the
T
parameter.
-
-
Constructor Summary
Constructors Constructor Description TimestampMap()
Default constructor.TimestampMap(int capacity)
Constructor with capacity.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
clear()
Empties this map.boolean
contains(Double timestamp)
Returns true if this map contains the given key.boolean
equals(Object obj)
T
get(Double timestamp, T defaultValue)
Get the value for the given key.Object
get(Interval interval, Estimator estimator)
Get the estimated value for the given interval.double[]
getTimestamps()
Returns an array of all timestamps in this map.abstract Class<T>
getTypeClass()
Returns the value type class.int
hashCode()
boolean
isEmpty()
Returns true if this map is empty.abstract boolean
isSupported(Estimator estimator)
Returns whetherestimator
is supported.boolean
put(Double timestamp, T value)
Put the value at the given key.boolean
remove(Double timestamp)
Remove the value at the given key.int
size()
Returns the size.Double[]
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.
-
-
-
Constructor Detail
-
TimestampMap
public TimestampMap()
Default constructor.The map is empty with zero capacity.
-
TimestampMap
public TimestampMap(int capacity)
Constructor with capacity.Using this constructor can improve performances if the number of timestamps is known in advance as it minimizes array resizes.
- Parameters:
capacity
- timestamp capacity
-
-
Method Detail
-
put
public boolean put(Double timestamp, T value)
Description copied from interface:TimeMap
Put the value at the given key.
-
remove
public boolean remove(Double timestamp)
Description copied from interface:TimeMap
Remove the value at the given key.
-
get
public T get(Double timestamp, T defaultValue)
Description copied from interface:TimeMap
Get the value for the given key.Return
defaultValue
if the value is not found.
-
get
public Object get(Interval interval, Estimator estimator)
Description copied from interface:TimeMap
Get the estimated value for the given interval.The estimator is used to determine the way multiple interval values are merged together (e.g average, first, median).
-
toValuesArray
public T[] toValuesArray()
Description copied from interface:TimeMap
Returns all the values as an array.- Specified by:
toValuesArray
in interfaceTimeMap<Double,T>
- Returns:
- values array
-
getTypeClass
public abstract Class<T> getTypeClass()
Description copied from interface:TimeMap
Returns the value type class.- Specified by:
getTypeClass
in interfaceTimeMap<Double,T>
- Returns:
- type class
-
isSupported
public abstract boolean isSupported(Estimator estimator)
Description copied from interface:TimeMap
Returns whetherestimator
is supported.- Specified by:
isSupported
in interfaceTimeMap<Double,T>
- Parameters:
estimator
- estimator- Returns:
- true if this map supports
estimator
-
size
public int size()
Description copied from interface:TimeMap
Returns the size.
-
isEmpty
public boolean isEmpty()
Description copied from interface:TimeMap
Returns true if this map is empty.
-
contains
public boolean contains(Double timestamp)
Description copied from interface:TimeMap
Returns true if this map contains the given key.
-
getTimestamps
public double[] getTimestamps()
Returns an array of all timestamps in this map.This method may return a reference to the underlying array so clients should make a copy if the array is written to.
- Returns:
- array of all timestamps
-
toKeysArray
public Double[] toKeysArray()
Description copied from interface:TimeMap
Returns all the keys as an array.- Specified by:
toKeysArray
in interfaceTimeMap<Double,T>
- Returns:
- keys array
-
clear
public void clear()
Description copied from interface:TimeMap
Empties this map.
-
toString
public String toString(TimeFormat timeFormat, org.joda.time.DateTimeZone timeZone)
Description copied from interface:TimeMap
Returns this map as a string.
-
toString
public String toString(TimeFormat timeFormat)
Description copied from interface:TimeMap
Returns this map as a string.
-
-