Package org.gephi.graph.api.types
Class TimestampDoubleMap
- java.lang.Object
-
- org.gephi.graph.api.types.TimestampMap<Double>
-
- org.gephi.graph.api.types.TimestampDoubleMap
-
public final class TimestampDoubleMap extends TimestampMap<Double>
Sorted map where keys are timestamp and values double values.
-
-
Constructor Summary
Constructors Constructor Description TimestampDoubleMap()
Default constructor.TimestampDoubleMap(double[] keys, double[] vals)
Constructor with an initial timestamp map.TimestampDoubleMap(int capacity)
Constructor with capacity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getDouble(double timestamp)
Get the value for the given timestamp index.double
getDouble(double timestamp, double defaultValue)
Get the value for the given timestamp index.Class<Double>
getTypeClass()
Returns the value type class.boolean
isSupported(Estimator estimator)
Returns whetherestimator
is supported.double[]
toDoubleArray()
Returns an array of all values in this map.-
Methods inherited from class org.gephi.graph.api.types.TimestampMap
clear, contains, equals, get, get, getTimestamps, hashCode, isEmpty, put, remove, size, toKeysArray, toString, toString, toString, toValuesArray
-
-
-
-
Constructor Detail
-
TimestampDoubleMap
public TimestampDoubleMap()
Default constructor.The map is empty with zero capacity.
-
TimestampDoubleMap
public TimestampDoubleMap(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
-
TimestampDoubleMap
public TimestampDoubleMap(double[] keys, double[] vals)
Constructor with an initial timestamp map.The
keys
array must be sorted and contain no duplicates.- Parameters:
keys
- initial keys contentvals
- initial values content
-
-
Method Detail
-
getDouble
public double getDouble(double timestamp)
Get the value for the given timestamp index.- Parameters:
timestamp
- timestamp index- Returns:
- found value or the default value if not found
- Throws:
IllegalArgumentException
- if the element doesn't exist
-
getDouble
public double getDouble(double timestamp, double defaultValue)
Get the value for the given timestamp index.Return
defaultValue
if the value is not found.- Parameters:
timestamp
- timestamp indexdefaultValue
- default value- Returns:
- found value or the default value if not found
-
getTypeClass
public Class<Double> getTypeClass()
Description copied from interface:TimeMap
Returns the value type class.- Specified by:
getTypeClass
in interfaceTimeMap<Double,Double>
- Specified by:
getTypeClass
in classTimestampMap<Double>
- Returns:
- type class
-
toDoubleArray
public double[] toDoubleArray()
Returns an array of all values 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 values
-
isSupported
public boolean isSupported(Estimator estimator)
Description copied from interface:TimeMap
Returns whetherestimator
is supported.- Specified by:
isSupported
in interfaceTimeMap<Double,Double>
- Specified by:
isSupported
in classTimestampMap<Double>
- Parameters:
estimator
- estimator- Returns:
- true if this map supports
estimator
-
-