Package org.gephi.graph.api.types
Class TimestampShortMap
- java.lang.Object
-
- org.gephi.graph.api.types.TimestampMap<Short>
-
- org.gephi.graph.api.types.TimestampShortMap
-
public final class TimestampShortMap extends TimestampMap<Short>
Sorted map where keys are timestamp and values short values.
-
-
Constructor Summary
Constructors Constructor Description TimestampShortMap()
Default constructor.TimestampShortMap(double[] keys, short[] vals)
Constructor with an initial timestamp map.TimestampShortMap(int capacity)
Constructor with capacity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description short
getShort(double timestamp)
Get the value for the given timestamp.short
getShort(double timestamp, short defaultValue)
Get the value for the given timestamp.Class<Short>
getTypeClass()
Returns the value type class.boolean
isSupported(Estimator estimator)
Returns whetherestimator
is supported.short[]
toShortArray()
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
-
TimestampShortMap
public TimestampShortMap()
Default constructor.The map is empty with zero capacity.
-
TimestampShortMap
public TimestampShortMap(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
-
TimestampShortMap
public TimestampShortMap(double[] keys, short[] 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
-
getShort
public short getShort(double timestamp)
Get the value for the given timestamp.- Parameters:
timestamp
- timestamp- Returns:
- found value or the default value if not found
- Throws:
IllegalArgumentException
- if the element doesn't exist
-
getShort
public short getShort(double timestamp, short defaultValue)
Get the value for the given timestamp.Return
defaultValue
if the value is not found.- Parameters:
timestamp
- timestampdefaultValue
- default value- Returns:
- found value or the default value if not found
-
getTypeClass
public Class<Short> getTypeClass()
Description copied from interface:TimeMap
Returns the value type class.- Specified by:
getTypeClass
in interfaceTimeMap<Double,Short>
- Specified by:
getTypeClass
in classTimestampMap<Short>
- Returns:
- type class
-
toShortArray
public short[] toShortArray()
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,Short>
- Specified by:
isSupported
in classTimestampMap<Short>
- Parameters:
estimator
- estimator- Returns:
- true if this map supports
estimator
-
-