Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.phoenixst.plexus
Class GraphUtils  view GraphUtils download GraphUtils.java

java.lang.Object
  extended bycom.phoenixst.plexus.GraphUtils

public class GraphUtils
extends java.lang.Object

This class contains static final members and static methods related to graphs and their iterators.

Since:
1.0
Version:
$Revision: 1.25 $

Nested Class Summary
private static interface GraphUtils.SerializableTraverser
           
private static interface GraphUtils.SerializableTraverserFactory
           
private static class GraphUtils.SingletonEdgeIterator
           
private static class GraphUtils.SingletonTraverser
           
private static class GraphUtils.SynchronizedGraphWrapper
           
private static class GraphUtils.SynchronizedObservableGraphWrapper
           
private static class GraphUtils.UnmodifiableGraphWrapper
           
private static class GraphUtils.UnmodifiableObservableGraphWrapper
           
 
Field Summary
static TraverserFactory ADJACENT_TRAVERSER_FACTORY
          A TraverserFactory which creates adjacent node traversers.
static Traverser EMPTY_TRAVERSER
          An empty Traverser.
static TraverserFactory IN_TRAVERSER_FACTORY
          A TraverserFactory which creates in node traversers for directed graphs.
static TraverserFactory OUT_TRAVERSER_FACTORY
          A TraverserFactory which creates out node traversers for directed graphs.
 
Constructor Summary
private GraphUtils()
          Prevent instantiation.
 
Method Summary
static void add(Graph destination, Graph source)
          Adds all the nodes and edges from source to destination.
static java.util.Iterator singletonEdgeIterator(Graph graph, Graph.Edge edge)
          Returns a modifiable, serializable Iterator over the specified edge.
static Traverser singletonTraverser(Graph graph, Graph.Edge edge, java.lang.Object endpoint)
          Returns a modifiable, serializable Traverser over the specified edge.
static Graph synchronizedGraph(Graph g)
          Returns a synchronized view of the specified Graph.
static Graph synchronizedGraph(Graph g, java.lang.Object mutex)
          Returns a synchronized view of the specified Graph and synchronized upon the specified object.
static ObservableGraph synchronizedObservableGraph(ObservableGraph g)
          Returns a synchronized view of the specified ObservableGraph.
static ObservableGraph synchronizedObservableGraph(ObservableGraph g, java.lang.Object mutex)
          Returns a synchronized view of the specified ObservableGraph and synchronized upon the specified object.
static Graph unmodifiableGraph(Graph g)
          Returns an unmodifiable view of the specified Graph.
static ObservableGraph unmodifiableObservableGraph(ObservableGraph g)
          Returns an unmodifiable view of the specified ObservableGraph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_TRAVERSER

public static final Traverser EMPTY_TRAVERSER
An empty Traverser.


ADJACENT_TRAVERSER_FACTORY

public static final TraverserFactory ADJACENT_TRAVERSER_FACTORY
A TraverserFactory which creates adjacent node traversers.

See Also:
Graph.traverser( node ) 55

OUT_TRAVERSER_FACTORY

public static final TraverserFactory OUT_TRAVERSER_FACTORY
A TraverserFactory which creates out node traversers for directed graphs.

See Also:
Graph.outTraverser( node ) 55

IN_TRAVERSER_FACTORY

public static final TraverserFactory IN_TRAVERSER_FACTORY
A TraverserFactory which creates in node traversers for directed graphs.

See Also:
Graph.inTraverser( node ) 55
Constructor Detail

GraphUtils

private GraphUtils()
Prevent instantiation.

Method Detail

add

public static void add(Graph destination,
                       Graph source)
Adds all the nodes and edges from source to destination. If the two Graphs do not match in what sort of Graph they are (one directed and the other undirected, e.g.), then a best effort is still made.


singletonEdgeIterator

public static java.util.Iterator singletonEdgeIterator(Graph graph,
                                                       Graph.Edge edge)
Returns a modifiable, serializable Iterator over the specified edge.


singletonTraverser

public static Traverser singletonTraverser(Graph graph,
                                           Graph.Edge edge,
                                           java.lang.Object endpoint)
Returns a modifiable, serializable Traverser over the specified edge.


unmodifiableGraph

public static Graph unmodifiableGraph(Graph g)
Returns an unmodifiable view of the specified Graph. The returned Graph will be serializable if the specified Graph is serializable.


unmodifiableObservableGraph

public static ObservableGraph unmodifiableObservableGraph(ObservableGraph g)
Returns an unmodifiable view of the specified ObservableGraph. The returned ObservableGraph will be serializable if the specified ObservableGraph is serializable. This wrapper method allows a Graph to be given to a user that the user can't modify, but that can still be watched for changes.


synchronizedGraph

public static Graph synchronizedGraph(Graph g)
Returns a synchronized view of the specified Graph. It is the user's responsibility to manually synchronize on the returned Graph when iterating over it. The returned Graph will be serializable if the specified Graph is serializable.


synchronizedGraph

public static Graph synchronizedGraph(Graph g,
                                      java.lang.Object mutex)
Returns 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. The returned Graph will be serializable if the specified Graph is serializable.


synchronizedObservableGraph

public static ObservableGraph synchronizedObservableGraph(ObservableGraph g)
Returns a synchronized view of the specified ObservableGraph. It is the user's responsibility to manually synchronize on the returned ObservableGraph when iterating over it. The returned ObservableGraph will be serializable if the specified ObservableGraph is serializable.


synchronizedObservableGraph

public static ObservableGraph synchronizedObservableGraph(ObservableGraph g,
                                                          java.lang.Object mutex)
Returns a synchronized view of the specified ObservableGraph and synchronized upon the specified object. It is the user's responsibility to manually synchronize on mutex when iterating over the ObservableGraph. The returned ObservableGraph will be serializable if the specified ObservableGraph is serializable.