Package com.microstrategy.utils
Class PreorderEnumeration
- java.lang.Object
-
- com.microstrategy.utils.FlattenedEnumerationBase
-
- com.microstrategy.utils.PreorderEnumeration
-
- All Implemented Interfaces:
java.util.Enumeration
public class PreorderEnumeration extends FlattenedEnumerationBase implements java.util.Enumeration
This class performs a preorder traversal of the tree specified by the suppliedGenericTreeNode
. The result is anEnumeration
ofFlattenedTreeNode
objects. AFlattenedTreeNode
is a proxy for the underlyingGenericTreeNode
, with one exception. If the node specified for traversal is not the root node in the larger tree, it is will appear as the root in the flattened tree node hierarchy; that is, theGenericTreeNode.getParent()
method will returnnull
for the root node supplied to the traversal. Finally, a preorder enumeration can be performed on a single root node or a "forest" of root nodes.- Since:
- MicroStrategy Web 9.0.0
-
-
Field Summary
-
Fields inherited from class com.microstrategy.utils.FlattenedEnumerationBase
LOCATION_BASE_INDEX, LOCATION_SEPARATOR, locationStack, nodeStack
-
-
Constructor Summary
Constructors Constructor Description PreorderEnumeration(GenericTreeNode treeNode)
Creates a new PreorderEnumeration object.PreorderEnumeration(java.util.Vector forest)
Creates a new PreorderEnumeration object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasMoreElements()
Whether the enumeration has any more elements.java.lang.Object
nextElement()
The next element in this enumeration.-
Methods inherited from class com.microstrategy.utils.FlattenedEnumerationBase
getLocationEnum, isRootNode
-
-
-
-
Constructor Detail
-
PreorderEnumeration
public PreorderEnumeration(GenericTreeNode treeNode)
Creates a new PreorderEnumeration object.- Parameters:
treeNode
- The sole, rootGenericTreeNode
instance that is being traversed. It and all of its children are traversed.
-
PreorderEnumeration
public PreorderEnumeration(java.util.Vector forest)
Creates a new PreorderEnumeration object.- Parameters:
forest
- A list ofGenericTreeNode
instances which form the "forest" of trees.
-
-
Method Detail
-
hasMoreElements
public boolean hasMoreElements()
Whether the enumeration has any more elements.- Specified by:
hasMoreElements
in interfacejava.util.Enumeration
- Returns:
- True, if there are more elements to return; otherwise, false.
-
nextElement
public java.lang.Object nextElement()
The next element in this enumeration. For this traversal, the parent node is returned before any of its children.- Specified by:
nextElement
in interfacejava.util.Enumeration
- Returns:
- The next
FlattenedTreeNode
object in the traversal of this tree.
-
-