net.sf.molae.pipe.tree
Class DepthFirstCollection<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by net.sf.molae.pipe.tree.DepthFirstCollection<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>

public final class DepthFirstCollection<E>
extends AbstractCollection<E>

A collection based on the DepthFirstIterator.


Constructor Summary
DepthFirstCollection(E base, CompositionView<E> compositionView)
          Constructs a DepthFirstCollection.
 
Method Summary
 Iterator<E> iterator()
           
static DepthFirstCollection<Object> newInstance(Object base)
          Constructs a DepthFirstCollection.
 int size()
          Uses the iterator to count the elements.
 
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

DepthFirstCollection

public DepthFirstCollection(E base,
                            CompositionView<E> compositionView)
Constructs a DepthFirstCollection.

Parameters:
base - the root object of the tree - must not be an Iterator.
compositionView - the compositionView to be used
Method Detail

newInstance

public static DepthFirstCollection<Object> newInstance(Object base)
Constructs a DepthFirstCollection.

Parameters:
base - the root object of the tree - must not be an Iterator.

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in class AbstractCollection<E>

size

public int size()
Uses the iterator to count the elements.

Specified by:
size in interface Collection<E>
Specified by:
size in class AbstractCollection<E>