Package at.jku.ssw.fp.coll
Class Tree.Node<E>
- java.lang.Object
-
- at.jku.ssw.fp.coll.Tree<E>
-
- at.jku.ssw.fp.coll.Tree.Node<E>
-
- Type Parameters:
E
- the element type
- All Implemented Interfaces:
Serializable
public static class Tree.Node<E> extends Tree<E>
Class representing a tree node with a value and a left and right subtree.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class at.jku.ssw.fp.coll.Tree
Tree.Empty<E>, Tree.Node<E>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Indicates whether some other object is "equal to" this tree.int
hashCode()
Returns a hash code value for the tree node.boolean
isEmpty()
Returnsfalse
as this tree node is not the empty tree node.Tree<E>
left()
Returns the left subtree of this tree nodeboolean
leftExists()
Test if the left subtree is not empty.Tree<E>
right()
Returns the right subtree of this tree nodeboolean
rightExists()
Test if the right subtree is not empty.String
toString()
Returns a string representation of this tree node.E
value()
Returns the value of this tree node.
-
-
-
Method Detail
-
value
public E value()
Returns the value of this tree node.
-
isEmpty
public boolean isEmpty()
Returnsfalse
as this tree node is not the empty tree node.
-
leftExists
public boolean leftExists()
Test if the left subtree is not empty.- Specified by:
leftExists
in classTree<E>
- Returns:
true
if the the left subtree is not empty;false
otherwise
-
rightExists
public boolean rightExists()
Test if the right subtree is not empty.- Specified by:
rightExists
in classTree<E>
- Returns:
true
if the the right subtree is not empty;false
otherwise
-
toString
public String toString()
Returns a string representation of this tree node.
-
hashCode
public int hashCode()
Returns a hash code value for the tree node. It is computed from the hash code of the value and the left and right substrees.
-
equals
public boolean equals(Object obj)
Indicates whether some other object is "equal to" this tree. The object is equal to this tree, if it is a tree node and the value and the left and right subtrees are equal.
-
-