scale.common
Class IntMap<T>

java.lang.Object
  extended by scale.common.IntMap<T>

public class IntMap<T>
extends java.lang.Object

This class maps from an integer value to an Object.

$Id: IntMap.java,v 1.17 2007-10-04 19:58:10 burrill Exp $

Copyright 2008 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.


Constructor Summary
IntMap(int capacity)
           
 
Method Summary
 void clear()
          Remove all entries from the map.
 java.util.Enumeration<T> elements()
          Return an enumeration of all of the elements in the map.
 T get(int key)
          Find an entry in the map.
 T put(int key, T value)
          Place an entry in the map unless it is already there.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntMap

public IntMap(int capacity)
Parameters:
capacity - initial capacity - should be prime
Method Detail

clear

public void clear()
Remove all entries from the map.


put

public T put(int key,
             T value)
Place an entry in the map unless it is already there. There can be only one tuple with this key.

Parameters:
key - map from this key to the value
Returns:
the previous value

get

public T get(int key)
Find an entry in the map. There can be only one tuple with this key.

Parameters:
key - map from this key to the value
Returns:
the value

elements

public java.util.Enumeration<T> elements()
Return an enumeration of all of the elements in the map.