org.openstreetmap.osmosis.core.apidb.v0_6.impl
Class EntityContainerReader<T extends Entity>

java.lang.Object
  extended by org.openstreetmap.osmosis.core.apidb.v0_6.impl.EntityContainerReader<T>
Type Parameters:
T - The type of entity provided by this iterator.
All Implemented Interfaces:
java.util.Iterator<EntityContainer>, Releasable, ReleasableIterator<EntityContainer>

public class EntityContainerReader<T extends Entity>
extends java.lang.Object
implements ReleasableIterator<EntityContainer>

Wraps a stream of entity history objects into entity containers. Only visible items will be returned.


Constructor Summary
EntityContainerReader(ReleasableIterator<EntityHistory<T>> source, EntityContainerFactory<T> containerFactory)
          Creates a new instance.
 
Method Summary
 boolean hasNext()
          
 EntityContainer next()
          
 void release()
          Performs resource cleanup tasks such as closing files, or database connections.
 void remove()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityContainerReader

public EntityContainerReader(ReleasableIterator<EntityHistory<T>> source,
                             EntityContainerFactory<T> containerFactory)
Creates a new instance.

Parameters:
source - The entity history source.
containerFactory - The factory for wrapping entity objects into containers.
Method Detail

hasNext

public boolean hasNext()

Specified by:
hasNext in interface java.util.Iterator<EntityContainer>

next

public EntityContainer next()

Specified by:
next in interface java.util.Iterator<EntityContainer>

remove

public void remove()

Specified by:
remove in interface java.util.Iterator<EntityContainer>

release

public void release()
Performs resource cleanup tasks such as closing files, or database connections. This must be called after all processing is complete and may be called multiple times. Implementations must call release on any nested Releasable objects. It should be called within a finally block to ensure it is called in exception scenarios.

Specified by:
release in interface Releasable