Class TreeUtilities.PreorderModelEnumeration

  • All Implemented Interfaces:
    java.util.Enumeration
    Enclosing class:
    TreeUtilities

    public static class TreeUtilities.PreorderModelEnumeration
    extends java.lang.Object
    implements java.util.Enumeration
    Implementation of a preorder traversal of a TreeModel.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected javax.swing.tree.TreeModel model  
      private javax.swing.tree.TreePath path  
      protected java.util.Deque<java.util.Enumeration> stack  
    • Constructor Summary

      Constructors 
      Constructor Description
      PreorderModelEnumeration​(javax.swing.tree.TreeModel model)
      Instantiates a preorder traversal starting from the root of the TreeModel.
      PreorderModelEnumeration​(javax.swing.tree.TreeModel model, java.lang.Object node)
      Instantiates a preorder traversal of the TreeModel which starts at the given node.
      PreorderModelEnumeration​(javax.swing.tree.TreeModel model, javax.swing.tree.TreePath path)
      Instantiates a preorder traversal of the TreeModel which starts at the last path component of the given TreePath.
    • Field Detail

      • stack

        protected java.util.Deque<java.util.Enumeration> stack
      • model

        protected javax.swing.tree.TreeModel model
      • path

        private javax.swing.tree.TreePath path
    • Constructor Detail

      • PreorderModelEnumeration

        public PreorderModelEnumeration​(javax.swing.tree.TreeModel model)
        Instantiates a preorder traversal starting from the root of the TreeModel.
        Parameters:
        model - the TreeModel to travers.
      • PreorderModelEnumeration

        public PreorderModelEnumeration​(javax.swing.tree.TreeModel model,
                                        java.lang.Object node)
        Instantiates a preorder traversal of the TreeModel which starts at the given node. It iterates over all nodes of the subtree, only.
        Parameters:
        model - the TreeModel to travers.
        node - the node to start
      • PreorderModelEnumeration

        public PreorderModelEnumeration​(javax.swing.tree.TreeModel model,
                                        javax.swing.tree.TreePath path)
        Instantiates a preorder traversal of the TreeModel which starts at the last path component of the given TreePath. It iterates over all nodes of the subtree and all of its siblings, with the same end as a traversal starting at the model's roolt would have.
        Parameters:
        model - the TreeModel to travers.
        path - the TreePath to start from
    • Method Detail

      • hasMoreElements

        public boolean hasMoreElements()
        Specified by:
        hasMoreElements in interface java.util.Enumeration
      • nextElement

        public java.lang.Object nextElement()
        Specified by:
        nextElement in interface java.util.Enumeration
      • updateSubtree

        private void updateSubtree()
      • pushNodeAsEnumeration

        private void pushNodeAsEnumeration​(java.lang.Object node)