public class EmptyGraph extends AbstractIntegerNodeGraph
Graph
containing a set of Integer
nodes and no edges.AbstractIntegerNodeGraph.AbstractIntegerEdgeCollection, AbstractIntegerNodeGraph.EdgeImpl
Graph.Edge
Constructor and Description |
---|
EmptyGraph(int n)
Creates a new
EmptyGraph . |
Modifier and Type | Method and Description |
---|---|
Collection |
adjacentNodes(Object node,
org.apache.commons.collections.Predicate traverserPredicate)
Returns an empty
Collection . |
boolean |
containsEdge(Graph.Edge edge)
Returns
false . |
protected Graph.Edge |
createEdge(int tailIndex,
int headIndex)
If an edge exists between the specified indices, create and
return it.
|
protected Collection |
createEdgeCollection()
Creates the (single) collection of edges for this instance.
|
protected Traverser |
createTraverser(int nodeIndex)
Creates a traverser with no filtering; assumes that the node
index is valid.
|
int |
degree(Object node)
Returns
0 . |
int |
degree(Object node,
org.apache.commons.collections.Predicate traverserPredicate)
Returns
0 . |
Collection |
edges(org.apache.commons.collections.Predicate edgePredicate)
Returns an empty
Collection . |
Object |
getAdjacentNode(Object node,
org.apache.commons.collections.Predicate traverserPredicate)
Returns
null . |
Graph.Edge |
getEdge(org.apache.commons.collections.Predicate edgePredicate)
Returns
null . |
Graph.Edge |
getIncidentEdge(Object node,
org.apache.commons.collections.Predicate traverserPredicate)
Returns
null . |
Collection |
incidentEdges(Object node,
org.apache.commons.collections.Predicate traverserPredicate)
Returns an empty
Collection . |
String |
toString() |
Traverser |
traverser(Object node,
org.apache.commons.collections.Predicate traverserPredicate)
Returns an empty
Traverser . |
checkNode, containsNode, edges, getNodeIndex, getNodeSize, nodes, removeEdge, removeNode, traverser
addEdge, addNode, getNode, nodes
public boolean containsEdge(Graph.Edge edge)
false
.containsEdge
in interface Graph
containsEdge
in class AbstractIntegerNodeGraph
edge
- the Graph.Edge
whose presence in this
Graph
is to be tested.true
if this Graph
contains
the specified Graph.Edge
.public int degree(Object node)
0
.degree
in interface Graph
degree
in class AbstractGraph
node
- return the degree of this node.node
.public int degree(Object node, org.apache.commons.collections.Predicate traverserPredicate)
0
.degree
in interface Graph
degree
in class AbstractGraph
node
- return the degree of this node for which the
specified predicate is satisfied.traverserPredicate
- the predicate which the counted
Graph.Edges
must satisfy.node
for which the
specified predicate is satisfied.public Collection edges(org.apache.commons.collections.Predicate edgePredicate)
Collection
.edges
in interface Graph
edges
in class AbstractGraph
edgePredicate
- the predicate which the returned
Graph.Edges
must satisfy.Graph.Edges
from this
Graph
that satisfy the specified
predicate
.public Collection adjacentNodes(Object node, org.apache.commons.collections.Predicate traverserPredicate)
Collection
.adjacentNodes
in interface Graph
adjacentNodes
in class AbstractGraph
node
- return the nodes adjacent to this node for which
the specified predicate is satisfied.traverserPredicate
- the predicate which the returned
nodes and the traversed Graph.Edges
must satisfy.node
for which the specified predicate is satisfied.public Collection incidentEdges(Object node, org.apache.commons.collections.Predicate traverserPredicate)
Collection
.incidentEdges
in interface Graph
incidentEdges
in class AbstractGraph
node
- return the Graph.Edges
incident on
this node for which the specified predicate is satisfied.traverserPredicate
- the predicate which the returned
Graph.Edges
must satisfy.Graph.Edges
incident on the specified
node
for which the specified predicate is
satisfied.public Graph.Edge getEdge(org.apache.commons.collections.Predicate edgePredicate)
null
.getEdge
in interface Graph
getEdge
in class AbstractGraph
edgePredicate
- the predicate which the returned
Graph.Edge
must satisfy.Graph.Edge
from this Graph
that satisfies the specified predicate
, or
null
if no such Graph.Edge
exists.public Object getAdjacentNode(Object node, org.apache.commons.collections.Predicate traverserPredicate)
null
.getAdjacentNode
in interface Graph
getAdjacentNode
in class AbstractGraph
node
- traverse to a node adjacent to this node for which
the specified predicate is satisfied.traverserPredicate
- the predicate which the returned
node and the traversed Graph.Edge
must satisfy.node
for
which the specified predicate is satisfied.public Graph.Edge getIncidentEdge(Object node, org.apache.commons.collections.Predicate traverserPredicate)
null
.getIncidentEdge
in interface Graph
getIncidentEdge
in class AbstractGraph
node
- traverse to a Graph.Edge
incident on
this node for which the specified predicate is satisfied.traverserPredicate
- the predicate which the returned
Graph.Edge
must satisfy.Graph.Edge
incident on the specified
node
for which the specified predicate is
satisfied.public Traverser traverser(Object node, org.apache.commons.collections.Predicate traverserPredicate)
Traverser
.traverser
in interface Graph
traverser
in class AbstractGraph
node
- traverse over all nodes adjacent to this node for
which the specified predicate is satisfied.traverserPredicate
- the predicate which the returned
nodes and their traversed Graph.Edges
must
satisfy.Traverser
from node
to all
adjacent nodes for which the specified predicate is satisfied.protected Graph.Edge createEdge(int tailIndex, int headIndex)
AbstractIntegerNodeGraph
null
. The indices are
assumed to represent valid nodes for this Graph
.createEdge
in class AbstractIntegerNodeGraph
protected Collection createEdgeCollection()
AbstractIntegerNodeGraph
createEdgeCollection
in class AbstractIntegerNodeGraph
protected Traverser createTraverser(int nodeIndex)
AbstractIntegerNodeGraph
createTraverser
in class AbstractIntegerNodeGraph
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.