TUM CCSM Commons

edu.tum.cs.commons.tree
Class SimpleTreeNode<K>

java.lang.Object
  extended by edu.tum.cs.commons.tree.SimpleTreeNode<K>
Type Parameters:
K - key used to identify children, e.g. String.

public class SimpleTreeNode<K>
extends java.lang.Object

A simple node class that can be used with TreeUtils. See TreeUtilsTest for an application of this class that uses strings as keys.

Version:
$Rev: 26268 $
Author:
deissenb, $Author: juergens $
Rating:
GREEN Hash: B1592DD3B3D1D3EEFF7DDDE5A25EDE03

Constructor Summary
SimpleTreeNode(K key)
          Create new node with specified key.
 
Method Summary
 void addChild(SimpleTreeNode<K> child)
          Add child.
 SimpleTreeNode<K> getChild(K key)
          Get child with specified key.
 UnmodifiableCollection<SimpleTreeNode<K>> getChildren()
          Get children of this node.
 K getKey()
          Get key of this node.
 java.lang.String toString()
          This returns a nicely indented representation of the whole tree below this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleTreeNode

public SimpleTreeNode(K key)
Create new node with specified key.

Method Detail

getChild

public SimpleTreeNode<K> getChild(K key)
Get child with specified key. This returns null if child with provided key does not exist.


addChild

public void addChild(SimpleTreeNode<K> child)
Add child. This overwrites existing child with same key.


getKey

public K getKey()
Get key of this node.


getChildren

public UnmodifiableCollection<SimpleTreeNode<K>> getChildren()
Get children of this node.


toString

public java.lang.String toString()
This returns a nicely indented representation of the whole tree below this node.

Overrides:
toString in class java.lang.Object

TUM CCSM Commons

TUM CCSM Commons - 2.7