org.axiondb.engine.rowcollection
Class IntHashMap

java.lang.Object
  extended by org.axiondb.engine.rowcollection.IntHashMap
Direct Known Subclasses:
IntRowMap

public class IntHashMap
extends java.lang.Object

Int key and Object value Map, this does not implement java.util.Map interface and has limited Map like API. Does not implement EntrySet and and KeySet, tather it just retunds their iterator.

Version:
$Revision: 1.2 $ $Date: 2005/12/22 09:02:30 $

Nested Class Summary
static class IntHashMap.Entry
          This class represents a IntHashMapentry.
 class IntHashMap.EntryIterator
           
 class IntHashMap.ValueIterator
           
protected  class IntHashMap.Values
           
 
Constructor Summary
IntHashMap()
          Creates an IntHashMap of small initial capacity.
IntHashMap(int capacity)
          Creates an IntHashMap of specified initial capacity.
IntHashMap(IntHashMap map)
          Creates a IntHashMap containing the specified entries, in the order they are returned by the map's iterator.
 
Method Summary
protected  void addEntry(int hash, int key, java.lang.Object value)
          Adds a new entry for the specified key and value.
 void clear()
          Removes all mappings from this IntHashMap.
 boolean containsKey(int key)
          Indicates if this IntHashMapcontains a mapping for the specified key.
 boolean containsValue(java.lang.Object value)
          Indicates if this IntHashMapmaps one or more keys to the specified value.
 IntHashMap.EntryIterator entryIterator()
           
 boolean equals(java.lang.Object obj)
          Compares the specified object with this IntHashMapfor equality.
 java.lang.Object get(int key)
          Returns the value to which this IntHashMapmaps the specified key.
 IntHashMap.Entry getEntry(int key)
          Returns the entry with the specified key.
 int hashCode()
          Returns the hash code value for this IntHashMap.
 IntHashMap.Entry headEntry()
          Returns the head entry of this map.
 boolean isEmpty()
          Indicates if this IntHashMapcontains no key-value mappings.
 org.apache.commons.collections.primitives.IntListIterator keyIterator()
           
 org.apache.commons.collections.primitives.IntCollection keys()
           
protected  IntHashMap.Entry newEntry()
          Returns a new entry for this map; sub-classes may override this method to use custom entries.
 java.lang.Object put(int key, java.lang.Object value)
          Associates the specified value with the specified key in this IntHashMap.
 void putAll(IntHashMap that)
          Copies all of the mappings from the specified map to this IntHashMap.
 java.lang.Object remove(int key)
          Removes the mapping for this key from this IntHashMapif present.
 void removeEntry(IntHashMap.Entry entry)
          Removes the specified entry from the map.
 int size()
          Returns the number of key-value mappings in this IntHashMap.
 IntHashMap.Entry tailEntry()
          Returns the tail entry of this map.
 java.lang.String toString()
          Returns the textual representation of this IntHashMap.
 IntHashMap.ValueIterator valueIterator()
          Returns a list iterator over the values in this list in proper sequence, (this map maintains the insertion order).
 IntHashMap.Values values()
          Returns a RowCollectionview of the values contained in this IntHashMap.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntHashMap

public IntHashMap()
Creates an IntHashMap of small initial capacity.


IntHashMap

public IntHashMap(int capacity)
Creates an IntHashMap of specified initial capacity. Unless the map size exceeds the specified capacity no memory allocation is ever performed.

Parameters:
capacity - the initial capacity.

IntHashMap

public IntHashMap(IntHashMap map)
Creates a IntHashMap containing the specified entries, in the order they are returned by the map's iterator.

Parameters:
map - the map whose entries are to be placed into this map.
Method Detail

clear

public void clear()
Removes all mappings from this IntHashMap.


containsKey

public final boolean containsKey(int key)
Indicates if this IntHashMapcontains a mapping for the specified key.

Parameters:
key - the key whose presence in this map is to be tested.
Returns:
true if this map contains a mapping for the specified key; false otherwise.

containsValue

public final boolean containsValue(java.lang.Object value)
Indicates if this IntHashMapmaps one or more keys to the specified value.

Parameters:
value - the value whose presence in this map is to be tested.
Returns:
true if this map maps one or more keys to the specified value.

entryIterator

public IntHashMap.EntryIterator entryIterator()

equals

public boolean equals(java.lang.Object obj)
Compares the specified object with this IntHashMapfor equality. Returns true if the given object is also a map and the two maps represent the same mappings (regardless of collection iteration order).

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to be compared for equality with this map.
Returns:
true if the specified object is equal to this map; false otherwise.

get

public final java.lang.Object get(int key)
Returns the value to which this IntHashMapmaps the specified key.

Parameters:
key - the key whose associated value is to be returned.
Returns:
the value to which this map maps the specified key, or null if there is no mapping for the key.

getEntry

public final IntHashMap.Entry getEntry(int key)
Returns the entry with the specified key.

Parameters:
key - the key whose associated entry is to be returned.
Returns:
the entry for the specified key or null if none.

hashCode

public int hashCode()
Returns the hash code value for this IntHashMap.

Overrides:
hashCode in class java.lang.Object
Returns:
the hash code value for this map.

headEntry

public final IntHashMap.Entry headEntry()
Returns the head entry of this map.

Returns:
the entry such as headEntry().getNextEntry() holds the first map entry.

isEmpty

public final boolean isEmpty()
Indicates if this IntHashMapcontains no key-value mappings.

Returns:
true if this map contains no key-value mappings; false otherwise.

keyIterator

public org.apache.commons.collections.primitives.IntListIterator keyIterator()

put

public final java.lang.Object put(int key,
                                  java.lang.Object value)
Associates the specified value with the specified key in this IntHashMap. If the IntHashMappreviously contained a mapping for this key, the old value is replaced.

Parameters:
key - the key with which the specified value is to be associated.
value - the value to be associated with the specified key.
Returns:
the previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key.

putAll

public final void putAll(IntHashMap that)
Copies all of the mappings from the specified map to this IntHashMap.

Parameters:
map - the mappings to be stored in this map.

remove

public final java.lang.Object remove(int key)
Removes the mapping for this key from this IntHashMapif present.

Parameters:
key - the key whose mapping is to be removed from the map.
Returns:
previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key.

removeEntry

public void removeEntry(IntHashMap.Entry entry)
Removes the specified entry from the map.

Parameters:
entry - the entry to be removed.

valueIterator

public final IntHashMap.ValueIterator valueIterator()
Returns a list iterator over the values in this list in proper sequence, (this map maintains the insertion order).

Returns:
a list iterator of the values in this list (in proper sequence).

size

public final int size()
Returns the number of key-value mappings in this IntHashMap.

Returns:
this map's size.

tailEntry

public final IntHashMap.Entry tailEntry()
Returns the tail entry of this map.

Returns:
the entry such as tailEntry().getPreviousEntry() holds the last map entry.

toString

public java.lang.String toString()
Returns the textual representation of this IntHashMap.

Overrides:
toString in class java.lang.Object
Returns:
the textual representation of the entry set.

values

public final IntHashMap.Values values()
Returns a RowCollectionview of the values contained in this IntHashMap. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. The collection supports element removal, which removes the corresponding mapping from this map, via the RowIterator.remove,RowCollection.remove and clear operations.

Returns:
a row collection view of the values contained in this map.

keys

public org.apache.commons.collections.primitives.IntCollection keys()

newEntry

protected IntHashMap.Entry newEntry()
Returns a new entry for this map; sub-classes may override this method to use custom entries.

Returns:
a new entry potentially preallocated.

addEntry

protected void addEntry(int hash,
                        int key,
                        java.lang.Object value)
Adds a new entry for the specified key and value.

Parameters:
hash - the hash of the key, generated with #keyHash.
key - the entry's key.
value - the entry's value.