|
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.AbstractGraph
com.phoenixst.plexus.examples.FileSystemForest
public class FileSystemForest
A lazy forest graph of the local file system. The single instance
of this class should be retrieved through the getInstance()
method.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.phoenixst.plexus.Graph |
|---|
Graph.Edge |
| Method Summary | |
|---|---|
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. |
| Methods inherited from class com.phoenixst.plexus.AbstractGraph |
|---|
addEdge, addNode, adjacentNodes, degree, edges, getAdjacentNode, getEdge, getIncidentEdge, getNode, incidentEdges, nodes, removeEdge, traverser |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public 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)
AbstractGraph
containsNode 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)
OrientedForest
childTraverser 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()
OrientedForest
rootNodes in interface OrientedForestpublic Object getRoot(Object node)
OrientedForest
getRoot in interface OrientedForestpublic boolean isLeaf(Object node)
OrientedForesttrue if the specified node has no
children.
isLeaf in interface OrientedForest
public boolean isAncestor(Object ancestor,
Object descendant)
OrientedForesttrue if ancestor is actually
an ancestor of descendant.
isAncestor in interface OrientedForest
public 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)
OrientedForest
getDepth in interface OrientedForestpublic int getHeight(Object node)
OrientedForest
getHeight in interface OrientedForest
|
Plexus v0.13.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||