XBRLAPI

A Java API for XBRL


org.xbrlapi.networks
Class TreeIterator

java.lang.Object
  extended by org.xbrlapi.networks.TreeIterator
All Implemented Interfaces:
Iterator<Fragment>

public class TreeIterator
extends Object
implements Iterator<Fragment>

This iterator iterates over the fragments in a relationship network. It requires the network to be a strict tree. It does a preorder traversal of the fragments in the tree, returning parent fragments before their children. It also returns siblings with lower relationship orders before their siblings with higher relationship orders.

Author:
Geoff Shuetrim (geoff@galexy.net)

Constructor Summary
TreeIterator(Network network)
          Use this constructor when the network defines a single tree.
TreeIterator(Network network, Fragment start)
          Use this constructor when the network defines a number of trees, each distinguished by its own root fragment.
 
Method Summary
 boolean hasNext()
           
 Fragment next()
           
 void remove()
          This method is not supported by this implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeIterator

public TreeIterator(Network network)
             throws XBRLException
Use this constructor when the network defines a single tree.

Parameters:
network - The network to use.
Throws:
XBRLException - if the network does not define a single tree.

TreeIterator

public TreeIterator(Network network,
                    Fragment start)
             throws XBRLException
Use this constructor when the network defines a number of trees, each distinguished by its own root fragment.

Parameters:
network - The network to use.
start - The tree root fragment to use.
Throws:
XBRLException
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<Fragment>
See Also:
Iterator.hasNext()

next

public Fragment next()
              throws NoSuchElementException
Specified by:
next in interface Iterator<Fragment>
Throws:
NoSuchElementException
See Also:
Iterator.next()

remove

public void remove()
            throws UnsupportedOperationException
This method is not supported by this implementation.

Specified by:
remove in interface Iterator<Fragment>
Throws:
UnsupportedOperationException
See Also:
Iterator.remove()

Get Java XBRL API implementation at SourceForge.net.