ini.trakem2.display
Class Node.NodeCollection<I>

java.lang.Object
  extended by java.util.AbstractCollection<Node<I>>
      extended by ini.trakem2.display.Node.NodeCollection<I>
All Implemented Interfaces:
java.lang.Iterable<Node<I>>, java.util.Collection<Node<I>>
Enclosing class:
Node<T>

public static class Node.NodeCollection<I>
extends java.util.AbstractCollection<Node<I>>

Read-only Collection with a very expensive size(). It is meant for traversing Node subtrees.


Constructor Summary
Node.NodeCollection(Node<I> first, java.lang.Class<?> type)
           
 
Method Summary
 boolean isEmpty()
          Override to avoid calling size().
 java.util.Iterator<Node<I>> iterator()
           
 int size()
          WARNING: O(n) operation: will traverse the whole collection.
 Node<I>[] toArray()
          Override to avoid calling size(), which would iterate the whole list just for that.
<Y> Y[]
toArray(Y[] a)
           
 
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, remove, removeAll, retainAll, 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

Node.NodeCollection

public Node.NodeCollection(Node<I> first,
                           java.lang.Class<?> type)
Method Detail

iterator

public java.util.Iterator<Node<I>> iterator()
Specified by:
iterator in interface java.lang.Iterable<Node<I>>
Specified by:
iterator in interface java.util.Collection<Node<I>>
Specified by:
iterator in class java.util.AbstractCollection<Node<I>>

isEmpty

public boolean isEmpty()
Override to avoid calling size().

Specified by:
isEmpty in interface java.util.Collection<Node<I>>
Overrides:
isEmpty in class java.util.AbstractCollection<Node<I>>

size

public int size()
WARNING: O(n) operation: will traverse the whole collection.

Specified by:
size in interface java.util.Collection<Node<I>>
Specified by:
size in class java.util.AbstractCollection<Node<I>>

toArray

public Node<I>[] toArray()
Override to avoid calling size(), which would iterate the whole list just for that.

Specified by:
toArray in interface java.util.Collection<Node<I>>
Overrides:
toArray in class java.util.AbstractCollection<Node<I>>

toArray

public <Y> Y[] toArray(Y[] a)
Specified by:
toArray in interface java.util.Collection<Node<I>>
Overrides:
toArray in class java.util.AbstractCollection<Node<I>>