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
Tparameter.
-
-
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 voidclear()Empties this map.booleancontains(Double timestamp)Returns true if this map contains the given key.booleanequals(Object obj)Tget(Double timestamp, T defaultValue)Get the value for the given key.Objectget(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.inthashCode()booleanisEmpty()Returns true if this map is empty.abstract booleanisSupported(Estimator estimator)Returns whetherestimatoris supported.booleanput(Double timestamp, T value)Put the value at the given key.booleanremove(Double timestamp)Remove the value at the given key.intsize()Returns the size.Double[]toKeysArray()Returns all the keys as an array.StringtoString()StringtoString(TimeFormat timeFormat)Returns this map as a string.StringtoString(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:TimeMapPut the value at the given key.
-
remove
public boolean remove(Double timestamp)
Description copied from interface:TimeMapRemove the value at the given key.
-
get
public T get(Double timestamp, T defaultValue)
Description copied from interface:TimeMapGet the value for the given key.Return
defaultValueif the value is not found.
-
get
public Object get(Interval interval, Estimator estimator)
Description copied from interface:TimeMapGet 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:TimeMapReturns all the values as an array.- Specified by:
toValuesArrayin interfaceTimeMap<Double,T>- Returns:
- values array
-
getTypeClass
public abstract Class<T> getTypeClass()
Description copied from interface:TimeMapReturns the value type class.- Specified by:
getTypeClassin interfaceTimeMap<Double,T>- Returns:
- type class
-
isSupported
public abstract boolean isSupported(Estimator estimator)
Description copied from interface:TimeMapReturns whetherestimatoris supported.- Specified by:
isSupportedin interfaceTimeMap<Double,T>- Parameters:
estimator- estimator- Returns:
- true if this map supports
estimator
-
size
public int size()
Description copied from interface:TimeMapReturns the size.
-
isEmpty
public boolean isEmpty()
Description copied from interface:TimeMapReturns true if this map is empty.
-
contains
public boolean contains(Double timestamp)
Description copied from interface:TimeMapReturns 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:TimeMapReturns all the keys as an array.- Specified by:
toKeysArrayin interfaceTimeMap<Double,T>- Returns:
- keys array
-
clear
public void clear()
Description copied from interface:TimeMapEmpties this map.
-
toString
public String toString(TimeFormat timeFormat, org.joda.time.DateTimeZone timeZone)
Description copied from interface:TimeMapReturns this map as a string.
-
toString
public String toString(TimeFormat timeFormat)
Description copied from interface:TimeMapReturns this map as a string.
-
-