com.cc.framework.util
Class TreeIterator.VirtualTreeLevelIterator

java.lang.Object
  extended bycom.cc.framework.util.TreeIterator.AbstractLevelIterator
      extended bycom.cc.framework.util.TreeIterator.VirtualTreeLevelIterator
All Implemented Interfaces:
TreeIterator.LevelIterator
Enclosing class:
TreeIterator

private static final class TreeIterator.VirtualTreeLevelIterator
extends TreeIterator.AbstractLevelIterator

Iterator for virtual group nodes. This iterator iterates only over the in memory child nodes(!)


Field Summary
private  VirtualTreeGroupDataModel parentNode
           
private  TreeNodeDataModel rowsetChild
           
private  int rowsetIndex
           
 
Constructor Summary
TreeIterator.VirtualTreeLevelIterator(TreeIterator.LevelIterator parentIterator, VirtualTreeGroupDataModel parentNode)
          Constructor
 
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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parentNode

private VirtualTreeGroupDataModel parentNode

rowsetChild

private TreeNodeDataModel rowsetChild

rowsetIndex

private int rowsetIndex
Constructor Detail

TreeIterator.VirtualTreeLevelIterator

public TreeIterator.VirtualTreeLevelIterator(TreeIterator.LevelIterator parentIterator,
                                             VirtualTreeGroupDataModel parentNode)
Constructor

Parameters:
parentIterator - The iterator for the parent tree level
parentNode - The node which children should be iterated
Method Detail

current

public TreeNodeDataModel current()
Description copied from interface: TreeIterator.LevelIterator
Returns the current node.

Returns:
current node
See Also:
TreeIterator.LevelIterator.current()

currentIndex

public int currentIndex()
Description copied from interface: TreeIterator.LevelIterator
Returns index of the of the current node among siblings. Index starts with 0.

Returns:
index of the current node
See Also:
TreeIterator.LevelIterator.currentIndex()

restart

public void restart()
Description copied from interface: TreeIterator.LevelIterator
Restarts the iterator on the first element

See Also:
TreeIterator.LevelIterator.restart()

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()
See Also:
TreeIterator.LevelIterator.done()

next

public void next()
Description copied from interface: TreeIterator.LevelIterator
Every next() call moves current to the next node.

See Also:
TreeIterator.LevelIterator.next()

size

public int size()
Returns:
returns the number of elements the iterator can iterate
See Also:
TreeIterator.LevelIterator.size()

getParentIterator

public TreeIterator.LevelIterator getParentIterator()
Specified by:
getParentIterator in interface TreeIterator.LevelIterator
Returns:
returns the iterator of the parent level or null
See Also:
TreeIterator.LevelIterator.getParentIterator()

currentKey

public java.lang.String currentKey()
Description copied from interface: TreeIterator.LevelIterator
Returns key of the of the current node.

Specified by:
currentKey in interface TreeIterator.LevelIterator
Returns:
key of the current node
See Also:
TreeIterator.LevelIterator.currentKey()

currentIterator

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

Specified by:
currentIterator in interface TreeIterator.LevelIterator
Returns:
LevelIterator for the current selected element or null when the selected element has no children
See Also:
TreeIterator.LevelIterator.currentIterator()

getDepth

public int getDepth()
Specified by:
getDepth in interface TreeIterator.LevelIterator
Returns:
returns the depth of this tree level (relative to the iteration root)
See Also:
TreeIterator.LevelIterator.getDepth()

getMaxDepth

public int getMaxDepth()
Specified by:
getMaxDepth in interface TreeIterator.LevelIterator
Returns:
returns the maximum depth the iterator is allowed to descent.
See Also:
TreeIterator.LevelIterator.getMaxDepth()

hasChildren

public boolean hasChildren()
Description copied from interface: TreeIterator.LevelIterator
Returns true if current node has children and iterator is allowed to traverse them.

Specified by:
hasChildren in interface TreeIterator.LevelIterator
Returns:
true if current node has children
See Also:
TreeIterator.LevelIterator.hasChildren()

hasParent

public boolean hasParent()
Description copied from interface: TreeIterator.LevelIterator
Checks if there is a parent iterator available

Specified by:
hasParent in interface TreeIterator.LevelIterator
Returns:
true if there is a parent iterator available
See Also:
TreeIterator.LevelIterator.hasParent()

isMaxDepth

public boolean isMaxDepth()
Description copied from interface: TreeIterator.LevelIterator
Checks if the iterator has reached the maximum tree level

Specified by:
isMaxDepth in interface TreeIterator.LevelIterator
Returns:
returns true when the maximum level is reached
See Also:
TreeIterator.LevelIterator.isMaxDepth()

setMaxDepth

public void setMaxDepth(int maxDepth)
Description copied from interface: TreeIterator.LevelIterator
Sets the maximum depth the iterator is allowed to descent.

Specified by:
setMaxDepth in interface TreeIterator.LevelIterator
Parameters:
maxDepth - maximum depth
See Also:
TreeIterator.LevelIterator.setMaxDepth(int)


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