public class FilteredGraph extends AbstractGraph implements ObservableGraph
Graph implementation. Unlike other
Graph wrappers and implementations, and in violation
of the contract for Graph.Edge.equals(),
the Edges produced by this Graph are not
wrapped.Graph.Edge| Modifier | Constructor and Description |
|---|---|
protected |
FilteredGraph()
This constructor, together with
initialize(Graph,
Predicate, Predicate), allows a subclass to initialize the
internal state during deserialization. |
|
FilteredGraph(Graph delegate,
org.apache.commons.collections.Predicate nodePredicate,
org.apache.commons.collections.Predicate edgePredicate)
Creates a new
FilteredGraph. |
| Modifier and Type | Method and Description |
|---|---|
Graph.Edge |
addEdge(Object object,
Object tail,
Object head,
boolean isDirected)
This implementation throws an
UnsupportedOperationException. |
void |
addGraphListener(GraphListener listener)
Adds the specified
GraphListener which will be
notified whenever this ObservableGraph's
structure changes. |
boolean |
addNode(Object node)
This implementation throws an
UnsupportedOperationException. |
boolean |
containsEdge(Graph.Edge edge)
This implementation traverses over the edges in this graph
incident on the tail of the specified
edge,
looking for it and returning true if found. |
boolean |
containsNode(Object node)
This implementation iterates over the nodes in this graph
looking for the specified element.
|
protected Collection |
edges()
Returns a
Collection view of all the
Graph.Edges in this Graph. |
protected Graph |
getDelegate()
Provides accesss to the internal state so it can be manually
serialized by a subclass's
writeObject() method. |
protected org.apache.commons.collections.Predicate |
getEdgePredicate()
Provides accesss to the internal state so it can be manually
serialized by a subclass's
writeObject() method. |
protected org.apache.commons.collections.Predicate |
getNodePredicate()
Provides accesss to the internal state so it can be manually
serialized by a subclass's
writeObject() method. |
protected void |
initialize(Graph delegateGraph,
org.apache.commons.collections.Predicate nodePred,
org.apache.commons.collections.Predicate edgePred)
This method should only be called by subclasses during
deserialization.
|
protected Collection |
nodes()
Returns a
Collection view of all the nodes
in this Graph. |
boolean |
removeEdge(Graph.Edge edge)
This implementation traverses over the edges in this graph
incident on the tail of the specified
edge. |
void |
removeGraphListener(GraphListener listener)
Removes a previously added
GraphListener. |
boolean |
removeNode(Object node)
This implementation iterates over the nodes in this graph
looking for the specified element.
|
protected Traverser |
traverser(Object node)
Returns an unfiltered
Traverser over those
Graph.Edges incident to the specified node. |
adjacentNodes, degree, degree, edges, getAdjacentNode, getEdge, getIncidentEdge, getNode, incidentEdges, nodes, traverserclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadjacentNodes, degree, degree, edges, getAdjacentNode, getEdge, getIncidentEdge, getNode, incidentEdges, nodes, traverserpublic FilteredGraph(Graph delegate, org.apache.commons.collections.Predicate nodePredicate, org.apache.commons.collections.Predicate edgePredicate)
FilteredGraph.protected FilteredGraph()
initialize(Graph,
Predicate, Predicate), allows a subclass to initialize the
internal state during deserialization.protected final void initialize(Graph delegateGraph, org.apache.commons.collections.Predicate nodePred, org.apache.commons.collections.Predicate edgePred)
protected final Graph getDelegate()
writeObject() method.protected final org.apache.commons.collections.Predicate getEdgePredicate()
writeObject() method.protected final org.apache.commons.collections.Predicate getNodePredicate()
writeObject() method.protected Collection nodes()
AbstractGraphCollection view of all the nodes
in this Graph. This method is only called
by nodes( Predicate ).nodes in class AbstractGraphprotected Collection edges()
AbstractGraphCollection view of all the
Graph.Edges in this Graph.
This method is only called by edges( Predicate ).edges in class AbstractGraphprotected Traverser traverser(Object node)
AbstractGraphTraverser over those
Graph.Edges incident to the specified node.
This method is only called by traverser( node, Predicate ).traverser in class AbstractGraphpublic boolean addNode(Object node)
AbstractGraphUnsupportedOperationException.addNode in interface GraphaddNode in class AbstractGraphnode - the node to be added to this Graph.true if this Graph changed
as a result of the call, false if this
Graph already contains the specified node.public boolean removeNode(Object node)
AbstractGraphIterator.remove() operation.
Note that this implementation will throw an
UnsupportedOperationException if the iterator
returned by this graph's nodes( null ).iterator()
method does not implement the remove method and
this graph contains the specified node.
removeNode in interface GraphremoveNode in class AbstractGraphnode - the node to be removed from this
Graph.true if this Graph contained
node.public boolean containsNode(Object node)
AbstractGraphcontainsNode in interface GraphcontainsNode in class AbstractGraphnode - the node whose presence in this Graph
is to be tested.true if this Graph contains
the specified node.public Graph.Edge addEdge(Object object, Object tail, Object head, boolean isDirected)
AbstractGraphUnsupportedOperationException.addEdge in interface GraphaddEdge in class AbstractGraphobject - the user-defined object to be contained in the
new edge.tail - the first endpoint of the new edge.head - the second endpoint of the new edge.isDirected - whether the new edge is directed.Graph.Edge if this
Graph changed as a result of the call,
null if this Graph does not allow
duplicate edges and already contains the specified edge.public boolean removeEdge(Graph.Edge edge)
AbstractGraphedge. If
it finds the element, it removes the element using using the
Iterator.remove() operation.
Note that this implementation will throw an
UnsupportedOperationException if the traverser
returned by this graph's traverser( node, predicate ) method does not implement the
removeEdge method and this graph contains the
specified edge.
removeEdge in interface GraphremoveEdge in class AbstractGraphedge - the Graph.Edge to be removed from
this Graph.true if this Graph contained
the specified Graph.Edge.public boolean containsEdge(Graph.Edge edge)
AbstractGraphedge,
looking for it and returning true if found.containsEdge in interface GraphcontainsEdge in class AbstractGraphedge - the Graph.Edge whose presence in this
Graph is to be tested.true if this Graph contains
the specified Graph.Edge.public void addGraphListener(GraphListener listener)
GraphListener which will be
notified whenever this ObservableGraph's
structure changes. If the wrapped graph does not implement
ObservableGraph, then this method with throw an
UnsupportedOperationException.addGraphListener in interface ObservableGraphpublic void removeGraphListener(GraphListener listener)
GraphListener. If the
wrapped graph does not implement ObservableGraph, then
this method with throw an
UnsupportedOperationException.removeGraphListener in interface ObservableGraphSee the Plexus project home, hosted by SourceForge.
Copyright ? 1994-2006, by Phoenix Software Technologists, Inc. and others. All Rights Reserved. Use is subject to license terms.