Class 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 supplied GenericTreeNode. The result is an Enumeration of FlattenedTreeNode objects. A FlattenedTreeNode is a proxy for the underlying GenericTreeNode, 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, the GenericTreeNode.getParent() method will return null 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
    • Constructor Detail

      • PreorderEnumeration

        public PreorderEnumeration​(GenericTreeNode treeNode)
        Creates a new PreorderEnumeration object.
        Parameters:
        treeNode - The sole, root GenericTreeNode 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 of GenericTreeNode instances which form the "forest" of trees.
    • Method Detail

      • hasMoreElements

        public boolean hasMoreElements()
        Whether the enumeration has any more elements.
        Specified by:
        hasMoreElements in interface java.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 interface java.util.Enumeration
        Returns:
        The next FlattenedTreeNode object in the traversal of this tree.