jopt.csp.util
Class IntMap

java.lang.Object
  extended byjopt.csp.util.IntMap
All Implemented Interfaces:
java.lang.Cloneable

public class IntMap
extends java.lang.Object
implements java.lang.Cloneable

A map that uses integer keys and values


Constructor Summary
IntMap()
          Creates a new map
IntMap(IntMap im)
          Copy constructor
 
Method Summary
 void clear()
          Removes all values from the set
 boolean containsKey(int key)
          Returns true if this map contains a given key
 int get(int key, int defaultValue)
          Returns the value associated with a key
 void put(int key, int val)
          Adds a key to set
 void remove(int key)
          Removes a key from the map
 int size()
          Returns the size of the set
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntMap

public IntMap()
Creates a new map


IntMap

public IntMap(IntMap im)
Copy constructor

Parameters:
im - IntMap to be copied.
Method Detail

size

public int size()
Returns the size of the set


clear

public void clear()
Removes all values from the set


put

public void put(int key,
                int val)
Adds a key to set


remove

public void remove(int key)
Removes a key from the map


get

public int get(int key,
               int defaultValue)
Returns the value associated with a key

Parameters:
key - Key to retrieve associated value
defaultValue - Value to return if key is not in map

containsKey

public boolean containsKey(int key)
Returns true if this map contains a given key

Parameters:
key - Key to verify existence