|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.util.AbstractMap
java.util.TreeMap
complex.IntegerTreeMap
A simple implementation of an IntegerMap, using a
TreeMap with value-type Integer.
IntegerMap,
Serialized Form| Nested Class Summary |
| Nested classes inherited from class java.util.TreeMap |
|
| Nested classes inherited from class java.util.AbstractMap |
|
| Nested classes inherited from class java.util.Map |
java.util.Map.Entry |
| Field Summary |
| Fields inherited from class java.util.TreeMap |
|
| Fields inherited from class java.util.AbstractMap |
|
| Constructor Summary | |
IntegerTreeMap()
Constructs a new, empty IntegerMap. |
|
IntegerTreeMap(java.util.Comparator c)
Constructs a new, empty IntegerMap, sorted according to the given Comparator. |
|
IntegerTreeMap(IntegerMap m)
Constructs a new map containing the same mappings as the given map. |
|
| Method Summary | |
void |
add(IntegerMap map)
Adds another IntegerMap to this map, by adding each entry
using add(Object, int). |
void |
add(java.lang.Object key,
int value)
Adds the specified value to the value already stored for the specified key. |
void |
addMultiple(IntegerMap map,
int factor)
Adds a multiple of another IntegerMap to this map,
which is (almost) equivalent to add(map.multiply(factor)),
except that the other map remains unchanged. |
boolean |
isZero()
Checks, if every value is zero (or null) |
void |
multiply(int value)
Multiplies each value of this map by a common factor |
java.lang.Object |
put(java.lang.Object key)
An equivalent to put(key,1) |
java.lang.Object |
put(java.lang.Object key,
int value)
Associates the specified (int) value with the specified key in this map. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Associates the specified (Integer) value with the specified key in this map. |
int |
value(java.lang.Object key)
Returns the value to which this map maps the specified key. |
| Methods inherited from class java.util.TreeMap |
clear, clone, comparator, containsKey, containsValue, entrySet, firstKey, get, headMap, keySet, lastKey, putAll, remove, size, subMap, tailMap, values |
| Methods inherited from class java.util.AbstractMap |
equals, hashCode, isEmpty, toString |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, values |
| Constructor Detail |
public IntegerTreeMap()
TreeMap.TreeMap()public IntegerTreeMap(java.util.Comparator c)
c - the comparator that will be used to sort this mapTreeMap.TreeMap(Comparator)public IntegerTreeMap(IntegerMap m)
m - the map that should be copiedTreeMap.TreeMap(Map)| Method Detail |
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
Integer.
This method is equivalent to put(key,value.intValue()).
put in interface java.util.Mapkey - the key with which the specified value is to be associatedvalue - the integer value
Map.put(java.lang.Object, java.lang.Object)
public java.lang.Object put(java.lang.Object key,
int value)
IntegerMap
put in interface IntegerMapkey - the key with which the specified value is to be associatedvalue - the integer value
public java.lang.Object put(java.lang.Object key)
IntegerMapput(key,1)
put in interface IntegerMapkey - the key to be entered into the map (with value 1)
public void multiply(int value)
IntegerMap
multiply in interface IntegerMapvalue - the factor, which is to be multiplied to each valuepublic int value(java.lang.Object key)
IntegerMap
value in interface IntegerMapkey - the key whose value should be returned
Map.get(Object)
public void add(java.lang.Object key,
int value)
IntegerMapput(key, value)
add in interface IntegerMapkey - the key whose value should be changedvalue - the increment of the valuepublic void add(IntegerMap map)
IntegerMapIntegerMap to this map, by adding each entry
using add(Object, int).
add in interface IntegerMapmap - the IntegerMap to be added
public void addMultiple(IntegerMap map,
int factor)
IntegerMapIntegerMap to this map,
which is (almost) equivalent to add(map.multiply(factor)),
except that the other map remains unchanged.
addMultiple in interface IntegerMapmap - the map to be addedfactor - the factor which is multiplied to the map, before adding it.public boolean isZero()
IntegerMap
isZero in interface IntegerMap
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||