de.esprit.common.util

## Class TreeWalker

- java.lang.Object
- - de.esprit.common.util.DumpableObject
  - - de.esprit.common.util.TransferableObject
    - - de.esprit.common.util.TreeWalker

- All Implemented Interfaces:
    DeepCloneable, Dumpable, java.io.Serializable, java.lang.Cloneable

      public class TreeWalker
      extends TransferableObject

  This class is supposed to find objects in a TreeModel. It requires all objects in a tree to be instances of TreeNode.
  Author:
    Rainer Buesch
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TreeWalker(javax.swing.tree.TreeNode startNode)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `countTreeItems()` Hashes once through the tree just for counting all items.
    `javax.swing.tree.TreeNode` | `findInTree(java.lang.Object o)` Recurses through the tree in order to find the given object down from the startNode.
    `int` | `getDepth()`
    `int` | `getItemCountOfLevel(int level)`
    `int` | `getTotalItemCount()`
    `protected boolean` | `isMatch(javax.swing.tree.TreeNode node, java.lang.Object o)` Determines how the match is evaluated between the node and the object being searched.
    `ToString` | `toString(ToString s)` This method allows subclasses to add values to the existing ToString of the superclass.

    - ### Methods inherited from class de.esprit.common.util.TransferableObject

      `clone, deepClone`

    - ### Methods inherited from class de.esprit.common.util.DumpableObject

      `configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### TreeWalker

          public TreeWalker(javax.swing.tree.TreeNode startNode)

  - ### Method Detail

    - #### findInTree

          public javax.swing.tree.TreeNode findInTree(java.lang.Object o)

      Recurses through the tree in order to find the given object down from the startNode. Note that each TreeNode in the tree is compared with the given object by calling the isMatch(TreeNode, Object) method on em.
      See Also:
        `isMatch(TreeNode, Object)`

    - #### countTreeItems

          public int countTreeItems()

      Hashes once through the tree just for counting all items. Returns the total count of items in the tree.

    - #### getItemCountOfLevel

          public int getItemCountOfLevel(int level)

    - #### getTotalItemCount

          public int getTotalItemCount()

    - #### getDepth

          public int getDepth()

    - #### isMatch

          protected boolean isMatch(javax.swing.tree.TreeNode node,
                        java.lang.Object o)

      Determines how the match is evaluated between the node and the object being searched. By default both objects are compared with the equals(Object) method.

    - #### toString

          public ToString toString(ToString s)

      Description copied from interface: `Dumpable`
      This method allows subclasses to add values to the existing ToString of the superclass. Usually subclasses only need to override this method.
      Specified by:
        `toString` in interface `Dumpable`
      Overrides:
        `toString` in class `DumpableObject`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.