org._3pq.jgrapht.graph

Class GraphDelegator

Implemented Interfaces:
Graph, Serializable
Known Direct Subclasses:
AsUndirectedGraph, DefaultListenableGraph, UnmodifiableGraph

public class GraphDelegator
extends AbstractGraph
implements Graph, Serializable

A graph backed by the the graph specified at the constructor, which delegates all its methods to the backing graph. Operations on this graph "pass through" to the to the backing graph. Any modification made to this graph or the backing graph is reflected by the other.

This graph does not pass the hashCode and equals operations through to the backing graph, but relies on Object's equals and hashCode methods.

This class is mostly used as a base for extending subclasses.

Author:
Barak Naveh
Since:
Jul 20, 2003

Constructor Summary

GraphDelegator(Graph g)
Constructor for GraphDelegator.

Method Summary

Edge
addEdge(Object sourceVertex, Object targetVertex)
boolean
addEdge(Edge e)
boolean
addVertex(Object v)
boolean
containsEdge(Edge e)
boolean
containsVertex(Object v)
int
degreeOf(Object vertex)
Set
edgeSet()
List
edgesOf(Object vertex)
List
getAllEdges(Object sourceVertex, Object targetVertex)
Edge
getEdge(Object sourceVertex, Object targetVertex)
EdgeFactory
getEdgeFactory()
int
inDegreeOf(Object vertex)
List
incomingEdgesOf(Object vertex)
int
outDegreeOf(Object vertex)
List
outgoingEdgesOf(Object vertex)
Edge
removeEdge(Object sourceVertex, Object targetVertex)
boolean
removeEdge(Edge e)
boolean
removeVertex(Object v)
String
toString()
Set
vertexSet()

Methods inherited from class org._3pq.jgrapht.graph.AbstractGraph

addAllEdges, addAllVertices, assertVertexExist, containsEdge, removeAllEdges, removeAllEdges, removeAllEdges, removeAllVertices, toString, toStringFromSets

Constructor Details

GraphDelegator

public GraphDelegator(Graph g)
Constructor for GraphDelegator.
Parameters:
g - the backing graph (the delegate).

Method Details

addEdge

public Edge addEdge(Object sourceVertex,
                    Object targetVertex)
Specified by:
addEdge in interface Graph

addEdge

public boolean addEdge(Edge e)
Specified by:
addEdge in interface Graph

addVertex

public boolean addVertex(Object v)
Specified by:
addVertex in interface Graph

containsEdge

public boolean containsEdge(Edge e)
Specified by:
containsEdge in interface Graph

containsVertex

public boolean containsVertex(Object v)
Specified by:
containsVertex in interface Graph

degreeOf

public int degreeOf(Object vertex)

edgeSet

public Set edgeSet()
Specified by:
edgeSet in interface Graph

edgesOf

public List edgesOf(Object vertex)
Specified by:
edgesOf in interface Graph

getAllEdges

public List getAllEdges(Object sourceVertex,
                        Object targetVertex)
Specified by:
getAllEdges in interface Graph

getEdge

public Edge getEdge(Object sourceVertex,
                    Object targetVertex)
Specified by:
getEdge in interface Graph

getEdgeFactory

public EdgeFactory getEdgeFactory()
Specified by:
getEdgeFactory in interface Graph

inDegreeOf

public int inDegreeOf(Object vertex)

incomingEdgesOf

public List incomingEdgesOf(Object vertex)

outDegreeOf

public int outDegreeOf(Object vertex)

outgoingEdgesOf

public List outgoingEdgesOf(Object vertex)

removeEdge

public Edge removeEdge(Object sourceVertex,
                       Object targetVertex)
Specified by:
removeEdge in interface Graph

removeEdge

public boolean removeEdge(Edge e)
Specified by:
removeEdge in interface Graph

removeVertex

public boolean removeVertex(Object v)
Specified by:
removeVertex in interface Graph

toString

public String toString()
Overrides:
toString in interface AbstractGraph
See Also:
java.lang.Object.toString()

vertexSet

public Set vertexSet()
Specified by:
vertexSet in interface Graph