org.rapla.components.util.iterator
Class NestedIterator

java.lang.Object
  extended by org.rapla.components.util.iterator.NestedIterator
All Implemented Interfaces:
Iterator

public abstract class NestedIterator
extends Object
implements Iterator

Successivly iterates over the elements specified in the nested Iterators. Example of an recursive traversal of an Entity Tree:

class RecursiveEntityIterator extends NestedIterator {
    public RecursiveEntityIterator(Iterator it) {
        super(it);
    }
    public Iterator getNestedIterator(Object obj) {
        return new RecursiveEntityIterator(((Entity)obj).getSubEntities());
    }
}


Field Summary
protected  Iterator innerIt
           
protected  Iterator outerIt
           
 
Constructor Summary
NestedIterator(Iterator outerIt)
           
 
Method Summary
abstract  Iterator getNestedIterator(Object obj)
           
 boolean hasNext()
           
 Object next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outerIt

protected Iterator outerIt

innerIt

protected Iterator innerIt
Constructor Detail

NestedIterator

public NestedIterator(Iterator outerIt)
Method Detail

getNestedIterator

public abstract Iterator getNestedIterator(Object obj)

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator

remove

public void remove()
Specified by:
remove in interface Iterator

next

public Object next()
Specified by:
next in interface Iterator


Copyright © 2000-2006 Rapla Team. All Rights Reseserved.