com.cc.framework.util
Interface TreeIterator.LevelIterator

All Known Implementing Classes:
TreeIterator.AbstractLevelIterator
Enclosing interface:
TreeIterator

public static interface TreeIterator.LevelIterator

Iterator for one level in a tree structure


Method Summary
 TreeNodeDataModel current()
          Returns the current node.
 int currentIndex()
          Returns index of the of the current node among siblings.
 TreeIterator.LevelIterator currentIterator()
          Returns the LevelIterator for the current selected element.
 java.lang.String currentKey()
          Returns key of the of the current node.
 boolean done()
           
 int getDepth()
           
 int getMaxDepth()
           
 TreeIterator.LevelIterator getParentIterator()
           
 boolean hasChildren()
          Returns true if current node has children and iterator is allowed to traverse them.
 boolean hasParent()
          Checks if there is a parent iterator available
 boolean isMaxDepth()
          Checks if the iterator has reached the maximum tree level
 void next()
          Every next() call moves current to the next node.
 void restart()
          Restarts the iterator on the first element
 void setMaxDepth(int maxDepth)
          Sets the maximum depth the iterator is allowed to descent.
 int size()
           
 

Method Detail

getParentIterator

public TreeIterator.LevelIterator getParentIterator()
Returns:
returns the iterator of the parent level or null

restart

public void restart()
Restarts the iterator on the first element


current

public TreeNodeDataModel current()
Returns the current node.

Returns:
current node

currentKey

public java.lang.String currentKey()
Returns key of the of the current node.

Returns:
key of the current node

currentIndex

public int currentIndex()
Returns index of the of the current node among siblings. Index starts with 0.

Returns:
index of the current node

hasParent

public boolean hasParent()
Checks if there is a parent iterator available

Returns:
true if there is a parent iterator available

hasChildren

public boolean hasChildren()
Returns true if current node has children and iterator is allowed to traverse them.

Returns:
true if current node has children

done

public boolean done()
Returns:
returns true when the iterator has reached the last element of the iteration. after done() has returned true it is not valid to call current()

next

public void next()
Every next() call moves current to the next node.


currentIterator

public TreeIterator.LevelIterator currentIterator()
Returns the LevelIterator for the current selected element. The depth of the returned iterator is getDepth() + 1.

Returns:
LevelIterator for the current selected element or null when the selected element has no children

getDepth

public int getDepth()
Returns:
returns the depth of this tree level (relative to the iteration root)

getMaxDepth

public int getMaxDepth()
Returns:
returns the maximum depth the iterator is allowed to descent.

size

public int size()
Returns:
returns the number of elements the iterator can iterate

setMaxDepth

public void setMaxDepth(int maxDepth)
Sets the maximum depth the iterator is allowed to descent.

Parameters:
maxDepth - maximum depth

isMaxDepth

public boolean isMaxDepth()
Checks if the iterator has reached the maximum tree level

Returns:
returns true when the maximum level is reached


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.