java.lang.Object
com.phoenixst.plexus.GraphWrapper
com.phoenixst.plexus.ObservableGraphWrapper
- All Implemented Interfaces:
- Graph, ObservableGraph, java.io.Serializable
- public class ObservableGraphWrapper
- extends GraphWrapper
- implements ObservableGraph
A wrapper around a Graph so that it can be watched for
structural changes. Note: the Iterator.remove()>Iterator.remove() 55 method on Traversers created by
this class will only work if the Traversers created
by the wrapped Graph can tolerate having edges
removed while the traversal is in progress.
- Since:
- 1.0
- Version:
- $Revision: 1.18 $
| Methods inherited from class com.phoenixst.plexus.GraphWrapper |
containsEdge, containsNode, degree, edgeIterator, edgeIterator, edgeSize, getEdge, inDegree, inTraverser, isDirected, isEmpty, isSimple, nodeIterator, nodeSize, outDegree, outTraverser, traverser, unwrapEdge, unwrapEdgeObject, unwrapNode, wrapEdge, wrapEdgeObject, wrapNode |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.phoenixst.plexus.Graph |
containsEdge, containsNode, degree, edgeIterator, edgeIterator, edgeSize, getEdge, inDegree, inTraverser, isDirected, isEmpty, isSimple, nodeIterator, nodeSize, outDegree, outTraverser, traverser |
listeners
private transient java.util.List listeners
listenerArray
private transient GraphListener[] listenerArray
ObservableGraphWrapper
public ObservableGraphWrapper(Graph g)
- Creates a new
ObservableGraphWrapper.
wrapNodeIterator
protected java.util.Iterator wrapNodeIterator(java.util.Iterator nodeIter)
- Description copied from class:
GraphWrapper
- Returns a wrapped node iterator.
- Overrides:
wrapNodeIterator in class GraphWrapper
wrapEdgeIterator
protected java.util.Iterator wrapEdgeIterator(java.util.Iterator edgeIter)
- Description copied from class:
GraphWrapper
- Returns a wrapped edge iterator.
- Overrides:
wrapEdgeIterator in class GraphWrapper
wrapTraverser
protected Traverser wrapTraverser(Traverser traverser)
- Description copied from class:
GraphWrapper
- Returns a wrapped traverser.
- Overrides:
wrapTraverser in class GraphWrapper
removeIncidentEdges
protected void removeIncidentEdges(java.lang.Object node)
addNode
public boolean addNode(java.lang.Object node)
- Description copied from interface:
Graph
- Adds
node to this Graph (optional
operation). Returns true if this
Graph changed as a result of the call. Returns
false if this Graph already contains
node.
If a Graph refuses to add a particular node
for any reason other than that it already contains the node,
it must throw an exception (rather than returning
false). This preserves the invariant that a
Graph always contains the specified node after
this call returns. Graph classes should clearly
specify in their documentation any other restrictions on what
nodes may be added.
- Specified by:
addNode in interface Graph- Overrides:
addNode in class GraphWrapper
removeNode
public boolean removeNode(java.lang.Object node)
- Description copied from interface:
Graph
- Removes
node from this Graph
(optional operation). This method will also remove all edges
incident upon node.
- Specified by:
removeNode in interface Graph- Overrides:
removeNode in class GraphWrapper
addEdge
public Graph.Edge addEdge(java.lang.Object object,
java.lang.Object tail,
java.lang.Object head)
- Description copied from interface:
Graph
- Adds the specified edge to the
Graph (optional
operation). Returns the newly created Edge if
this Graph changed as a result of the call.
Returns null if this Graph does not
allow duplicate edges and already contains the specified edge.
If a Graph refuses to add a particular edge
for any reason other than that it already contains the edge,
it must throw an exception (rather than returning
null). This preserves the invariant that a
Graph always contains the specified edge after
this call returns. Graph classes should clearly
specify in their documentation any other restrictions on what
edges may be added.
- Specified by:
addEdge in interface Graph- Overrides:
addEdge in class GraphWrapper
removeEdge
public boolean removeEdge(Graph.Edge edge)
- Description copied from interface:
Graph
- Removes the specified
Edge from this
Graph (optional operation).
- Specified by:
removeEdge in interface Graph- Overrides:
removeEdge in class GraphWrapper
clear
public void clear()
- Description copied from interface:
Graph
- Removes all nodes and edges from this
Graph
(optional operation).
- Specified by:
clear in interface Graph- Overrides:
clear in class GraphWrapper
addGraphListener
public void addGraphListener(GraphListener listener)
- Description copied from interface:
ObservableGraph
- Adds the specified
GraphListener which will be
notified whenever this ObservableGraph's
structure changes.
- Specified by:
addGraphListener in interface ObservableGraph
removeGraphListener
public void removeGraphListener(GraphListener listener)
- Description copied from interface:
ObservableGraph
- Removes a previously added
GraphListener.
- Specified by:
removeGraphListener in interface ObservableGraph
createListenerArray
protected final GraphListener[] createListenerArray()
fireNodeAdded
protected void fireNodeAdded(java.lang.Object node)
fireNodeRemoved
protected void fireNodeRemoved(java.lang.Object node)
fireEdgeAdded
protected void fireEdgeAdded(Graph.Edge edge)
fireEdgeRemoved
protected void fireEdgeRemoved(Graph.Edge edge)