de.uni_tuebingen.sfb.lichtenstein.binarytrees
Class BinaryTree.BinaryNode

java.lang.Object
  extended by de.uni_tuebingen.sfb.lichtenstein.binarytrees.BinaryTree.BinaryNode
All Implemented Interfaces:
Serializable
Enclosing class:
BinaryTree

public static class BinaryTree.BinaryNode
extends Object
implements Serializable

A node in a binary tree. There is no need to differentiate between terminal nodes and non-terminal nodes: daughters can be null.

See Also:
Serialized Form

Constructor Summary
BinaryTree.BinaryNode(List<String> labels, BinaryTree.BinaryNode first, BinaryTree.BinaryNode second)
          Initialize a new BinaryNode with the given first and second daughter.
 
Method Summary
 BinaryTree.BinaryNode getFirstDaughter()
          Returns the first daughter.
 List<String> getLabels()
          Returns the labels.
 BinaryTree.BinaryNode getSecondDaughter()
          Returns the second daughter.
 String toString()
          Get a string representation of this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BinaryTree.BinaryNode

public BinaryTree.BinaryNode(List<String> labels,
                             BinaryTree.BinaryNode first,
                             BinaryTree.BinaryNode second)
Initialize a new BinaryNode with the given first and second daughter. To make a unary node, one can be made null, to make a leaf node, both can be null.

Parameters:
labels - The labels of this leaf.
first - The first daughter.
second - The second daughter.
Postconditions:
  • The first daughter is initialized to the given first daughter. | new.getFirstDaughter() == first
  • The second daughter is initialized to the given second daughter. | new.getSecondDaughter() == second
  • Method Detail

    getFirstDaughter

    public BinaryTree.BinaryNode getFirstDaughter()
    Returns the first daughter.

    Returns:
    The first daughter.

    getSecondDaughter

    public BinaryTree.BinaryNode getSecondDaughter()
    Returns the second daughter.

    Returns:
    The second daughter.

    getLabels

    public List<String> getLabels()
    Returns the labels.

    Returns:
    The labels of this node.

    toString

    public String toString()
    Get a string representation of this node. Prints the labels and the two daughter nodes.

    Overrides:
    toString in class Object


    © Copyright 2008 Hendrik Maryns   Creative Commons License