jsat.utils
Class IntDoubleMapArray
- java.lang.Object
-
- java.util.AbstractMap<java.lang.Integer,java.lang.Double>
-
- jsat.utils.IntDoubleMapArray
-
- All Implemented Interfaces:
- java.util.Map<java.lang.Integer,java.lang.Double>
public class IntDoubleMapArray extends java.util.AbstractMap<java.lang.Integer,java.lang.Double>Provides a map from integers to doubles backed by index into an array.Double.NaNmay not be inserted and negative numbers may not be used for the key. This is meant as a convenience class, and should be used sparingly.
-
-
Nested Class Summary
-
Constructor Summary
Constructors Constructor and Description IntDoubleMapArray()IntDoubleMapArray(int max_index)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclear()booleancontainsKey(int key)booleancontainsKey(java.lang.Object key)java.util.Set<java.util.Map.Entry<java.lang.Integer,java.lang.Double>>entrySet()doubleget(int key)Returns the value to which the specified key is mapped, orDouble.NaNif this map contains no mapping for the key.java.lang.Doubleget(java.lang.Object key)doubleincrement(int key, double delta)doubleput(int key, double value)java.lang.Doubleput(java.lang.Integer key, java.lang.Double value)doubleremove(int key)java.lang.Doubleremove(java.lang.Object key)
-
-
-
Constructor Detail
-
IntDoubleMapArray
public IntDoubleMapArray()
-
IntDoubleMapArray
public IntDoubleMapArray(int max_index)
-
-
Method Detail
-
put
public java.lang.Double put(java.lang.Integer key, java.lang.Double value)- Specified by:
putin interfacejava.util.Map<java.lang.Integer,java.lang.Double>- Overrides:
putin classjava.util.AbstractMap<java.lang.Integer,java.lang.Double>
-
put
public double put(int key, double value)
-
increment
public double increment(int key, double delta)- Parameters:
key- the key whose associated value is to be incremented. All non-present keys behave as having an implicit value of zero, in which case the delta value is directly inserted into the map.delta- the amount by which to increment the key's stored value.- Returns:
- the new value stored for the given key
-
get
public double get(int key)
Returns the value to which the specified key is mapped, orDouble.NaNif this map contains no mapping for the key.- Parameters:
key- the key whose associated value is to be returned- Returns:
- the value to which the specified key is mapped, or
Double.NaNif this map contains no mapping for the key
-
get
public java.lang.Double get(java.lang.Object key)
- Specified by:
getin interfacejava.util.Map<java.lang.Integer,java.lang.Double>- Overrides:
getin classjava.util.AbstractMap<java.lang.Integer,java.lang.Double>
-
remove
public java.lang.Double remove(java.lang.Object key)
- Specified by:
removein interfacejava.util.Map<java.lang.Integer,java.lang.Double>- Overrides:
removein classjava.util.AbstractMap<java.lang.Integer,java.lang.Double>
-
remove
public double remove(int key)
- Parameters:
key-- Returns:
- the old value stored for this key, or
Double.NaNif the key was not present in the map
-
clear
public void clear()
- Specified by:
clearin interfacejava.util.Map<java.lang.Integer,java.lang.Double>- Overrides:
clearin classjava.util.AbstractMap<java.lang.Integer,java.lang.Double>
-
containsKey
public boolean containsKey(java.lang.Object key)
- Specified by:
containsKeyin interfacejava.util.Map<java.lang.Integer,java.lang.Double>- Overrides:
containsKeyin classjava.util.AbstractMap<java.lang.Integer,java.lang.Double>
-
containsKey
public boolean containsKey(int key)
-
entrySet
public java.util.Set<java.util.Map.Entry<java.lang.Integer,java.lang.Double>> entrySet()
- Specified by:
entrySetin interfacejava.util.Map<java.lang.Integer,java.lang.Double>- Specified by:
entrySetin classjava.util.AbstractMap<java.lang.Integer,java.lang.Double>
-
-
DataMelt 3.0 © DataMelt by jWork.ORG