de.lmu.ifi.dbs.elki.utilities.iterator
Class AbstractFilteredIterator<IN,OUT extends IN>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.iterator.AbstractFilteredIterator<IN,OUT>
Type Parameters:
IN - Input type
OUT - Output type
All Implemented Interfaces:
Iterator<OUT>
Direct Known Subclasses:
CurveVisFactory.CurveFilter, TypeFilterIterator

public abstract class AbstractFilteredIterator<IN,OUT extends IN>
extends Object
implements Iterator<OUT>

Abstract class to build filtered views on Iterables.


Field Summary
(package private)  Iterator<IN> itr
          The iterator to use.
(package private)  OUT nextobj
          The next object to return.
 
Constructor Summary
AbstractFilteredIterator()
          Constructor.
 
Method Summary
protected abstract  Iterator<IN> getParentIterator()
          Get an iterator for the actual data.
 boolean hasNext()
           
protected  void init()
          Init the iterators
 OUT next()
           
 void remove()
           
protected abstract  OUT testFilter(IN nextobj)
          Test the filter predicate for a new object.
private  void updateNext()
          Find the next visualizer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

itr

Iterator<IN> itr
The iterator to use.


nextobj

OUT extends IN nextobj
The next object to return.

Constructor Detail

AbstractFilteredIterator

public AbstractFilteredIterator()
Constructor.

Method Detail

init

protected void init()
Init the iterators


getParentIterator

protected abstract Iterator<IN> getParentIterator()
Get an iterator for the actual data. Used in initialization.

Returns:
iterator

testFilter

protected abstract OUT testFilter(IN nextobj)
Test the filter predicate for a new object.

Parameters:
nextobj - Object to test
Returns:
cast object when true, null otherwise

updateNext

private void updateNext()
Find the next visualizer.


hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<OUT extends IN>

next

public OUT next()
Specified by:
next in interface Iterator<OUT extends IN>

remove

public void remove()
Specified by:
remove in interface Iterator<OUT extends IN>

Release 0.4.0 (2011-09-20_1324)