public class FileSystemForest extends AbstractGraph implements OrientedForest
getInstance()
method.Graph.Edge| Modifier and Type | Method and Description |
|---|---|
Traverser |
childTraverser(Object node)
Traverses over the children of the specified node.
|
boolean |
containsEdge(Graph.Edge edge)
This implementation traverses over the edges in this graph
incident on the tail of the specified
edge,
looking for it and returning true if found. |
boolean |
containsNode(Object node)
This implementation iterates over the nodes in this graph
looking for the specified element.
|
int |
degree(Object node)
This implementation counts the number of elements accessed by
this graph's
traverser(
node, null ) method, counting self-loops twice. |
protected Collection |
edges()
Returns a
Collection view of all the
Graph.Edges in this Graph. |
int |
getDepth(Object node)
Gets the depth of the specified node.
|
int |
getHeight(Object node)
Gets the height of the specified node.
|
static FileSystemForest |
getInstance() |
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. |
protected Collection |
nodes()
Returns a
Collection view of all the nodes
in this Graph. |
boolean |
removeNode(Object node)
This implementation iterates over the nodes in this graph
looking for the specified element.
|
Collection |
rootNodes()
Returns the root nodes of this forest.
|
protected Traverser |
traverser(Object node)
Returns an unfiltered
Traverser over those
Graph.Edges incident to the specified node. |
addEdge, addNode, adjacentNodes, degree, edges, getAdjacentNode, getEdge, getIncidentEdge, getNode, incidentEdges, nodes, removeEdge, traverserpublic static final FileSystemForest getInstance()
protected Collection nodes()
AbstractGraphCollection view of all the nodes
in this Graph. This method is only called
by nodes( Predicate ).nodes in class AbstractGraphprotected Collection edges()
AbstractGraphCollection view of all the
Graph.Edges in this Graph.
This method is only called by edges( Predicate ).edges in class AbstractGraphprotected Traverser traverser(Object node)
AbstractGraphTraverser over those
Graph.Edges incident to the specified node.
This method is only called by traverser( node, Predicate ).traverser in class AbstractGraphpublic int degree(Object node)
AbstractGraphtraverser(
node, null ) method, counting self-loops twice.degree in interface Graphdegree in class AbstractGraphnode - return the degree of this node.node.public boolean containsNode(Object node)
AbstractGraphcontainsNode in interface GraphcontainsNode in class AbstractGraphnode - the node whose presence in this Graph
is to be tested.true if this Graph contains
the specified node.public boolean removeNode(Object node)
AbstractGraphIterator.remove() operation.
Note that this implementation will throw an
UnsupportedOperationException if the iterator
returned by this graph's nodes( null ).iterator()
method does not implement the remove method and
this graph contains the specified node.
removeNode in interface GraphremoveNode in class AbstractGraphnode - the node to be removed from this
Graph.true if this Graph contained
node.public boolean containsEdge(Graph.Edge edge)
AbstractGraphedge,
looking for it and returning true if found.containsEdge in interface GraphcontainsEdge in class AbstractGraphedge - the Graph.Edge whose presence in this
Graph is to be tested.true if this Graph contains
the specified Graph.Edge.public Object getParent(Object node)
OrientedForestnull 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 OrientedForestpublic Traverser childTraverser(Object node)
OrientedForestchildTraverser in interface OrientedForestpublic Graph.Edge getParentEdge(Object node)
OrientedForestEdge of the specified node, or
null if it doesn't have one.getParentEdge in interface OrientedForestpublic boolean isForestEdge(Graph.Edge edge)
OrientedForestEdge is a
forest edge.isForestEdge in interface OrientedForestpublic Object getParentEndpoint(Graph.Edge edge)
OrientedForestEdge. If the specified Edge is not
a forest edge, throws an
IllegalArgumentException.getParentEndpoint in interface OrientedForestpublic Collection rootNodes()
OrientedForestrootNodes in interface OrientedForestpublic Object getRoot(Object node)
OrientedForestgetRoot in interface OrientedForestpublic boolean isLeaf(Object node)
OrientedForesttrue if the specified node has no
children.isLeaf in interface OrientedForestpublic boolean isAncestor(Object ancestor, Object descendant)
OrientedForesttrue if ancestor is actually
an ancestor of descendant.isAncestor in interface OrientedForestpublic Object getLeastCommonAncestor(Object aNode, Object bNode)
OrientedForestnull if none exists. If null is a
valid node, then some other method must be used to distinguish
the two cases.getLeastCommonAncestor in interface OrientedForestpublic int getDepth(Object node)
OrientedForestgetDepth in interface OrientedForestpublic int getHeight(Object node)
OrientedForestgetHeight in interface OrientedForestSee 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.