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

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

public class TypeFilterIterator<IN,OUT extends IN>
extends AbstractFilteredIterator<IN,OUT>

Iterator that filters results by type.


Field Summary
private  Class<? super OUT> filterClass
          Class restriction
private  Iterator<IN> parent
          Parent iterator
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.iterator.AbstractFilteredIterator
itr, nextobj
 
Constructor Summary
TypeFilterIterator(Class<? super OUT> filterClass, Iterable<IN> parent)
          Constructor.
TypeFilterIterator(Class<? super OUT> filterClass, Iterator<IN> parent)
          Constructor.
 
Method Summary
protected  Iterator<IN> getParentIterator()
          Get an iterator for the actual data.
protected  OUT testFilter(IN nextobj)
          Test the filter predicate for a new object.
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.iterator.AbstractFilteredIterator
hasNext, init, next, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filterClass

private Class<? super OUT extends IN> filterClass
Class restriction


parent

private Iterator<IN> parent
Parent iterator

Constructor Detail

TypeFilterIterator

public TypeFilterIterator(Class<? super OUT> filterClass,
                          Iterable<IN> parent)
Constructor.

Parameters:
filterClass - Filter
parent - Parent collection

TypeFilterIterator

public TypeFilterIterator(Class<? super OUT> filterClass,
                          Iterator<IN> parent)
Constructor.

Parameters:
filterClass - Filter
parent - Parent iterator
Method Detail

getParentIterator

protected Iterator<IN> getParentIterator()
Description copied from class: AbstractFilteredIterator
Get an iterator for the actual data. Used in initialization.

Specified by:
getParentIterator in class AbstractFilteredIterator<IN,OUT extends IN>
Returns:
iterator

testFilter

protected OUT testFilter(IN nextobj)
Description copied from class: AbstractFilteredIterator
Test the filter predicate for a new object.

Specified by:
testFilter in class AbstractFilteredIterator<IN,OUT extends IN>
Parameters:
nextobj - Object to test
Returns:
cast object when true, null otherwise

Release 0.4.0 (2011-09-20_1324)