Gephi Toolkit Javadoc

org.gephi.graph.api
Interface NodeIterable

All Superinterfaces:
java.lang.Iterable<Node>

public interface NodeIterable
extends java.lang.Iterable<Node>

Proxy iterable for iterating nodes, users can either get NodeIterator or directly getting an Node array.

This iterable has an additionnal feature, it locks automatically the graph when the iterator is called and unlocks it when iterator terminates. That means calling break; before the iterator terminates won't unlock the graph. The doBreak() method will properly unlock the graph. Note that calling toArray() avoid this issue.

If you're not sure if the graph is properly unlocked, for instance when exception are thrown within the loop, use Graph.readUnlockAll().

Author:
Mathieu Bastian
See Also:
Graph.readLock()

Method Summary
 void doBreak()
          Perform unlocking in case the iterator was terminated before normal end.
 NodeIterator iterator()
          Returns the node iterator.
 Node[] toArray()
          Returns the content of the iterable directly as an array.
 

Method Detail

iterator

NodeIterator iterator()
Returns the node iterator.

Specified by:
iterator in interface java.lang.Iterable<Node>
Returns:
the node iterator

doBreak

void doBreak()
Perform unlocking in case the iterator was terminated before normal end.


toArray

Node[] toArray()
Returns the content of the iterable directly as an array. It reads the iterable until its end and returns the array. Use this method to avoid the automatic lock when using the iterator.

Returns:
the iterator content as an array

Gephi Toolkit Javadoc