xxl.collections
Class Container

java.lang.Object
  |
  +--xxl.collections.Container
Direct Known Subclasses:
BlockFileContainer, DecoratorContainer, MapContainer

public abstract class Container
extends java.lang.Object

A Container is the baseclass for all classes that deal with storing objects.


Field Summary
static Function FACTORY_METHOD
          A factory method to create a default Container.
 
Constructor Summary
Container()
           
 
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 flush()
          Flushes all buffered elements into the container
 void flush(java.lang.Object id)
          Flushes the object having the id into the container
 java.lang.Object get(java.lang.Object id)
          Returns the Object with the given Id.
abstract  java.lang.Object get(java.lang.Object id, boolean unfix)
          Returns the Object with the given Id.
 java.util.Iterator getAll(java.util.Iterator ids)
          Returns an Iterator pointing to the Object of the given Ids.
 java.util.Iterator getAll(java.util.Iterator ids, boolean unfix)
          Returns an Iterator pointing to the Object of the given Ids.
abstract  java.util.Iterator 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.
abstract  java.lang.Object insert(java.lang.Object object, boolean unfix)
          Inserts an Object into this Container.
 java.util.Iterator insertAll(java.util.Iterator objects)
          Inserts all the Object of a given Iterator into this Container.
 java.util.Iterator insertAll(java.util.Iterator objects, boolean unfix)
          Inserts all the Object of a given Iterator into this Container.
 Cursor objects()
          Returns a Cursor pointing to the objects of this Container.
abstract  void remove(java.lang.Object id)
          Removes the Object with the given Id.
 void removeAll(java.util.Iterator ids)
          Removes the Objects with the given Ids.
abstract  int size()
          Returns the number of elements of this Container.
 void unfix(java.lang.Object id)
          Unfixes the Object with the given Id.
 void unfixAll(java.util.Iterator ids)
          Unfixes the Objects with the given Ids.
 void update(java.lang.Object id, java.lang.Object object)
          Updates an existing (id,*)-entry with (id,object).
abstract  void update(java.lang.Object id, java.lang.Object object, boolean unfix)
          Updates an existing (id,*)-entry with (id,object).
 void updateAll(Cursor ids, Function function)
          Updates existing entries.
 void updateAll(Cursor ids, Function function, boolean unfix)
          Updates existing entries.
 void updateAll(java.util.Iterator ids, java.util.Iterator objects)
          Updates existing entries.
 void updateAll(java.util.Iterator ids, java.util.Iterator objects, boolean unfix)
          Updates existing entries.
 
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 default Container. Each implementation of Container should have a field FACTORY_METHOD which is a factory method that implements three variants of invoke()
This field is set to MapContainer.FACTORY_METHOD.
Constructor Detail

Container

public Container()
Method Detail

clear

public void clear()
Removes all elements from the Container.

close

public void close()
Closes the Container.

contains

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

flush

public void flush()
Flushes all buffered elements into the container

flush

public void flush(java.lang.Object id)
Flushes the object having the id into the container

get

public abstract java.lang.Object get(java.lang.Object id,
                                     boolean unfix)
                              throws java.util.NoSuchElementException
Returns the Object with the given Id.

get

public java.lang.Object get(java.lang.Object id)
                     throws java.util.NoSuchElementException
Returns the Object with the given Id.

getAll

public java.util.Iterator getAll(java.util.Iterator ids,
                                 boolean unfix)
Returns an Iterator pointing to the Object of the given Ids.
Parameters:
ids - an Iterator of Ids
Returns:
an Iterator of Objects

getAll

public java.util.Iterator getAll(java.util.Iterator ids)
Returns an Iterator pointing to the Object of the given Ids.
Parameters:
ids - an Iterator of Ids
Returns:
an Iterator of Objects

ids

public abstract java.util.Iterator ids()
Returns a Cursor pointing to the ids of this Container.

insert

public abstract java.lang.Object insert(java.lang.Object object,
                                        boolean unfix)
Inserts an Object into this Container.
Returns:
the Id of the Object is returned

insert

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

insertAll

public java.util.Iterator insertAll(java.util.Iterator objects,
                                    boolean unfix)
Inserts all the Object of a given Iterator into this Container.
Returns:
an Iterator pointing to the Ids of the Objects is returned

insertAll

public java.util.Iterator insertAll(java.util.Iterator objects)
Inserts all the Object of a given Iterator into this Container.
Returns:
an Iterator pointing to the Ids of the Objects is returned

objects

public Cursor objects()
Returns a Cursor pointing to the objects of this Container.

remove

public abstract void remove(java.lang.Object id)
                     throws java.util.NoSuchElementException
Removes the Object with the given Id.

removeAll

public void removeAll(java.util.Iterator ids)
Removes the Objects with the given Ids. Calls
 remove(id)
for each object of the Iterator.
Parameters:
ids - an Iterator pointing to Ids

size

public abstract int size()
Returns the number of elements of this Container.

unfix

public void unfix(java.lang.Object id)
           throws java.util.NoSuchElementException
Unfixes the Object with the given Id.

unfixAll

public void unfixAll(java.util.Iterator ids)
              throws java.util.NoSuchElementException
Unfixes the Objects with the given Ids.
Parameters:
ids - an Iterator of Ids
Returns:
an Iterator pointing to the Ids of the Objects is returned

update

public abstract void update(java.lang.Object id,
                            java.lang.Object object,
                            boolean unfix)
                     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

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

updateAll

public void updateAll(Cursor ids,
                      Function function,
                      boolean unfix)
Updates existing entries. This method calls
 update(id, function.invoke(id))
for each id of the Cursor.
Parameters:
ids - a Cursor of Ids

updateAll

public void updateAll(Cursor ids,
                      Function function)
Updates existing entries. This method calls
 update(id, function.invoke(id))
for each id of the Cursor.
Parameters:
ids - a Cursor of Ids

updateAll

public void updateAll(java.util.Iterator ids,
                      java.util.Iterator objects,
                      boolean unfix)
Updates existing entries.
Parameters:
ids - a Cursor of Ids
objects - a Cursor of Objects

updateAll

public void updateAll(java.util.Iterator ids,
                      java.util.Iterator objects)
Updates existing entries.
Parameters:
ids - a Cursor of Ids
objects - a Cursor of Objects