Package at.jku.ssw.fp.coll
Class Tree.Empty<E>
- java.lang.Object
-
- at.jku.ssw.fp.coll.Tree<E>
-
- at.jku.ssw.fp.coll.Tree.Empty<E>
-
- Type Parameters:
E
- the element type (used in type inference)
- All Implemented Interfaces:
Serializable
public static class Tree.Empty<E> extends Tree<E>
Class for the empty tree.- 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>
-
-
Constructor Summary
Constructors Modifier Constructor Description private
Empty()
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isEmpty()
Returnstrue
as this represents the empty tree.Tree<E>
left()
Throws aNoSuchElementException
.boolean
leftExists()
Returnsfalse
as the empty tree does not have a left subtree.Tree<E>
right()
Throws aNoSuchElementException
.boolean
rightExists()
Returnsfalse
as the empty tree does not have a right subtree.String
toString()
Returns an empty string as string representation of the empty tree.E
value()
Throws aNoSuchElementException
.
-
-
-
Method Detail
-
value
public E value()
Throws aNoSuchElementException
.
-
left
public Tree<E> left()
Throws aNoSuchElementException
.
-
right
public Tree<E> right()
Throws aNoSuchElementException
.
-
isEmpty
public boolean isEmpty()
Returnstrue
as this represents the empty tree.
-
leftExists
public boolean leftExists()
Returnsfalse
as the empty tree does not have a left subtree.- Specified by:
leftExists
in classTree<E>
- Returns:
false
-
rightExists
public boolean rightExists()
Returnsfalse
as the empty tree does not have a right subtree.- Specified by:
rightExists
in classTree<E>
- Returns:
false
-
-