org.apache.karaf.shell.dev.util
Class Node<T>

java.lang.Object
  extended by org.apache.karaf.shell.dev.util.Node<T>
Direct Known Subclasses:
Tree

public class Node<T>
extends java.lang.Object

Represents a node in a Tree


Constructor Summary
protected Node(T value)
          Creates a new node.
protected Node(T value, Node<T> parent)
          Creates a new node.
 
Method Summary
 Node addChild(T value)
          Adds a child to this node
 java.util.Set<T> flatten()
          Give a set of values in the tree.
 java.util.List<Node<T>> getChildren()
          Access the node's child nodes
 T getValue()
          Access the node's value
 boolean hasAncestor(T value)
          Check if the node has an ancestor that represents the given value
protected  void write(java.io.PrintWriter writer, Tree.Converter<T> converter, boolean... indents)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Node

protected Node(T value)
Creates a new node. Only meant for internal use, new nodes should be added using the addChild(Object) method

Parameters:
value - the node value

Node

protected Node(T value,
               Node<T> parent)
Creates a new node. Only meant for internal use, new nodes should be added using the addChild(Object) method

Parameters:
value - the node value
Method Detail

getValue

public T getValue()
Access the node's value


getChildren

public java.util.List<Node<T>> getChildren()
Access the node's child nodes


addChild

public Node addChild(T value)
Adds a child to this node

Parameters:
value - the child's value
Returns:
the child node

flatten

public java.util.Set<T> flatten()
Give a set of values in the tree.

Returns:

hasAncestor

public boolean hasAncestor(T value)
Check if the node has an ancestor that represents the given value

Parameters:
value - the node value
Returns:
true it there's an ancestor that represents the value

write

protected void write(java.io.PrintWriter writer,
                     Tree.Converter<T> converter,
                     boolean... indents)


Copyright © 2007-2011 Apache Software Foundation. All Rights Reserved.