ch.javasoft.util.intcoll
Class KeyRangeIntIntMap

java.lang.Object
  extended by java.util.AbstractMap<Integer,Integer>
      extended by ch.javasoft.util.intcoll.AbstractIntIntMap
          extended by ch.javasoft.util.intcoll.KeyRangeIntIntMap
All Implemented Interfaces:
IntIntMap, IntMap<Integer>, Serializable, Map<Integer,Integer>

public class KeyRangeIntIntMap
extends AbstractIntIntMap
implements Serializable

KeyRangeIntIntMap is an immutable mapping from int to int. The lowest key is zero, the next larger key is one and so on, i.e. all k keys are key in [0..k-1]. The values can be any integer value.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class ch.javasoft.util.intcoll.AbstractIntIntMap
AbstractIntIntMap.ImmutableIntIntEntry, AbstractIntIntMap.SimpleIntIntEntry
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface ch.javasoft.util.intcoll.IntIntMap
IntIntMap.IntIntEntry
 
Nested classes/interfaces inherited from interface ch.javasoft.util.intcoll.IntMap
IntMap.IntEntry<V>
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
KeyRangeIntIntMap(int size)
          Constructor for a new identity mapping, i.e.
KeyRangeIntIntMap(int[] mapping)
           
 
Method Summary
 void clear()
          Always throws an UnsupportedOperationException
 boolean containsKey(int key)
           
 boolean containsValue(int value)
           
 boolean equals(Object o)
           
 int getInt(int key)
          Returns the int value for the specified key, or throws a NoSuchElementException otherwise
 Set<IntIntMap.IntIntEntry> intIntEntrySet()
           
 boolean isEmpty()
           
 IntSet keySet()
           
 Integer put(Integer key, Integer value)
          Always throws an UnsupportedOperationException
 Integer put(int key, int value)
          Always throws an UnsupportedOperationException
 Integer put(int key, Integer value)
          Always throws an UnsupportedOperationException
 void putAll(IntIntMap map)
          Always throws an UnsupportedOperationException
 void putAll(IntMap<? extends Integer> map)
          Always throws an UnsupportedOperationException
 void putAll(Map<? extends Integer,? extends Integer> map)
          Always throws an UnsupportedOperationException
 Integer remove(int key)
          Always throws an UnsupportedOperationException
 Integer remove(Object key)
          Always throws an UnsupportedOperationException
 int size()
           
 int[] toArray()
          Returns a copy of the underlying mapping array.
 IntCollection values()
           
 
Methods inherited from class ch.javasoft.util.intcoll.AbstractIntIntMap
containsKey, containsValue, entrySet, get, get, intEntrySet
 
Methods inherited from class java.util.AbstractMap
clone, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
hashCode
 

Constructor Detail

KeyRangeIntIntMap

public KeyRangeIntIntMap(int size)
Constructor for a new identity mapping, i.e. val[key] == key


KeyRangeIntIntMap

public KeyRangeIntIntMap(int[] mapping)
Method Detail

getInt

public int getInt(int key)
Description copied from interface: IntIntMap
Returns the int value for the specified key, or throws a NoSuchElementException otherwise

Specified by:
getInt in interface IntIntMap
Parameters:
key - the key for which the value shall be returned
Returns:
the value associated with the given key

containsKey

public boolean containsKey(int key)
Specified by:
containsKey in interface IntIntMap
Specified by:
containsKey in interface IntMap<Integer>
Overrides:
containsKey in class AbstractIntIntMap

containsValue

public boolean containsValue(int value)
Specified by:
containsValue in interface IntIntMap

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<Integer,Integer>
Overrides:
isEmpty in class AbstractIntIntMap

size

public int size()
Specified by:
size in interface Map<Integer,Integer>
Overrides:
size in class AbstractMap<Integer,Integer>

keySet

public IntSet keySet()
Specified by:
keySet in interface IntMap<Integer>
Specified by:
keySet in interface Map<Integer,Integer>
Specified by:
keySet in class AbstractIntIntMap

intIntEntrySet

public Set<IntIntMap.IntIntEntry> intIntEntrySet()
Specified by:
intIntEntrySet in interface IntIntMap

values

public IntCollection values()
Specified by:
values in interface IntIntMap
Specified by:
values in interface Map<Integer,Integer>
Specified by:
values in class AbstractIntIntMap

toArray

public int[] toArray()
Returns a copy of the underlying mapping array. The value corresponding to a key k is array[k].

Returns:
a copy of the mapping array

equals

public boolean equals(Object o)
Specified by:
equals in interface Map<Integer,Integer>
Overrides:
equals in class AbstractMap<Integer,Integer>

put

public Integer put(int key,
                   Integer value)
Always throws an UnsupportedOperationException

Specified by:
put in interface IntMap<Integer>
Overrides:
put in class AbstractIntIntMap
Throws:
UnsupportedOperationException - always
See Also:
IntMap.put(int, java.lang.Object)

put

public Integer put(int key,
                   int value)
Always throws an UnsupportedOperationException

Specified by:
put in interface IntIntMap
Throws:
UnsupportedOperationException - always
See Also:
IntIntMap.put(int, int)

put

public Integer put(Integer key,
                   Integer value)
Always throws an UnsupportedOperationException

Specified by:
put in interface Map<Integer,Integer>
Overrides:
put in class AbstractIntIntMap
Throws:
UnsupportedOperationException - always
See Also:
AbstractIntIntMap.put(java.lang.Integer, java.lang.Integer)

putAll

public void putAll(Map<? extends Integer,? extends Integer> map)
Always throws an UnsupportedOperationException

Specified by:
putAll in interface Map<Integer,Integer>
Overrides:
putAll in class AbstractIntIntMap
Throws:
UnsupportedOperationException - always
See Also:
AbstractIntIntMap.putAll(java.util.Map)

putAll

public void putAll(IntMap<? extends Integer> map)
Always throws an UnsupportedOperationException

Specified by:
putAll in interface IntMap<Integer>
Overrides:
putAll in class AbstractIntIntMap
Throws:
UnsupportedOperationException - always
See Also:
IntMap.putAll(ch.javasoft.util.intcoll.IntMap)

putAll

public void putAll(IntIntMap map)
Always throws an UnsupportedOperationException

Specified by:
putAll in interface IntIntMap
Overrides:
putAll in class AbstractIntIntMap
Throws:
UnsupportedOperationException - always
See Also:
IntIntMap.putAll(ch.javasoft.util.intcoll.IntIntMap)

remove

public Integer remove(int key)
Always throws an UnsupportedOperationException

Specified by:
remove in interface IntMap<Integer>
Throws:
UnsupportedOperationException - always
See Also:
IntMap.remove(int)

remove

public Integer remove(Object key)
Always throws an UnsupportedOperationException

Specified by:
remove in interface Map<Integer,Integer>
Overrides:
remove in class AbstractIntIntMap
Throws:
UnsupportedOperationException - always
See Also:
AbstractIntIntMap.remove(java.lang.Object)

clear

public void clear()
Always throws an UnsupportedOperationException

Specified by:
clear in interface Map<Integer,Integer>
Overrides:
clear in class AbstractMap<Integer,Integer>
Throws:
UnsupportedOperationException - always
See Also:
AbstractMap.clear()