org._3pq.jgrapht.graph
Class DefaultListenableGraph
- Cloneable, Graph, ListenableGraph, Serializable
public class DefaultListenableGraph
A graph backed by the the graph specified at the constructor, which can be
listened by
GraphListener
s and by
VertexSetListener
s. 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.
addEdge , addEdge , addVertex , containsEdge , containsVertex , degreeOf , edgeSet , edgesOf , getAllEdges , getEdge , getEdgeFactory , inDegreeOf , incomingEdgesOf , outDegreeOf , outgoingEdgesOf , removeEdge , removeEdge , removeVertex , toString , vertexSet |
DefaultListenableGraph
public DefaultListenableGraph(Graph g)
Creates a new listenable graph.
DefaultListenableGraph
public DefaultListenableGraph(Graph g,
boolean reuseEvents)
Creates a new listenable graph. If the reuseEvents
flag is
set to true
this class will reuse previously fired events
and will not create a new object for each event. This option increases
performance but should be used with care, especially in multithreaded
environment.
g
- the backing graph.reuseEvents
- whether to reuse previously fired event objects
instead of creating a new event object for each event.
clone
public Object clone()
fireEdgeAdded
protected void fireEdgeAdded(Edge edge)
Notify listeners that the specified edge was added.
edge
- the edge that was added.
fireEdgeRemoved
protected void fireEdgeRemoved(Edge edge)
Notify listeners that the specified edge was removed.
edge
- the edge that was removed.
fireVertexAdded
protected void fireVertexAdded(Object vertex)
Notify listeners that the specified vertex was added.
vertex
- the vertex that was added.
fireVertexRemoved
protected void fireVertexRemoved(Object vertex)
Notify listeners that the specified vertex was removed.
vertex
- the vertex that was removed.
isReuseEvents
public boolean isReuseEvents()
Tests whether the reuseEvents
flag is set. If the flag is
set to true
this class will reuse previously fired events
and will not create a new object for each event. This option increases
performance but should be used with care, especially in multithreaded
environment.
- the value of the
reuseEvents
flag.
setReuseEvents
public void setReuseEvents(boolean reuseEvents)
If the reuseEvents
flag is set to true
this
class will reuse previously fired events and will not create a new
object for each event. This option increases performance but should be
used with care, especially in multithreaded environment.
reuseEvents
- whether to reuse previously fired event objects
instead of creating a new event object for each event.