Package org.gephi.graph.api.types
Class IntervalByteMap
- java.lang.Object
-
- org.gephi.graph.api.types.IntervalMap<Byte>
-
- org.gephi.graph.api.types.IntervalByteMap
-
public final class IntervalByteMap extends IntervalMap<Byte>
Sorted map where keys are intervals and values byte values.
-
-
Constructor Summary
Constructors Constructor Description IntervalByteMap()
Default constructor.IntervalByteMap(double[] keys, byte[] vals)
Constructor with an initial interval map.IntervalByteMap(int capacity)
Constructor with capacity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte
getByte(Interval interval)
Get the value for the given interval.byte
getByte(Interval interval, byte defaultValue)
Get the value for the given interval.Class<Byte>
getTypeClass()
Returns the value type class.boolean
isSupported(Estimator estimator)
Returns whetherestimator
is supported.byte[]
toByteArray()
Returns an array of all values in this map.-
Methods inherited from class org.gephi.graph.api.types.IntervalMap
clear, contains, contains, equals, get, get, getIntervals, hashCode, isEmpty, put, remove, size, toKeysArray, toString, toString, toString, toValuesArray
-
-
-
-
Constructor Detail
-
IntervalByteMap
public IntervalByteMap()
Default constructor.The map is empty with zero capacity.
-
IntervalByteMap
public IntervalByteMap(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
-
IntervalByteMap
public IntervalByteMap(double[] keys, byte[] vals)
Constructor with an initial interval map.The
keys
array must be in the same format returned byIntervalMap.getIntervals()
.- Parameters:
keys
- initial keys contentvals
- initial values content
-
-
Method Detail
-
getByte
public byte getByte(Interval interval)
Get the value for the given interval.- Parameters:
interval
- interval- Returns:
- found value or the default value if not found
- Throws:
IllegalArgumentException
- if the element doesn't exist
-
getByte
public byte getByte(Interval interval, byte defaultValue)
Get the value for the given interval.Return
defaultValue
if the value is not found.- Parameters:
interval
- intervaldefaultValue
- default value- Returns:
- found value or the default value if not found
-
toByteArray
public byte[] toByteArray()
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
-
getTypeClass
public Class<Byte> getTypeClass()
Description copied from interface:TimeMap
Returns the value type class.- Returns:
- type class
-
-