Package edu.uci.ics.jung.graph.util
Class Graphs
- java.lang.Object
-
- edu.uci.ics.jung.graph.util.Graphs
-
public class Graphs extends java.lang.Object
Provides specialized implementations ofGraphDecorator
. Currently these wrapper types include "synchronized" and "unmodifiable".The methods of this class may each throw a
NullPointerException
if the graphs or class objects provided to them are null.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
Graphs.SynchronizedAbstractGraph<V,E>
(package private) static class
Graphs.SynchronizedDirectedGraph<V,E>
(package private) static class
Graphs.SynchronizedForest<V,E>
(package private) static class
Graphs.SynchronizedGraph<V,E>
(package private) static class
Graphs.SynchronizedTree<V,E>
(package private) static class
Graphs.SynchronizedUndirectedGraph<V,E>
(package private) static class
Graphs.UnmodifiableAbstractGraph<V,E>
(package private) static class
Graphs.UnmodifiableDirectedGraph<V,E>
(package private) static class
Graphs.UnmodifiableForest<V,E>
(package private) static class
Graphs.UnmodifiableGraph<V,E>
(package private) static class
Graphs.UnmodifiableTree<V,E>
(package private) static class
Graphs.UnmodifiableUndirectedGraph<V,E>
-
Constructor Summary
Constructors Constructor Description Graphs()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <V,E>
DirectedGraph<V,E>synchronizedDirectedGraph(DirectedGraph<V,E> graph)
Returns a synchronized DirectedGraph backed by the passed DirectedGraph.static <V,E>
Graphs.SynchronizedForest<V,E>synchronizedForest(Forest<V,E> forest)
Returns a synchronized Forest backed by the passed Forest.static <V,E>
Graph<V,E>synchronizedGraph(Graph<V,E> graph)
Returns a synchronized graph backed by the passed argument graph.static <V,E>
Graphs.SynchronizedTree<V,E>synchronizedTree(Tree<V,E> tree)
Returns a synchronized Tree backed by the passed Tree.static <V,E>
UndirectedGraph<V,E>synchronizedUndirectedGraph(UndirectedGraph<V,E> graph)
Returns a synchronized UndirectedGraph backed by the passed UndirectedGraph.static <V,E>
DirectedGraph<V,E>unmodifiableDirectedGraph(DirectedGraph<V,E> graph)
Returns an unmodifiableDirectedGraph
backed by the passed graph.static <V,E>
Graphs.UnmodifiableForest<V,E>unmodifiableForest(Forest<V,E> forest)
Returns an unmodifiableForest
backed by the passed forest.static <V,E>
Graph<V,E>unmodifiableGraph(Graph<V,E> graph)
Returns an unmodifiable Graph backed by the passed Graph.static <V,E>
Graphs.UnmodifiableTree<V,E>unmodifiableTree(Tree<V,E> tree)
Returns an unmodifiableTree
backed by the passed tree.static <V,E>
UndirectedGraph<V,E>unmodifiableUndirectedGraph(UndirectedGraph<V,E> graph)
Returns an unmodifiableUndirectedGraph
backed by the passed graph.
-
-
-
Method Detail
-
synchronizedGraph
public static <V,E> Graph<V,E> synchronizedGraph(Graph<V,E> graph)
Returns a synchronized graph backed by the passed argument graph.- Type Parameters:
V
- the vertex typeE
- the edge type- Parameters:
graph
- the graph for which a synchronized wrapper is to be created- Returns:
- a synchronized graph backed by the passed argument graph
-
synchronizedDirectedGraph
public static <V,E> DirectedGraph<V,E> synchronizedDirectedGraph(DirectedGraph<V,E> graph)
Returns a synchronized DirectedGraph backed by the passed DirectedGraph.- Type Parameters:
V
- the vertex typeE
- the edge type- Parameters:
graph
- the graph for which a synchronized wrapper is to be created- Returns:
- a synchronized DirectedGraph backed by the passed DirectedGraph
-
synchronizedUndirectedGraph
public static <V,E> UndirectedGraph<V,E> synchronizedUndirectedGraph(UndirectedGraph<V,E> graph)
Returns a synchronized UndirectedGraph backed by the passed UndirectedGraph.- Type Parameters:
V
- the vertex typeE
- the edge type- Parameters:
graph
- the graph for which a synchronized wrapper is to be created- Returns:
- a synchronized UndirectedGraph backed by the passed UndirectedGraph
-
synchronizedForest
public static <V,E> Graphs.SynchronizedForest<V,E> synchronizedForest(Forest<V,E> forest)
Returns a synchronized Forest backed by the passed Forest.- Type Parameters:
V
- the vertex typeE
- the edge type- Parameters:
forest
- the forest for which a synchronized wrapper is to be created- Returns:
- a synchronized Forest backed by the passed Forest
-
synchronizedTree
public static <V,E> Graphs.SynchronizedTree<V,E> synchronizedTree(Tree<V,E> tree)
Returns a synchronized Tree backed by the passed Tree.- Type Parameters:
V
- the vertex typeE
- the edge type- Parameters:
tree
- the tree for which a synchronized wrapper is to be created- Returns:
- a synchronized Tree backed by the passed Tree
-
unmodifiableGraph
public static <V,E> Graph<V,E> unmodifiableGraph(Graph<V,E> graph)
Returns an unmodifiable Graph backed by the passed Graph.- Type Parameters:
V
- the vertex typeE
- the edge type- Parameters:
graph
- the graph for which the unmodifiable wrapper is to be returned- Returns:
- an unmodifiable Graph backed by the passed Graph
-
unmodifiableDirectedGraph
public static <V,E> DirectedGraph<V,E> unmodifiableDirectedGraph(DirectedGraph<V,E> graph)
Returns an unmodifiableDirectedGraph
backed by the passed graph.- Type Parameters:
V
- the vertex typeE
- the edge type- Parameters:
graph
- the graph for which the unmodifiable wrapper is to be returned- Returns:
- an unmodifiable
DirectedGraph
backed by the passed graph
-
unmodifiableUndirectedGraph
public static <V,E> UndirectedGraph<V,E> unmodifiableUndirectedGraph(UndirectedGraph<V,E> graph)
Returns an unmodifiableUndirectedGraph
backed by the passed graph.- Type Parameters:
V
- the vertex typeE
- the edge type- Parameters:
graph
- the graph for which the unmodifiable wrapper is to be returned- Returns:
- an unmodifiable
UndirectedGraph
backed by the passed graph
-
unmodifiableTree
public static <V,E> Graphs.UnmodifiableTree<V,E> unmodifiableTree(Tree<V,E> tree)
Returns an unmodifiableTree
backed by the passed tree.- Type Parameters:
V
- the vertex typeE
- the edge type- Parameters:
tree
- the tree for which the unmodifiable wrapper is to be returned- Returns:
- an unmodifiable
Tree
backed by the passed tree
-
unmodifiableForest
public static <V,E> Graphs.UnmodifiableForest<V,E> unmodifiableForest(Forest<V,E> forest)
Returns an unmodifiableForest
backed by the passed forest.- Type Parameters:
V
- the vertex typeE
- the edge type- Parameters:
forest
- the forest for which the unmodifiable wrapper is to be returned- Returns:
- an unmodifiable
Forest
backed by the passed forest
-
-