Class ObservableGraph<V,E>
java.lang.Object
edu.uci.ics.jung.graph.GraphDecorator<V,E>
edu.uci.ics.jung.graph.ObservableGraph<V,E>
- All Implemented Interfaces:
Graph<V,E>, Hypergraph<V, E>, Serializable
A decorator class for graphs which generates events
- See Also:
-
Field Summary
FieldsFields inherited from class GraphDecorator
delegate -
Constructor Summary
ConstructorsConstructorDescriptionObservableGraph(Graph<V, E> delegate) Creates a new instance based on the provideddelegate. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddEdge(E edge, Collection<? extends V> vertices) Addsedgeto this graph.booleanAdds edgeeto this graph such that it connects vertexv1tov2.booleanAdds edgeeto this graph such that it connects vertexv1tov2.voidAddslas a listener to this graph.booleanAddsvertexto this graph.protected voidfireGraphEvent(GraphEvent<V, E> evt) booleanremoveEdge(E edge) Removesedgefrom this graph.voidRemoveslas a listener to this graph.booleanremoveVertex(V vertex) Removesvertexfrom this graph.Methods inherited from class GraphDecorator
addEdge, containsEdge, containsVertex, degree, findEdge, findEdgeSet, getDefaultEdgeType, getDest, getEdgeCount, getEdgeCount, getEdges, getEdges, getEdgeType, getEndpoints, getIncidentCount, getIncidentEdges, getIncidentVertices, getInEdges, getNeighborCount, getNeighbors, getOpposite, getOutEdges, getPredecessorCount, getPredecessors, getSource, getSuccessorCount, getSuccessors, getVertexCount, getVertices, inDegree, isDest, isIncident, isNeighbor, isPredecessor, isSource, isSuccessor, outDegree
-
Field Details
-
listenerList
List<GraphEventListener<V,E>> listenerList
-
-
Constructor Details
-
ObservableGraph
-
-
Method Details
-
addGraphEventListener
Addslas a listener to this graph.- Parameters:
l- the listener to add
-
removeGraphEventListener
Removeslas a listener to this graph.- Parameters:
l- the listener to remove
-
fireGraphEvent
-
addEdge
Description copied from interface:HypergraphAddsedgeto this graph. Fails under the following circumstances:edgeis already an element of the graph- either
edgeorverticesisnull verticeshas the wrong number of vertices for the graph typeverticesare already connected by another edge in this graph, and this graph does not accept parallel edges
- Specified by:
addEdgein interfaceHypergraph<V,E> - Overrides:
addEdgein classGraphDecorator<V,E> - Parameters:
edge- the edge to addvertices- the vertices to which the edge will be connected- Returns:
trueif the add is successful, andfalseotherwise- See Also:
-
addEdge
Description copied from interface:GraphAdds edgeeto this graph such that it connects vertexv1tov2. Equivalent toaddEdge(e, new Pair(v1, v2)). If this graph does not containv1,v2, or both, implementations may choose to either silently add the vertices to the graph or throw anIllegalArgumentException. IfedgeTypeis not legal for this graph, this method will throwIllegalArgumentException. SeeHypergraph.addEdge()for a listing of possible reasons for failure.- Specified by:
addEdgein interfaceGraph<V,E> - Overrides:
addEdgein classGraphDecorator<V,E> - Parameters:
e- the edge to be addedv1- the first vertex to be connectedv2- the second vertex to be connectededgeType- the type to be assigned to the edge- Returns:
trueif the add is successful,falseotherwise- See Also:
-
addEdge
Description copied from interface:GraphAdds edgeeto this graph such that it connects vertexv1tov2. Equivalent toaddEdge(e, new Pair(v1, v2)). If this graph does not containv1,v2, or both, implementations may choose to either silently add the vertices to the graph or throw anIllegalArgumentException. If this graph assigns edge types to its edges, the edge type ofewill be the default for this graph. SeeHypergraph.addEdge()for a listing of possible reasons for failure. -
addVertex
Description copied from interface:HypergraphAddsvertexto this graph. Fails ifvertexis null or already in the graph.- Specified by:
addVertexin interfaceHypergraph<V,E> - Overrides:
addVertexin classGraphDecorator<V,E> - Parameters:
vertex- the vertex to add- Returns:
trueif the add is successful, andfalseotherwise- See Also:
-
removeEdge
Description copied from interface:HypergraphRemovesedgefrom this graph. Fails ifedgeis null, or is otherwise not an element of this graph.- Specified by:
removeEdgein interfaceHypergraph<V,E> - Overrides:
removeEdgein classGraphDecorator<V,E> - Parameters:
edge- the edge to remove- Returns:
trueif the removal is successful,falseotherwise- See Also:
-
removeVertex
Description copied from interface:HypergraphRemovesvertexfrom this graph. As a side effect, removes any edgeseincident tovertexif the removal ofvertexwould causeeto be incident to an illegal number of vertices. (Thus, for example, incident hyperedges are not removed, but incident edges--which must be connected to a vertex at both endpoints--are removed.)Fails under the following circumstances:
vertexis not an element of this graphvertexisnull
- Specified by:
removeVertexin interfaceHypergraph<V,E> - Overrides:
removeVertexin classGraphDecorator<V,E> - Parameters:
vertex- the vertex to remove- Returns:
trueif the removal is successful,falseotherwise- See Also:
-