|
Plexus v0.13.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface OrientedForest
A data structure with parent/child relationships. Each node may have at most one adjacent node distinguished as being its "parent", and the data structure should be acyclic under the parent operation. The following are definitions for other terms used here (and elsewhere):
X
is the parent of node Y
,
then we also say that Y
is a "child" of
X
. A node may have multiple children.
X
is reachable through successive
applications of the parent operation from node
Y
, then X
is an "ancestor" of
Y
, and Y
is a "descendant" of
X
. Note that any node is both an ancestor and
descendant of itself.
0
.
0
.
The word "oriented" was chosen instead of the more commonly used "directed" because the directedness of the edges need not have any bearing on the parent-child relationships.
Method Summary | |
---|---|
Traverser |
childTraverser(Object node)
Traverses over the children of the specified node. |
int |
getDepth(Object node)
Gets the depth of the specified node. |
int |
getHeight(Object node)
Gets the height of the specified node. |
Object |
getLeastCommonAncestor(Object aNode,
Object bNode)
Returns the least common ancestor of the specified nodes, or null if none exists. |
Object |
getParent(Object node)
Gets the parent of the specified node, or null if
it doesn't have one. |
Graph.Edge |
getParentEdge(Object node)
Gets the parent Edge of the specified node, or
null if it doesn't have one. |
Object |
getParentEndpoint(Graph.Edge edge)
Returns the parent endpoint of the specified forest Edge . |
Object |
getRoot(Object node)
Gets the root of the subgraph containing the specified node. |
boolean |
isAncestor(Object ancestor,
Object descendant)
Returns true if ancestor is actually
an ancestor of descendant . |
boolean |
isForestEdge(Graph.Edge edge)
Gets whether or not the specified Edge is a
forest edge. |
boolean |
isLeaf(Object node)
Returns true if the specified node has no
children. |
Collection |
rootNodes()
Returns the root nodes of this forest. |
Method Detail |
---|
Object getParent(Object node)
null
if
it doesn't have one. If null
is a valid node,
then getParentEdge(java.lang.Object)
must be used to distinguish the
two cases.
Traverser childTraverser(Object node)
Graph.Edge getParentEdge(Object node)
Edge
of the specified node, or
null
if it doesn't have one.
boolean isForestEdge(Graph.Edge edge)
Edge
is a
forest edge.
Object getParentEndpoint(Graph.Edge edge)
Edge
. If the specified Edge
is not
a forest edge, throws an
IllegalArgumentException
.
Collection rootNodes()
Object getRoot(Object node)
boolean isLeaf(Object node)
true
if the specified node has no
children.
boolean isAncestor(Object ancestor, Object descendant)
true
if ancestor
is actually
an ancestor of descendant
.
Object getLeastCommonAncestor(Object aNode, Object bNode)
null
if none exists. If null
is a
valid node, then some other method must be used to distinguish
the two cases.
int getDepth(Object node)
int getHeight(Object node)
|
Plexus v0.13.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |