com.phoenixst.plexus.util

Class SynchronizedGraph

public class SynchronizedGraph extends Object implements ObservableGraph, Serializable

A synchronized view of a Graph. It is the user's responsibility to manually synchronize when iterating over the Graph. This Graph will be serializable if the delegate Graph is serializable. Note that the Edge objects are not wrapped, and are therefore not synchronized. As with synchronized collections, iterators are also not synchronized.

Since: 1.0

Version: $Revision: 1.5 $

Author: Ray A. Conner

Constructor Summary
SynchronizedGraph(Graph delegate)
Creates a synchronized view of the specified Graph.
SynchronizedGraph(Graph delegate, Object mutex)
Creates a synchronized view of the specified Graph and synchronized upon the specified object.
Method Summary
Graph.EdgeaddEdge(Object object, Object tail, Object head, boolean isDirected)
voidaddGraphListener(GraphListener listener)
booleanaddNode(Object node)
CollectionadjacentNodes(Object node, Predicate traverserPredicate)
booleancontainsEdge(Graph.Edge edge)
booleancontainsNode(Object node)
intdegree(Object node)
intdegree(Object node, Predicate traverserPredicate)
Collectionedges(Predicate edgePredicate)
ObjectgetAdjacentNode(Object node, Predicate traverserPredicate)
Graph.EdgegetEdge(Predicate edgePredicate)
Graph.EdgegetIncidentEdge(Object node, Predicate traverserPredicate)
ObjectgetNode(Predicate nodePredicate)
CollectionincidentEdges(Object node, Predicate traverserPredicate)
Collectionnodes(Predicate nodePredicate)
booleanremoveEdge(Graph.Edge edge)
voidremoveGraphListener(GraphListener listener)
booleanremoveNode(Object node)
StringtoString()
Traversertraverser(Object node, Predicate traverserPredicate)

Constructor Detail

SynchronizedGraph

public SynchronizedGraph(Graph delegate)
Creates a synchronized view of the specified Graph. It is the user's responsibility to manually synchronize on the created Graph when iterating over it. This Graph will be serializable if the specified Graph is serializable.

Parameters: delegate the Graph for which a synchronized view is to be created.

SynchronizedGraph

public SynchronizedGraph(Graph delegate, Object mutex)
Creates a synchronized view of the specified Graph and synchronized upon the specified object. It is the user's responsibility to manually synchronize on mutex when iterating over the Graph. This Graph will be serializable if the specified Graph is serializable.

Parameters: delegate the Graph for which a synchronized view is to be created. mutex the object upon which to synchronize access.

Method Detail

addEdge

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

addGraphListener

public void addGraphListener(GraphListener listener)

addNode

public boolean addNode(Object node)

adjacentNodes

public Collection adjacentNodes(Object node, Predicate traverserPredicate)

containsEdge

public boolean containsEdge(Graph.Edge edge)

containsNode

public boolean containsNode(Object node)

degree

public int degree(Object node)

degree

public int degree(Object node, Predicate traverserPredicate)

edges

public Collection edges(Predicate edgePredicate)

getAdjacentNode

public Object getAdjacentNode(Object node, Predicate traverserPredicate)

getEdge

public Graph.Edge getEdge(Predicate edgePredicate)

getIncidentEdge

public Graph.Edge getIncidentEdge(Object node, Predicate traverserPredicate)

getNode

public Object getNode(Predicate nodePredicate)

incidentEdges

public Collection incidentEdges(Object node, Predicate traverserPredicate)

nodes

public Collection nodes(Predicate nodePredicate)

removeEdge

public boolean removeEdge(Graph.Edge edge)

removeGraphListener

public void removeGraphListener(GraphListener listener)

removeNode

public boolean removeNode(Object node)

toString

public String toString()

traverser

public Traverser traverser(Object node, Predicate traverserPredicate)
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.