View Javadoc

1   package edu.uci.ics.jung.graph;
2   
3   import java.io.Serializable;
4   import java.util.Collection;
5   
6   import edu.uci.ics.jung.graph.util.EdgeType;
7   import edu.uci.ics.jung.graph.util.Pair;
8   
9   /**
10   * An implementation of <code>Graph</code> that delegates its method calls to a
11   * constructor-specified <code>Graph</code> instance.  This is useful for adding
12   * additional behavior (such as synchronization or unmodifiability) to an existing
13   * instance.
14   */
15  @SuppressWarnings("serial")
16  public class GraphDecorator<V,E> implements Graph<V,E>, Serializable {
17  	
18  	protected Graph<V,E> delegate;
19  
20      /**
21       * Creates a new instance based on the provided {@code delegate}.
22       * @param delegate
23       */
24  	public GraphDecorator(Graph<V, E> delegate) {
25  		this.delegate = delegate;
26  	}
27  
28  	/**
29  	 * @see edu.uci.ics.jung.graph.Hypergraph#addEdge(java.lang.Object, java.util.Collection)
30  	 */
31  	public boolean addEdge(E edge, Collection<? extends V> vertices) {
32  		return delegate.addEdge(edge, vertices);
33  	}
34  	
35  	/**
36  	 * @see Hypergraph#addEdge(Object, Collection, EdgeType)
37  	 */
38  	public boolean addEdge(E edge, Collection<? extends V> vertices, EdgeType
39  		edge_type)
40  	{
41  		return delegate.addEdge(edge, vertices, edge_type);
42  	}
43  	
44  	/**
45  	 * @see edu.uci.ics.jung.graph.Graph#addEdge(java.lang.Object, java.lang.Object, java.lang.Object, edu.uci.ics.jung.graph.util.EdgeType)
46  	 */
47  	public boolean addEdge(E e, V v1, V v2, EdgeType edgeType) {
48  		return delegate.addEdge(e, v1, v2, edgeType);
49  	}
50  
51  	/**
52  	 * @see edu.uci.ics.jung.graph.Graph#addEdge(java.lang.Object, java.lang.Object, java.lang.Object)
53  	 */
54  	public boolean addEdge(E e, V v1, V v2) {
55  		return delegate.addEdge(e, v1, v2);
56  	}
57  
58  	/**
59  	 * @see edu.uci.ics.jung.graph.Hypergraph#addVertex(java.lang.Object)
60  	 */
61  	public boolean addVertex(V vertex) {
62  		return delegate.addVertex(vertex);
63  	}
64  
65  	/**
66  	 * @see edu.uci.ics.jung.graph.Hypergraph#isIncident(java.lang.Object, java.lang.Object)
67  	 */
68  	public boolean isIncident(V vertex, E edge) {
69  		return delegate.isIncident(vertex, edge);
70  	}
71  
72  	/**
73  	 * @see edu.uci.ics.jung.graph.Hypergraph#isNeighbor(java.lang.Object, java.lang.Object)
74  	 */
75  	public boolean isNeighbor(V v1, V v2) {
76  		return delegate.isNeighbor(v1, v2);
77  	}
78  
79  	/**
80  	 * @see edu.uci.ics.jung.graph.Hypergraph#degree(java.lang.Object)
81  	 */
82  	public int degree(V vertex) {
83  		return delegate.degree(vertex);
84  	}
85  
86  	/**
87  	 * @see edu.uci.ics.jung.graph.Hypergraph#findEdge(java.lang.Object, java.lang.Object)
88  	 */
89  	public E findEdge(V v1, V v2) {
90  		return delegate.findEdge(v1, v2);
91  	}
92  
93  	/**
94  	 * @see edu.uci.ics.jung.graph.Hypergraph#findEdgeSet(java.lang.Object, java.lang.Object)
95  	 */
96  	public Collection<E> findEdgeSet(V v1, V v2) {
97  		return delegate.findEdgeSet(v1, v2);
98  	}
99  
100 	/**
101 	 * @see edu.uci.ics.jung.graph.Graph#getDest(java.lang.Object)
102 	 */
103 	public V getDest(E directed_edge) {
104 		return delegate.getDest(directed_edge);
105 	}
106 
107 	/**
108 	 * @see edu.uci.ics.jung.graph.Hypergraph#getEdgeCount()
109 	 */
110 	public int getEdgeCount() {
111 		return delegate.getEdgeCount();
112 	}
113 
114 	/**
115 	 * @see edu.uci.ics.jung.graph.Hypergraph#getEdgeCount(EdgeType)
116 	 */
117 	public int getEdgeCount(EdgeType edge_type) 
118 	{
119 	    return delegate.getEdgeCount(edge_type);
120 	}
121 	
122 	/**
123 	 * @see edu.uci.ics.jung.graph.Hypergraph#getEdges()
124 	 */
125 	public Collection<E> getEdges() {
126 		return delegate.getEdges();
127 	}
128 
129 	/**
130 	 * @see edu.uci.ics.jung.graph.Graph#getEdges(edu.uci.ics.jung.graph.util.EdgeType)
131 	 */
132 	public Collection<E> getEdges(EdgeType edgeType) {
133 		return delegate.getEdges(edgeType);
134 	}
135 
136 	/**
137 	 * @see edu.uci.ics.jung.graph.Graph#getEdgeType(java.lang.Object)
138 	 */
139 	public EdgeType getEdgeType(E edge) {
140 		return delegate.getEdgeType(edge);
141 	}
142 
143 	/**
144 	 * @see edu.uci.ics.jung.graph.Graph#getDefaultEdgeType()
145 	 */
146 	public EdgeType getDefaultEdgeType() 
147 	{
148 		return delegate.getDefaultEdgeType();
149 	}
150 	
151 	/**
152 	 * @see edu.uci.ics.jung.graph.Graph#getEndpoints(java.lang.Object)
153 	 */
154 	public Pair<V> getEndpoints(E edge) {
155 		return delegate.getEndpoints(edge);
156 	}
157 
158 	/**
159 	 * @see edu.uci.ics.jung.graph.Hypergraph#getIncidentCount(java.lang.Object)
160 	 */
161 	public int getIncidentCount(E edge) {
162 		return delegate.getIncidentCount(edge);
163 	}
164 
165 	/**
166 	 * @see edu.uci.ics.jung.graph.Hypergraph#getIncidentEdges(java.lang.Object)
167 	 */
168 	public Collection<E> getIncidentEdges(V vertex) {
169 		return delegate.getIncidentEdges(vertex);
170 	}
171 
172 	/**
173 	 * @see edu.uci.ics.jung.graph.Hypergraph#getIncidentVertices(java.lang.Object)
174 	 */
175 	public Collection<V> getIncidentVertices(E edge) {
176 		return delegate.getIncidentVertices(edge);
177 	}
178 
179 	/**
180 	 * @see edu.uci.ics.jung.graph.Graph#getInEdges(java.lang.Object)
181 	 */
182 	public Collection<E> getInEdges(V vertex) {
183 		return delegate.getInEdges(vertex);
184 	}
185 
186 	/**
187 	 * @see edu.uci.ics.jung.graph.Hypergraph#getNeighborCount(java.lang.Object)
188 	 */
189 	public int getNeighborCount(V vertex) {
190 		return delegate.getNeighborCount(vertex);
191 	}
192 
193 	/**
194 	 * @see edu.uci.ics.jung.graph.Hypergraph#getNeighbors(java.lang.Object)
195 	 */
196 	public Collection<V> getNeighbors(V vertex) {
197 		return delegate.getNeighbors(vertex);
198 	}
199 
200 	/**
201 	 * @see edu.uci.ics.jung.graph.Graph#getOpposite(java.lang.Object, java.lang.Object)
202 	 */
203 	public V getOpposite(V vertex, E edge) {
204 		return delegate.getOpposite(vertex, edge);
205 	}
206 
207 	/**
208 	 * @see edu.uci.ics.jung.graph.Graph#getOutEdges(java.lang.Object)
209 	 */
210 	public Collection<E> getOutEdges(V vertex) {
211 		return delegate.getOutEdges(vertex);
212 	}
213 
214 	/**
215 	 * @see edu.uci.ics.jung.graph.Graph#getPredecessorCount(java.lang.Object)
216 	 */
217 	public int getPredecessorCount(V vertex) {
218 		return delegate.getPredecessorCount(vertex);
219 	}
220 
221 	/**
222 	 * @see edu.uci.ics.jung.graph.Graph#getPredecessors(java.lang.Object)
223 	 */
224 	public Collection<V> getPredecessors(V vertex) {
225 		return delegate.getPredecessors(vertex);
226 	}
227 
228 	/**
229 	 * @see edu.uci.ics.jung.graph.Graph#getSource(java.lang.Object)
230 	 */
231 	public V getSource(E directed_edge) {
232 		return delegate.getSource(directed_edge);
233 	}
234 
235 	/**
236 	 * @see edu.uci.ics.jung.graph.Graph#getSuccessorCount(java.lang.Object)
237 	 */
238 	public int getSuccessorCount(V vertex) {
239 		return delegate.getSuccessorCount(vertex);
240 	}
241 
242 	/**
243 	 * @see edu.uci.ics.jung.graph.Graph#getSuccessors(java.lang.Object)
244 	 */
245 	public Collection<V> getSuccessors(V vertex) {
246 		return delegate.getSuccessors(vertex);
247 	}
248 
249 	/**
250 	 * @see edu.uci.ics.jung.graph.Hypergraph#getVertexCount()
251 	 */
252 	public int getVertexCount() {
253 		return delegate.getVertexCount();
254 	}
255 
256 	/**
257 	 * @see edu.uci.ics.jung.graph.Hypergraph#getVertices()
258 	 */
259 	public Collection<V> getVertices() {
260 		return delegate.getVertices();
261 	}
262 
263 	/**
264 	 * @see edu.uci.ics.jung.graph.Graph#inDegree(java.lang.Object)
265 	 */
266 	public int inDegree(V vertex) {
267 		return delegate.inDegree(vertex);
268 	}
269 
270 	/**
271 	 * @see edu.uci.ics.jung.graph.Graph#isDest(java.lang.Object, java.lang.Object)
272 	 */
273 	public boolean isDest(V vertex, E edge) {
274 		return delegate.isDest(vertex, edge);
275 	}
276 
277 	/**
278 	 * @see edu.uci.ics.jung.graph.Graph#isPredecessor(java.lang.Object, java.lang.Object)
279 	 */
280 	public boolean isPredecessor(V v1, V v2) {
281 		return delegate.isPredecessor(v1, v2);
282 	}
283 
284 	/**
285 	 * @see edu.uci.ics.jung.graph.Graph#isSource(java.lang.Object, java.lang.Object)
286 	 */
287 	public boolean isSource(V vertex, E edge) {
288 		return delegate.isSource(vertex, edge);
289 	}
290 
291 	/**
292 	 * @see edu.uci.ics.jung.graph.Graph#isSuccessor(java.lang.Object, java.lang.Object)
293 	 */
294 	public boolean isSuccessor(V v1, V v2) {
295 		return delegate.isSuccessor(v1, v2);
296 	}
297 
298 	/**
299 	 * @see edu.uci.ics.jung.graph.Graph#outDegree(java.lang.Object)
300 	 */
301 	public int outDegree(V vertex) {
302 		return delegate.outDegree(vertex);
303 	}
304 
305 	/**
306 	 * @see edu.uci.ics.jung.graph.Hypergraph#removeEdge(java.lang.Object)
307 	 */
308 	public boolean removeEdge(E edge) {
309 		return delegate.removeEdge(edge);
310 	}
311 
312 	/**
313 	 * @see edu.uci.ics.jung.graph.Hypergraph#removeVertex(java.lang.Object)
314 	 */
315 	public boolean removeVertex(V vertex) {
316 		return delegate.removeVertex(vertex);
317 	}
318 
319 	/**
320 	 * @see edu.uci.ics.jung.graph.Hypergraph#containsEdge(java.lang.Object)
321 	 */
322 	public boolean containsEdge(E edge) {
323 		return delegate.containsEdge(edge);
324 	}
325 
326 	/**
327 	 * @see edu.uci.ics.jung.graph.Hypergraph#containsVertex(java.lang.Object)
328 	 */
329 	public boolean containsVertex(V vertex) {
330 		return delegate.containsVertex(vertex);
331 	}
332 }