|
Plexus v0.13.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.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()
AbstractGraph
Collection
view of all the nodes
in this Graph
. This method is only called
by nodes( Predicate )
.
nodes
in class AbstractGraph
protected Collection edges()
AbstractGraph
Collection
view of all the
Graph.Edges
in this Graph
.
This method is only called by edges( Predicate )
.
edges
in class AbstractGraph
protected Traverser traverser(Object node)
AbstractGraph
Traverser
over those
Graph.Edges
incident to the specified node.
This method is only called by traverser( node, Predicate )
.
traverser
in class AbstractGraph
public int degree(Object node)
AbstractGraph
traverser(
node, null )
method, counting self-loops twice.
degree
in interface Graph
degree
in class AbstractGraph
node
- return the degree of this node.
node
.public boolean containsNode(Object node)
AbstractGraph
containsNode
in interface Graph
containsNode
in class AbstractGraph
node
- the node whose presence in this Graph
is to be tested.
true
if this Graph
contains
the specified node.public boolean removeNode(Object node)
AbstractGraph
Iterator.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 Graph
removeNode
in class AbstractGraph
node
- the node to be removed from this
Graph
.
true
if this Graph
contained
node
.public boolean containsEdge(Graph.Edge edge)
AbstractGraph
edge
,
looking for it and returning true
if found.
containsEdge
in interface Graph
containsEdge
in class AbstractGraph
edge
- 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)
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
|
Plexus v0.13.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |