Classes | Public Member Functions | Protected Member Functions

com.cosylab.acs.maci.manager.IntHashMap Class Reference

List of all members.

Classes

class  Entry

Public Member Functions

 IntHashMap ()
 IntHashMap (int initialCapacity)
 IntHashMap (int initialCapacity, float loadFactor)
int size ()
boolean isEmpty ()
boolean contains (int value)
boolean containsValue (int value)
boolean containsKey (int key)
int get (int key)
int put (int key, int value)
int remove (int key)
void clear ()
int[] toArray (int[] arr)

Protected Member Functions

void rehash ()

Detailed Description

A hash map that uses primitive ints for the key and values instead of objects. NOTE: this implementatio is not synced, client has to care of that.

This implemenation is based on original java implementation.

Author:
Matej Sekoranja
Version:
$id$
See also:
java.util.HashMap

Constructor & Destructor Documentation

com.cosylab.acs.maci.manager.IntHashMap.IntHashMap (  ) 

Constructs a new, empty hashtable with a default capacity and load factor, which is 20 and 0.75 respectively.

com.cosylab.acs.maci.manager.IntHashMap.IntHashMap ( int  initialCapacity  ) 

Constructs a new, empty hashtable with the specified initial capacity and default load factor, which is 0.75.

Parameters:
initialCapacity the initial capacity of the hashtable.
Exceptions:
IllegalArgumentException if the initial capacity is less than zero.
com.cosylab.acs.maci.manager.IntHashMap.IntHashMap ( int  initialCapacity,
float  loadFactor 
)

Constructs a new, empty hashtable with the specified initial capacity and the specified load factor.

Parameters:
initialCapacity the initial capacity of the hashtable.
loadFactor the load factor of the hashtable.
Exceptions:
IllegalArgumentException if the initial capacity is less than zero, or if the load factor is nonpositive.

Member Function Documentation

void com.cosylab.acs.maci.manager.IntHashMap.clear (  ) 

Clears this hashtable so that it contains no keys.

boolean com.cosylab.acs.maci.manager.IntHashMap.contains ( int  value  ) 

Tests if some key maps into the specified value in this hashtable. This operation is more expensive than the containsKey method.

Note that this method is identical in functionality to containsValue, (which is part of the Map interface in the collections framework).

Parameters:
value a value to search for.
Returns:
true if and only if some key maps to the value argument in this hashtable as determined by the equals method; false otherwise.
Exceptions:
NullPointerException if the value is null.
See also:
containsKey(int)
containsValue(Object)
java.util.Map

Referenced by com.cosylab.acs.maci.manager.IntHashMap.containsValue().

boolean com.cosylab.acs.maci.manager.IntHashMap.containsKey ( int  key  ) 

Tests if the specified object is a key in this hashtable.

Parameters:
key possible key.
Returns:
true if and only if the specified object is a key in this hashtable, as determined by the equals method; false otherwise.
See also:
contains(Object)
boolean com.cosylab.acs.maci.manager.IntHashMap.containsValue ( int  value  ) 

Returns true if this HashMap maps one or more keys to this value.

Note that this method is identical in functionality to contains (which predates the Map interface).

Parameters:
value value whose presence in this HashMap is to be tested.
Returns:
boolean true if the value is contained
See also:
java.util.Map
Since:
JDK1.2

References com.cosylab.acs.maci.manager.IntHashMap.contains().

int com.cosylab.acs.maci.manager.IntHashMap.get ( int  key  ) 

Returns the value to which the specified key is mapped in this map.

Parameters:
key a key in the hashtable.
Returns:
the value to which the key is mapped in this hashtable; -1 if the key is not mapped to any value in this hashtable.
See also:
put(int, Object)

Referenced by com.cosylab.acs.maci.manager.ComponentInfoTopologicalSort.extract().

boolean com.cosylab.acs.maci.manager.IntHashMap.isEmpty (  ) 

Tests if this hashtable maps no keys to values.

Returns:
true if this hashtable maps no keys to values; false otherwise.
int com.cosylab.acs.maci.manager.IntHashMap.put ( int  key,
int  value 
)

Maps the specified key to the specified value in this hashtable. The key cannot be null.

The value can be retrieved by calling the get method with a key that is equal to the original key.

Parameters:
key the hashtable key.
value the value.
Returns:
the previous value of the specified key in this hashtable, or -1 if it did not have one.
Exceptions:
NullPointerException if the key is null.
See also:
get(int)

References com.cosylab.acs.maci.manager.IntHashMap.rehash().

Referenced by com.cosylab.acs.maci.manager.ComponentInfoTopologicalSort.downheap(), and com.cosylab.acs.maci.manager.ComponentInfoTopologicalSort.heapExtract().

void com.cosylab.acs.maci.manager.IntHashMap.rehash (  )  [protected]

Increases the capacity of and internally reorganizes this hashtable, in order to accommodate and access its entries more efficiently.

This method is called automatically when the number of keys in the hashtable exceeds this hashtable's capacity and load factor.

Referenced by com.cosylab.acs.maci.manager.IntHashMap.put().

int com.cosylab.acs.maci.manager.IntHashMap.remove ( int  key  ) 

Removes the key (and its corresponding value) from this hashtable.

This method does nothing if the key is not present in the hashtable.

Parameters:
key the key that needs to be removed.
Returns:
the value to which the key had been mapped in this hashtable, or -1 if the key did not have a mapping.

Referenced by com.cosylab.acs.maci.manager.ComponentInfoTopologicalSort.heapExtract().

int com.cosylab.acs.maci.manager.IntHashMap.size (  ) 

Returns the number of keys in this hashtable.

Returns:
the number of keys in this hashtable.
int [] com.cosylab.acs.maci.manager.IntHashMap.toArray ( int[]  arr  ) 

Copies values to array. Note that array capacity has to be large enough.

Parameters:
arr array to be filled
array (new if given not large enough) of values.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties