com.phoenixst.plexus

Class FilteredGraph

public class FilteredGraph extends AbstractGraph implements ObservableGraph

A filtered 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.

Since: 1.0

Version: $Revision: 1.44 $

Author: Ray A. Conner

Constructor Summary
FilteredGraph(Graph delegate, Predicate nodePredicate, Predicate edgePredicate)
Creates a new FilteredGraph.
protected FilteredGraph()
This constructor, together with FilteredGraph, allows a subclass to initialize the internal state during deserialization.
Method Summary
Graph.EdgeaddEdge(Object object, Object tail, Object head, boolean isDirected)
voidaddGraphListener(GraphListener listener)
Adds the specified GraphListener which will be notified whenever this ObservableGraph's structure changes.
booleanaddNode(Object node)
booleancontainsEdge(Graph.Edge edge)
booleancontainsNode(Object node)
protected Collectionedges()
protected GraphgetDelegate()
Provides accesss to the internal state so it can be manually serialized by a subclass's writeObject() method.
protected PredicategetEdgePredicate()
Provides accesss to the internal state so it can be manually serialized by a subclass's writeObject() method.
protected PredicategetNodePredicate()
Provides accesss to the internal state so it can be manually serialized by a subclass's writeObject() method.
protected voidinitialize(Graph delegateGraph, Predicate nodePred, Predicate edgePred)
This method should only be called by subclasses during deserialization.
protected Collectionnodes()
booleanremoveEdge(Graph.Edge edge)
voidremoveGraphListener(GraphListener listener)
Removes a previously added GraphListener.
booleanremoveNode(Object node)
protected Traversertraverser(Object node)

Constructor Detail

FilteredGraph

public FilteredGraph(Graph delegate, Predicate nodePredicate, Predicate edgePredicate)
Creates a new FilteredGraph.

FilteredGraph

protected FilteredGraph()
This constructor, together with FilteredGraph, allows a subclass to initialize the internal state during deserialization.

Method Detail

addEdge

public Graph.Edge addEdge(Object object, Object tail, Object head, boolean isDirected)

addGraphListener

public void addGraphListener(GraphListener listener)
Adds the specified 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.

addNode

public boolean addNode(Object node)

containsEdge

public boolean containsEdge(Graph.Edge edge)

containsNode

public boolean containsNode(Object node)

edges

protected Collection edges()

getDelegate

protected final Graph getDelegate()
Provides accesss to the internal state so it can be manually serialized by a subclass's writeObject() method.

getEdgePredicate

protected final Predicate getEdgePredicate()
Provides accesss to the internal state so it can be manually serialized by a subclass's writeObject() method.

getNodePredicate

protected final Predicate getNodePredicate()
Provides accesss to the internal state so it can be manually serialized by a subclass's writeObject() method.

initialize

protected final void initialize(Graph delegateGraph, Predicate nodePred, Predicate edgePred)
This method should only be called by subclasses during deserialization.

nodes

protected Collection nodes()

removeEdge

public boolean removeEdge(Graph.Edge edge)

removeGraphListener

public void removeGraphListener(GraphListener listener)
Removes a previously added GraphListener. If the wrapped graph does not implement ObservableGraph, then this method with throw an UnsupportedOperationException.

removeNode

public boolean removeNode(Object node)

traverser

protected Traverser traverser(Object node)
See the Plexus project home, hosted by SourceForge.
Copyright B) 1994-2006, by Phoenix Software Technologists, Inc. and others. All Rights Reserved. Use is subject to license terms.