ca.uhn.cache.internal.impl
Class ChunkIterator

java.lang.Object
  extended byca.uhn.cache.internal.impl.ChunkIterator
All Implemented Interfaces:
IChunkIterator

public class ChunkIterator
extends java.lang.Object
implements IChunkIterator

Default implementation of IChunkIterator. The default close() method does nothing, and should be overridden to perform any required cleanup. Note that this class is NOT thread-safe in the sense of supporting multiple iterating clients (although different threads may add and iterate concurrently).

Version:
$Revision: 1.2 $ updated on $Date: 2005/01/25 23:59:09 $ by $Author: bryan_tripp $
Author:
Bryan Tripp

Constructor Summary
ChunkIterator()
          New instance.
 
Method Summary
 void add(IChunk theChunk)
           
 void close()
          Does nothing by default (override if you want to do something here).
 void finished()
          Must be called when all items have been added.
 boolean hasNext()
           
 IChunk next()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChunkIterator

public ChunkIterator()
New instance.

Method Detail

add

public void add(IChunk theChunk)
Parameters:
theChunk - a chunk to be added to the iteration list.

finished

public void finished()
Must be called when all items have been added.


hasNext

public boolean hasNext()
Specified by:
hasNext in interface IChunkIterator
Returns:
true iff there is another chunk; implicitly calls close() if false.
See Also:
IChunkIterator.hasNext()

next

public IChunk next()
            throws java.util.NoSuchElementException
Specified by:
next in interface IChunkIterator
Returns:
the next IChunk
Throws:
java.util.NoSuchElementException - if called when hasNext() returns false TODO: throw same exception as IChunkStore (none currently) on error
See Also:
IChunkIterator.next()

close

public void close()
Does nothing by default (override if you want to do something here).

Specified by:
close in interface IChunkIterator
See Also:
IChunkIterator.close()


Copyright © 2004-2005 University Health Network. All Rights Reserved.