
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 () |
Private Attributes | |
| transient Entry | table [] |
| transient int | count |
| int | threshold |
| float | loadFactor |
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.
| com::cosylab::acs::maci::manager::IntHashMap::IntHashMap | ( | ) | [inline] |
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 | ) | [inline] |
Constructs a new, empty hashtable with the specified initial capacity and default load factor, which is 0.75.
| initialCapacity | the initial capacity of the hashtable. |
| IllegalArgumentException | if the initial capacity is less than zero. |
| com::cosylab::acs::maci::manager::IntHashMap::IntHashMap | ( | int | initialCapacity, | |
| float | loadFactor | |||
| ) | [inline] |
Constructs a new, empty hashtable with the specified initial capacity and the specified load factor.
| initialCapacity | the initial capacity of the hashtable. | |
| loadFactor | the load factor of the hashtable. |
| IllegalArgumentException | if the initial capacity is less than zero, or if the load factor is nonpositive. |
| void com::cosylab::acs::maci::manager::IntHashMap::clear | ( | ) | [inline] |
| boolean com::cosylab::acs::maci::manager::IntHashMap::contains | ( | int | value | ) | [inline] |
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).
| value | a value to search for. |
true if and only if some key maps to the value argument in this hashtable as determined by the equals method; false otherwise. | NullPointerException | if the value is null. |
References com::cosylab::acs::maci::manager::IntHashMap::Entry::next, and table.
Referenced by containsValue().
| boolean com::cosylab::acs::maci::manager::IntHashMap::containsKey | ( | int | key | ) | [inline] |
Tests if the specified object is a key in this hashtable.
| key | possible key. |
true if and only if the specified object is a key in this hashtable, as determined by the equals method; false otherwise. References com::cosylab::acs::maci::manager::IntHashMap::Entry::next, and table.
| boolean com::cosylab::acs::maci::manager::IntHashMap::containsValue | ( | int | value | ) | [inline] |
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).
| value | value whose presence in this HashMap is to be tested. |
true if the value is contained References contains().
| int com::cosylab::acs::maci::manager::IntHashMap::get | ( | int | key | ) | [inline] |
Returns the value to which the specified key is mapped in this map.
| key | a key in the hashtable. |
-1 if the key is not mapped to any value in this hashtable. References com::cosylab::acs::maci::manager::IntHashMap::Entry::next, table, and com::cosylab::acs::maci::manager::IntHashMap::Entry::value.
Referenced by com::cosylab::acs::maci::manager::ComponentInfoTopologicalSort::extract().
| boolean com::cosylab::acs::maci::manager::IntHashMap::isEmpty | ( | ) | [inline] |
Tests if this hashtable maps no keys to values.
true if this hashtable maps no keys to values; false otherwise. References count.
| int com::cosylab::acs::maci::manager::IntHashMap::put | ( | int | key, | |
| int | value | |||
| ) | [inline] |
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.
| key | the hashtable key. | |
| value | the value. |
-1 if it did not have one. | NullPointerException | if the key is null. |
References count, com::cosylab::acs::maci::manager::IntHashMap::Entry::next, rehash(), table, threshold, and com::cosylab::acs::maci::manager::IntHashMap::Entry::value.
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 | ( | ) | [inline, 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.
References com::cosylab::acs::maci::manager::IntHashMap::Entry::hash, loadFactor, com::cosylab::acs::maci::manager::IntHashMap::Entry::next, table, and threshold.
Referenced by put().
| int com::cosylab::acs::maci::manager::IntHashMap::remove | ( | int | key | ) | [inline] |
Removes the key (and its corresponding value) from this hashtable.
This method does nothing if the key is not present in the hashtable.
| key | the key that needs to be removed. |
-1 if the key did not have a mapping. References count, com::cosylab::acs::maci::manager::IntHashMap::Entry::next, and table.
Referenced by com::cosylab::acs::maci::manager::ComponentInfoTopologicalSort::heapExtract().
| int com::cosylab::acs::maci::manager::IntHashMap::size | ( | ) | [inline] |
Returns the number of keys in this hashtable.
References count.
| int [] com::cosylab::acs::maci::manager::IntHashMap::toArray | ( | int[] | arr | ) | [inline] |
Copies values to array. Note that array capacity has to be large enough.
| arr | array to be filled | |
| array | (new if given not large enough) of values. |
References count, com::cosylab::acs::maci::manager::IntHashMap::Entry::next, table, and com::cosylab::acs::maci::manager::IntHashMap::Entry::value.
transient int com::cosylab::acs::maci::manager::IntHashMap::count [private] |
float com::cosylab::acs::maci::manager::IntHashMap::loadFactor [private] |
The load factor for the hashtable.
Referenced by rehash().
transient Entry com::cosylab::acs::maci::manager::IntHashMap::table[] [private] |
The hash table data.
Referenced by clear(), contains(), containsKey(), get(), IntHashMap(), put(), rehash(), remove(), and toArray().
int com::cosylab::acs::maci::manager::IntHashMap::threshold [private] |
The table is rehashed when its size exceeds this threshold. (The value of this field is (int)(capacity * loadFactor).)
Referenced by IntHashMap(), put(), and rehash().
1.6.2