public class TrivialOrientedForestView extends Object implements GraphView, OrientedForest
OrientedForest
view of a Graph
, where
there is no forest structure. No Graph.Edges
are forest edges, and so all nodes are roots and leaves.Constructor and Description |
---|
TrivialOrientedForestView(Graph graph)
Creates a new
TrivialForestView with strict node-
and edge-checking semantics. |
TrivialOrientedForestView(Graph graph,
boolean isStrict)
Creates a new
TrivialForestView with the
specified node- and edge-checking semantics. |
Modifier and Type | Method and Description |
---|---|
Traverser |
childTraverser(Object node)
This implementation returns an empty
Traverser . |
int |
getDepth(Object node)
This implementation returns
0 . |
Graph |
getGraph()
Returns the
Graph of which this is a view. |
int |
getHeight(Object node)
This implementation returns
0 . |
Object |
getLeastCommonAncestor(Object aNode,
Object bNode)
This implementation returns
aNode if the
specified nodes are equal, and null otherwise. |
Object |
getParent(Object node)
This implementation returns
null . |
Graph.Edge |
getParentEdge(Object node)
This implementation returns
null . |
Object |
getParentEndpoint(Graph.Edge edge)
This implementation throws an
IllegalArgumentException . |
Object |
getRoot(Object node)
This implementation returns the specified node.
|
boolean |
isAncestor(Object ancestor,
Object descendant)
This implementation returns
true if the specified
nodes are equal, and false otherwise. |
boolean |
isForestEdge(Graph.Edge edge)
This implementation returns
false . |
boolean |
isLeaf(Object node)
This implementation returns
true . |
Collection |
rootNodes()
This implementation returns all nodes.
|
public TrivialOrientedForestView(Graph graph)
TrivialForestView
with strict node-
and edge-checking semantics.public TrivialOrientedForestView(Graph graph, boolean isStrict)
TrivialForestView
with the
specified node- and edge-checking semantics. If
isStrict
is true
, passing in a node
or edge into this view which is not contained in the
underlying Graph
will cause an exception to be
thrown.public Graph getGraph()
GraphView
Graph
of which this is a view.public Object getParent(Object node)
null
.
Description copied from interface: OrientedForest
Gets the parent of the specified node, or 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)
Traverser
.
Description copied from interface: OrientedForest
Traverses over the children of the specified node.
childTraverser
in interface OrientedForest
public Graph.Edge getParentEdge(Object node)
null
.
Description copied from interface: OrientedForest
Gets the parent Edge
of the specified node, or
null
if it doesn't have one.
getParentEdge
in interface OrientedForest
public boolean isForestEdge(Graph.Edge edge)
false
.
Description copied from interface: OrientedForest
Gets whether or not the specified Edge
is a
forest edge.
isForestEdge
in interface OrientedForest
public Object getParentEndpoint(Graph.Edge edge)
IllegalArgumentException
.
Description copied from interface: OrientedForest
Returns the parent endpoint of the specified forest
Edge
. If the specified Edge
is not
a forest edge, throws an
IllegalArgumentException
.
getParentEndpoint
in interface OrientedForest
public Collection rootNodes()
Description copied from interface: OrientedForest
Returns the root nodes of this forest.
rootNodes
in interface OrientedForest
public Object getRoot(Object node)
Description copied from interface: OrientedForest
Gets the root of the subgraph containing the specified node.
getRoot
in interface OrientedForest
public boolean isLeaf(Object node)
true
.
Description copied from interface: OrientedForest
Returns true
if the specified node has no
children.
isLeaf
in interface OrientedForest
public boolean isAncestor(Object ancestor, Object descendant)
true
if the specified
nodes are equal, and false
otherwise.
Description copied from interface: OrientedForest
Returns true
if ancestor
is actually
an ancestor of descendant
.
isAncestor
in interface OrientedForest
public Object getLeastCommonAncestor(Object aNode, Object bNode)
aNode
if the
specified nodes are equal, and null
otherwise.
Description copied from interface: OrientedForest
Returns the least common ancestor of the specified nodes, or
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)
0
.
Description copied from interface: OrientedForest
Gets the depth of the specified node.
getDepth
in interface OrientedForest
public int getHeight(Object node)
0
.
Description copied from interface: OrientedForest
Gets the height of the specified node.
getHeight
in interface OrientedForest
See the Plexus project home, hosted by SourceForge.
Copyright ? 1994-2006, by Phoenix Software Technologists, Inc. and others. All Rights Reserved. Use is subject to license terms.