xxl.collections
Class HashMapContainer

java.lang.Object
  |
  +--xxl.collections.Container
        |
        +--xxl.collections.HashMapContainer

public class HashMapContainer
extends Container

The HashMapContainer is a Container that stores elements in a HashMap. TODO


Inner classes inherited from class xxl.collections.Container
Container.Id
 
Field Summary
protected  int counter
           
static Function FACTORY_METHOD
          A factory method to create a new HashMapContainer.
protected  java.util.HashMap map
          The HashMap used to store entries.
 
Fields inherited from class xxl.collections.Container
FACTORY_METHOD
 
Constructor Summary
HashMapContainer()
           
HashMapContainer(java.util.HashMap map)
           
 
Method Summary
 void clear()
          Removes all elements from the Container.
 void close()
          Closes the Container.
 boolean contains(java.lang.Object id)
          Returns true if the Continaer contains an object for the given Id.
 void fix(java.lang.Object id)
          Fixes the object with the given Id.
 java.lang.Object get(java.lang.Object id)
          Returns the Object with the given Id.
 Cursor ids()
          Returns a Cursor pointing to the ids of this Container.
 java.lang.Object insert(java.lang.Object object)
          Inserts an Object into this Container.
 java.util.Iterator iterator()
          Returns an Iterator to the elements of the HashMap.
 void open()
          Opens the Container.
 void remove(java.lang.Object id)
          Removes the Object with the given Id.
 java.lang.Object reserve(java.lang.Object object)
          Reserves an Id for a given Object.
 int size()
          Returns the number of elements of this Container.
 void unfix(java.lang.Object id)
          Unfixes the Object with the given Id.
 void update(java.lang.Object id, java.lang.Object object)
          Updates an existing (id,*)-entry with (id,object).
 
Methods inherited from class xxl.collections.Container
fixAll, getAll, id, insertAll, objects, removeAll, reserveAll, unfixAll, updateAll, updateAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FACTORY_METHOD

public static final Function FACTORY_METHOD
A factory method to create a new HashMapContainer. It may be invoked with or without a given array. (see contract for FACTORY_METHOD in class Container)

counter

protected int counter

map

protected java.util.HashMap map
The HashMap used to store entries.
Constructor Detail

HashMapContainer

public HashMapContainer(java.util.HashMap map)

HashMapContainer

public HashMapContainer()
Method Detail

clear

public void clear()
Removes all elements from the Container.
Overrides:
clear in class Container

close

public void close()
Closes the Container.
Overrides:
close in class Container

contains

public boolean contains(java.lang.Object id)
Returns true if the Continaer contains an object for the given Id.
Overrides:
contains in class Container

fix

public void fix(java.lang.Object id)
         throws java.util.NoSuchElementException
Fixes the object with the given Id.
Overrides:
fix in class Container

get

public java.lang.Object get(java.lang.Object id)
                     throws java.util.NoSuchElementException
Returns the Object with the given Id.
Overrides:
get in class Container

ids

public Cursor ids()
Returns a Cursor pointing to the ids of this Container.
Overrides:
ids in class Container

insert

public java.lang.Object insert(java.lang.Object object)
Inserts an Object into this Container.
Returns:
the Id of the Object is returned
Overrides:
insert in class Container

iterator

public java.util.Iterator iterator()
Returns an Iterator to the elements of the HashMap.

open

public void open()
Opens the Container.
Overrides:
open in class Container

remove

public void remove(java.lang.Object id)
            throws java.util.NoSuchElementException
Removes the Object with the given Id.
Overrides:
remove in class Container

reserve

public java.lang.Object reserve(java.lang.Object object)
Reserves an Id for a given Object.
Overrides:
reserve in class Container

size

public int size()
Returns the number of elements of this Container.
Overrides:
size in class Container

unfix

public void unfix(java.lang.Object id)
           throws java.util.NoSuchElementException
Unfixes the Object with the given Id.
Overrides:
unfix in class Container

update

public void update(java.lang.Object id,
                   java.lang.Object object)
            throws java.util.NoSuchElementException
Updates an existing (id,*)-entry with (id,object).
Parameters:
id - the id of the entry
object - the new Object for that entry
Overrides:
update in class Container