Plexus v0.13.1

com.phoenixst.plexus.examples
Class EmptyGraph

java.lang.Object
  extended by com.phoenixst.plexus.AbstractGraph
      extended by com.phoenixst.plexus.examples.AbstractIntegerNodeGraph
          extended by com.phoenixst.plexus.examples.EmptyGraph
All Implemented Interfaces:
Graph, Serializable

public class EmptyGraph
extends AbstractIntegerNodeGraph

A Graph containing a set of Integer nodes and no edges.

Since:
1.0
Version:
$Revision: 1.25 $
Author:
Ray A. Conner
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.phoenixst.plexus.examples.AbstractIntegerNodeGraph
AbstractIntegerNodeGraph.AbstractIntegerEdgeCollection, AbstractIntegerNodeGraph.EdgeImpl
 
Nested classes/interfaces inherited from interface com.phoenixst.plexus.Graph
Graph.Edge
 
Constructor Summary
EmptyGraph(int n)
          Creates a new EmptyGraph.
 
Method Summary
 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.
 
Methods inherited from class com.phoenixst.plexus.examples.AbstractIntegerNodeGraph
checkNode, containsNode, edges, getNodeIndex, getNodeSize, nodes, removeEdge, removeNode, traverser
 
Methods inherited from class com.phoenixst.plexus.AbstractGraph
addEdge, addNode, getNode, nodes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EmptyGraph

public EmptyGraph(int n)
Creates a new EmptyGraph.

Method Detail

containsEdge

public boolean containsEdge(Graph.Edge edge)
Returns false.

Specified by:
containsEdge in interface Graph
Overrides:
containsEdge in class AbstractIntegerNodeGraph
Parameters:
edge - the Graph.Edge whose presence in this Graph is to be tested.
Returns:
true if this Graph contains the specified Graph.Edge.

degree

public int degree(Object node)
Returns 0.

Specified by:
degree in interface Graph
Overrides:
degree in class AbstractGraph
Parameters:
node - return the degree of this node.
Returns:
the degree of node.

degree

public int degree(Object node,
                  org.apache.commons.collections.Predicate traverserPredicate)
Returns 0.

Specified by:
degree in interface Graph
Overrides:
degree in class AbstractGraph
Parameters:
node - return the degree of this node for which the specified predicate is satisfied.
traverserPredicate - the predicate which the counted Graph.Edges must satisfy.
Returns:
the degree of node for which the specified predicate is satisfied.

edges

public Collection edges(org.apache.commons.collections.Predicate edgePredicate)
Returns an empty Collection.

Specified by:
edges in interface Graph
Overrides:
edges in class AbstractGraph
Parameters:
edgePredicate - the predicate which the returned Graph.Edges must satisfy.
Returns:
the Graph.Edges from this Graph that satisfy the specified predicate.

adjacentNodes

public Collection adjacentNodes(Object node,
                                org.apache.commons.collections.Predicate traverserPredicate)
Returns an empty Collection.

Specified by:
adjacentNodes in interface Graph
Overrides:
adjacentNodes in class AbstractGraph
Parameters:
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.
Returns:
the nodes adjacent to the specified node for which the specified predicate is satisfied.

incidentEdges

public Collection incidentEdges(Object node,
                                org.apache.commons.collections.Predicate traverserPredicate)
Returns an empty Collection.

Specified by:
incidentEdges in interface Graph
Overrides:
incidentEdges in class AbstractGraph
Parameters:
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.
Returns:
the Graph.Edges incident on the specified node for which the specified predicate is satisfied.

getEdge

public Graph.Edge getEdge(org.apache.commons.collections.Predicate edgePredicate)
Returns null.

Specified by:
getEdge in interface Graph
Overrides:
getEdge in class AbstractGraph
Parameters:
edgePredicate - the predicate which the returned Graph.Edge must satisfy.
Returns:
a Graph.Edge from this Graph that satisfies the specified predicate, or null if no such Graph.Edge exists.

getAdjacentNode

public Object getAdjacentNode(Object node,
                              org.apache.commons.collections.Predicate traverserPredicate)
Returns null.

Specified by:
getAdjacentNode in interface Graph
Overrides:
getAdjacentNode in class AbstractGraph
Parameters:
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.
Returns:
a node adjacent to the specified node for which the specified predicate is satisfied.

getIncidentEdge

public Graph.Edge getIncidentEdge(Object node,
                                  org.apache.commons.collections.Predicate traverserPredicate)
Returns null.

Specified by:
getIncidentEdge in interface Graph
Overrides:
getIncidentEdge in class AbstractGraph
Parameters:
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.
Returns:
a Graph.Edge incident on the specified node for which the specified predicate is satisfied.

traverser

public Traverser traverser(Object node,
                           org.apache.commons.collections.Predicate traverserPredicate)
Returns an empty Traverser.

Specified by:
traverser in interface Graph
Overrides:
traverser in class AbstractGraph
Parameters:
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.
Returns:
a Traverser from node to all adjacent nodes for which the specified predicate is satisfied.

createEdge

protected Graph.Edge createEdge(int tailIndex,
                                int headIndex)
Description copied from class: AbstractIntegerNodeGraph
If an edge exists between the specified indices, create and return it. If not, return null. The indices are assumed to represent valid nodes for this Graph.

Specified by:
createEdge in class AbstractIntegerNodeGraph

createEdgeCollection

protected Collection createEdgeCollection()
Description copied from class: AbstractIntegerNodeGraph
Creates the (single) collection of edges for this instance.

Specified by:
createEdgeCollection in class AbstractIntegerNodeGraph

createTraverser

protected Traverser createTraverser(int nodeIndex)
Description copied from class: AbstractIntegerNodeGraph
Creates a traverser with no filtering; assumes that the node index is valid.

Specified by:
createTraverser in class AbstractIntegerNodeGraph

toString

public String toString()
Overrides:
toString in class Object

Plexus v0.13.1

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.