org.embl.ebi.escience.baclava.iterator
Class BaclavaIteratorNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by org.embl.ebi.escience.baclava.iterator.BaclavaIteratorNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Iterator, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode, ResumableIterator

public class BaclavaIteratorNode
extends javax.swing.tree.DefaultMutableTreeNode
implements ResumableIterator

A DefaultMutableTreeNode implementing ResumableIterator by wrapping a BaclavaIterator. Further, all output from the underlying ResumableIterator is named and the output wrapped in a Map object

Author:
Tom Oinn
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
EMPTY_ENUMERATION
 
Constructor Summary
BaclavaIteratorNode(BaclavaIterator i, java.lang.String name)
          A TreeNode that contains a BaclavaIterator.
 
Method Summary
 boolean getAllowsChildren()
          BaclavaIteratorNode objects are not allowed children
 int[] getCurrentLocation()
          Return the current position within this iterator
 java.lang.String getName()
          Return the name that will be used as the key for any maps that this iterator produces
 boolean hasNext()
          Delegate to the underlying iterator
 boolean isLeaf()
          These nodes are always leaf nodes, they act as the basic source of iterated objects
 java.lang.Object next()
          Wraps the output of the underlying iterator's next() method into a Map with the key being the name of this BaclavaIteratorNode
 void remove()
          Remove operation not supported
 void reset()
          Reset the underlying iterator to its initial state
 int size()
          Return the size of the underlying iterator
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaclavaIteratorNode

public BaclavaIteratorNode(BaclavaIterator i,
                           java.lang.String name)
A TreeNode that contains a BaclavaIterator. The iterator will produce Map objects with the single item having a value extracted from the underlying iterator and a key of the supplied name

Method Detail

getName

public java.lang.String getName()
Return the name that will be used as the key for any maps that this iterator produces


next

public java.lang.Object next()
Wraps the output of the underlying iterator's next() method into a Map with the key being the name of this BaclavaIteratorNode

Specified by:
next in interface java.util.Iterator

hasNext

public boolean hasNext()
Delegate to the underlying iterator

Specified by:
hasNext in interface java.util.Iterator

remove

public void remove()
            throws java.lang.UnsupportedOperationException
Remove operation not supported

Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.UnsupportedOperationException

reset

public void reset()
Reset the underlying iterator to its initial state

Specified by:
reset in interface ResumableIterator

size

public int size()
Return the size of the underlying iterator

Specified by:
size in interface ResumableIterator

isLeaf

public boolean isLeaf()
These nodes are always leaf nodes, they act as the basic source of iterated objects

Specified by:
isLeaf in interface javax.swing.tree.TreeNode
Overrides:
isLeaf in class javax.swing.tree.DefaultMutableTreeNode

getAllowsChildren

public boolean getAllowsChildren()
BaclavaIteratorNode objects are not allowed children

Specified by:
getAllowsChildren in interface javax.swing.tree.TreeNode
Overrides:
getAllowsChildren in class javax.swing.tree.DefaultMutableTreeNode

getCurrentLocation

public int[] getCurrentLocation()
Return the current position within this iterator

Specified by:
getCurrentLocation in interface ResumableIterator