xxl.io
Class BufferedContainer

java.lang.Object
  |
  +--xxl.collections.Container
        |
        +--xxl.collections.DecoratorContainer
              |
              +--xxl.io.BufferedContainer

public class BufferedContainer
extends DecoratorContainer

A BufferedContainer wraps a container by buffering its elements in a given buffer.


Field Summary
protected  Buffer buffer
           
protected  boolean writeBack
           
 
Fields inherited from class xxl.collections.DecoratorContainer
container
 
Fields inherited from class xxl.collections.Container
FACTORY_METHOD
 
Constructor Summary
BufferedContainer(Container container, Buffer buffer, boolean writeBack)
          Wraps a container by buffering its elements in a given buffer.
 
Method Summary
 void clear()
          Removes all elements from the Container.
 void close()
          Closes the Container.
protected  Container container()
           
 boolean contains(java.lang.Object id)
          Returns true if the Container contains an object for the given Id.
 void flush()
           
 void flush(java.lang.Object id)
           
 java.lang.Object get(java.lang.Object id, boolean unfix)
          Returns the Object with the given Id.
 java.util.Iterator ids()
          Returns a Cursor pointing to the ids of this Container.
 java.lang.Object insert(java.lang.Object object, boolean unfix)
          Inserts an Object into this Container.
 void remove(java.lang.Object id)
          Removes the Object with the given Id.
 void unfix(java.lang.Object id)
          Unfixes the Object with the given Id.
 void update(java.lang.Object id, java.lang.Object object, boolean unfix)
          Updates an existing (id,*)-entry with (id,object).
 
Methods inherited from class xxl.collections.DecoratorContainer
size
 
Methods inherited from class xxl.collections.Container
get, getAll, getAll, insert, insertAll, insertAll, objects, removeAll, unfixAll, update, updateAll, updateAll, updateAll, updateAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buffer

protected Buffer buffer

writeBack

protected boolean writeBack
Constructor Detail

BufferedContainer

public BufferedContainer(Container container,
                         Buffer buffer,
                         boolean writeBack)
Wraps a container by buffering its elements in a given buffer.
Parameters:
container - The container to be buffered.
buffer - The buffer used for buffering.
Method Detail

container

protected Container container()

clear

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

close

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

contains

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

flush

public void flush()
Overrides:
flush in class DecoratorContainer

flush

public void flush(java.lang.Object id)
Overrides:
flush in class Container

get

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

ids

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

insert

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

remove

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

unfix

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

update

public 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
Overrides:
update in class DecoratorContainer