com.h3c.util.codec

## Class CodedTree

- java.lang.Object
- - com.h3c.util.codec.CodedTree

-     public class CodedTree
      extends Object

  This class models an arbitrary depth tree where each node in the tree has a positive integer associated with it, and has zero or more child nodes.

  This class is not synchronized. If synchronization is required, it must be applied externally.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `CodedTree.Node` This inner class represents a node in a coded tree.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CodedTree()` Constructs an empty coded tree.
    `CodedTree(CodedTree.Node... nodes)` Constructs a coded tree with the specified root nodes.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `List<CodedTree.Node>` | `getNodes()` Returns a reference to the list of "root" nodes in this tree.
    `int` | `hashCode()`
    `int` | `nodeCount()` Returns the number of "root" nodes for this tree.
    `String` | `toString()`
    `static CodedTree` | `valueOf(String s)` Creates a coded tree from a string representation.

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### CodedTree

          public CodedTree()

      Constructs an empty coded tree.

    - #### CodedTree

          public CodedTree(CodedTree.Node... nodes)

      Constructs a coded tree with the specified root nodes.
      Parameters:
        `nodes` - the root nodes

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### nodeCount

          public int nodeCount()

      Returns the number of "root" nodes for this tree.
      Returns:
        the number of root nodes

    - #### getNodes

          public List<CodedTree.Node> getNodes()

      Returns a reference to the list of "root" nodes in this tree.
      Returns:
        the root nodes

    - #### valueOf

          public static CodedTree valueOf(String s)

      Creates a coded tree from a string representation. For example:

           CodedTree tree = ... ;
           String s = tree.toString();
           CodedTree copy = CodedTree.valueOf(s);
           assert(copy.equals(tree));

      Parameters:
        `s` - the string representation
      Returns:
        an equivalent coded tree

Copyright © 2014. All Rights Reserved.