|
Plexus v0.13.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.phoenixst.plexus.ForestTreeAdapter
public class ForestTreeAdapter
An adapter which presents the subgraph of an OrientedForest
rooted at a specified node as a RootedTree
.
Constructor Summary | |
---|---|
ForestTreeAdapter(Object root,
OrientedForest forest,
boolean isStrict)
Creates a new ForestTreeAdapter . |
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()
Gets the root node. |
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. |
boolean |
isTreeNode(Object node)
Returns true if the specified node is a
descendant of the root node. |
Collection |
rootNodes()
Returns the root nodes of this forest. |
void |
setRoot(Object root)
Sets the root node, which must already be present. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ForestTreeAdapter(Object root, OrientedForest forest, boolean isStrict)
ForestTreeAdapter
.
root
- create a tree of the subgraph rooted at this
node.forest
- the forest of which this tree is a subview.isStrict
- if true
, all appropriate methods
accepting nodes will throw a NoSuchNodeException
if the argument node is not a descendant of the root node of
this tree. If false
, only getRoot( node )
and getDepth( node )
will throw an exception in this case.Method Detail |
---|
public Object getRoot()
Rooted
getRoot
in interface Rooted
public void setRoot(Object root)
Rooted
setRoot
in interface Rooted
public Object getParent(Object node)
OrientedForest
null
if
it doesn't have one. If null
is a valid node,
then OrientedForest.getParentEdge(java.lang.Object)
must be used to distinguish the
two cases.
getParent
in interface OrientedForest
public Traverser childTraverser(Object node)
OrientedForest
childTraverser
in interface OrientedForest
public Graph.Edge getParentEdge(Object node)
OrientedForest
Edge
of the specified node, or
null
if it doesn't have one.
getParentEdge
in interface OrientedForest
public boolean isForestEdge(Graph.Edge edge)
OrientedForest
Edge
is a
forest edge.
isForestEdge
in interface OrientedForest
public Object getParentEndpoint(Graph.Edge edge)
OrientedForest
Edge
. If the specified Edge
is not
a forest edge, throws an
IllegalArgumentException
.
getParentEndpoint
in interface OrientedForest
public Collection rootNodes()
OrientedForest
rootNodes
in interface OrientedForest
public Object getRoot(Object node)
OrientedForest
getRoot
in interface OrientedForest
public boolean isLeaf(Object node)
OrientedForest
true
if the specified node has no
children.
isLeaf
in interface OrientedForest
public boolean isAncestor(Object ancestor, Object descendant)
OrientedForest
true
if ancestor
is actually
an ancestor of descendant
.
isAncestor
in interface OrientedForest
public Object getLeastCommonAncestor(Object aNode, Object bNode)
OrientedForest
null
if none exists. If null
is a
valid node, then some other method must be used to distinguish
the two cases.
getLeastCommonAncestor
in interface OrientedForest
public int getDepth(Object node)
OrientedForest
getDepth
in interface OrientedForest
public int getHeight(Object node)
OrientedForest
getHeight
in interface OrientedForest
public boolean isTreeNode(Object node)
RootedTree
true
if the specified node is a
descendant of the root node.
isTreeNode
in interface RootedTree
|
Plexus v0.13.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |