org._3pq.jgrapht.graph

Class UnmodifiableGraph

Implemented Interfaces:
Serializable, Graph
Known Direct Subclasses:
UnmodifiableDirectedGraph, UnmodifiableUndirectedGraph

public class UnmodifiableGraph
extends GraphDelegator
implements Serializable

An unmodifiable view of the backing graph specified in the constructor. This graph allows modules to provide users with "read-only" access to internal graphs. Query operations on this graph "read through" to the backing graph, and attempts to modify this graph result in an UnsupportedOperationException.

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 graph will be serializable if the backing graph is serializable.

Author:
Barak Naveh
Since:
Jul 24, 2003

Constructor Summary

UnmodifiableGraph(Graph g)
Creates a new unmodifiable graph based on the specified backing graph.

Method Summary

boolean
addAllEdges(Collection edges)
boolean
addAllVertices(Collection vertices)
Edge
addEdge(Object sourceVertex, Object targetVertex)
boolean
addEdge(Edge e)
boolean
addVertex(Object v)
boolean
removeAllEdges(Collection edges)
List
removeAllEdges(Object sourceVertex, Object targetVertex)
boolean
removeAllVertices(Collection vertices)
Edge
removeEdge(Object sourceVertex, Object targetVertex)
boolean
removeEdge(Edge e)
boolean
removeVertex(Object v)

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

addEdge, addEdge, addVertex, containsEdge, containsVertex, degreeOf, edgeSet, edgesOf, getAllEdges, getEdge, getEdgeFactory, inDegreeOf, incomingEdgesOf, outDegreeOf, outgoingEdgesOf, removeEdge, removeEdge, removeVertex, toString, vertexSet

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

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

Constructor Details

UnmodifiableGraph

public UnmodifiableGraph(Graph g)
Creates a new unmodifiable graph based on the specified backing graph.
Parameters:
g - the backing graph on which an unmodifiable graph is to be created.

Method Details

addAllEdges

public boolean addAllEdges(Collection edges)
Specified by:
addAllEdges in interface Graph
Overrides:
addAllEdges in interface AbstractGraph

addAllVertices

public boolean addAllVertices(Collection vertices)
Specified by:
addAllVertices in interface Graph
Overrides:
addAllVertices in interface AbstractGraph

addEdge

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

addEdge

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

addVertex

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

removeAllEdges

public boolean removeAllEdges(Collection edges)
Specified by:
removeAllEdges in interface Graph
Overrides:
removeAllEdges in interface AbstractGraph

removeAllEdges

public List removeAllEdges(Object sourceVertex,
                           Object targetVertex)
Specified by:
removeAllEdges in interface Graph
Overrides:
removeAllEdges in interface AbstractGraph

removeAllVertices

public boolean removeAllVertices(Collection vertices)
Specified by:
removeAllVertices in interface Graph
Overrides:
removeAllVertices in interface AbstractGraph

removeEdge

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

removeEdge

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

removeVertex

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