Interface InspectableTree

All Superinterfaces:
InspectableContainer, InspectablePositionalContainer
All Known Subinterfaces:
Tree

public interface InspectableTree
extends InspectablePositionalContainer

A read-only tree of objects, with positions.

Author:
Goodrich & Tamassia

Method Summary
 PositionIterator children(Position v)
          get an iterator of the children of a specified position.
 boolean isExternal(Position v)
          is the node external (i.e.
 boolean isInternal(Position v)
          is the node internal?
 boolean isRoot(Position v)
          is this the root?
 Position parent(Position v)
          get the parent of a specified position.
 Position root()
          get the root of the tree.
 
Methods inherited from interface InspectablePositionalContainer
positions
 
Methods inherited from interface InspectableContainer
elements, isEmpty, size
 

Method Detail

children

public PositionIterator children(Position v)
get an iterator of the children of a specified position.
Parameters:
v - the position whose children we want.
Returns:
a PositionIterator (possibly empty) that visits all the children in unspecified order.

isExternal

public boolean isExternal(Position v)
is the node external (i.e. a leaf)?
Parameters:
v - the position of the node we want to know about
Returns:
true iff the node is a leaf, i.e. has no children

isInternal

public boolean isInternal(Position v)
is the node internal?
Parameters:
v - the position of the node we want to know about
Returns:
true iff the node has at least one child

isRoot

public boolean isRoot(Position v)
is this the root?
Parameters:
v - the position of the node we're curious about
Returns:
true iff the node is the root of the tree, i.e. has no parent

parent

public Position parent(Position v)
get the parent of a specified position.
Parameters:
v - the position whose parent we want.
Returns:
another Position, the parent (null if there is no parent)

root

public Position root()
get the root of the tree.
Returns:
a Position indicating the root.


Generated by BlueJ