com.cc.framework.util
Class TreeIterator.AbstractLevelIterator

java.lang.Object
  extended bycom.cc.framework.util.TreeIterator.AbstractLevelIterator
All Implemented Interfaces:
TreeIterator.LevelIterator
Direct Known Subclasses:
TreeIterator.RootIterator, TreeIterator.SimpleLevelIterator, TreeIterator.VirtualTreeLevelIterator
Enclosing class:
TreeIterator

private abstract static class TreeIterator.AbstractLevelIterator
extends java.lang.Object
implements TreeIterator.LevelIterator

Base class for all LevelIterator's


Field Summary
private  int depth
           
private  int maxDepth
           
private  TreeIterator.LevelIterator parentIterator
           
 
Constructor Summary
TreeIterator.AbstractLevelIterator(TreeIterator.LevelIterator parentIterator)
          Constructor
 
Method Summary
 TreeIterator.LevelIterator currentIterator()
          Returns the LevelIterator for the current selected element.
 java.lang.String currentKey()
          Returns key of the of the current node.
 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 setMaxDepth(int maxDepth)
          Sets the maximum depth the iterator is allowed to descent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.cc.framework.util.TreeIterator.LevelIterator
current, currentIndex, done, next, restart, size
 

Field Detail

parentIterator

private TreeIterator.LevelIterator parentIterator

depth

private int depth

maxDepth

private int maxDepth
Constructor Detail

TreeIterator.AbstractLevelIterator

public TreeIterator.AbstractLevelIterator(TreeIterator.LevelIterator parentIterator)
Constructor

Parameters:
parentIterator - The iterator for the parent tree level
Method Detail

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.