com.phoenixst.plexus
public class GraphUtils extends Object
Since: 1.0
Version: $Revision: 1.78 $
Field Summary | |
---|---|
static int | ANY_DIRECTION_MASK |
static Predicate | DIRECTED_EDGE_PREDICATE
An Graph.Edge predicate which is
true when directed. |
static int | DIRECTED_IN_MASK |
static int | DIRECTED_MASK |
static int | DIRECTED_OUT_MASK |
static Predicate | DIRECTED_TRAVERSER_PREDICATE
A Traverser predicate which is true when
the edge is directed. |
static Traverser | EMPTY_TRAVERSER
An empty Traverser . |
static Predicate | IN_TRAVERSER_PREDICATE
A Traverser predicate which is true
when the edge is directed in. |
static ObservableGraph | NULL_GRAPH
An immutable, ObservableGraph with no nodes or edges. |
static Predicate | OUT_TRAVERSER_PREDICATE
A Traverser predicate which is true
when the edge is directed out. |
static Predicate | SELF_EDGE_PREDICATE
An Graph.Edge predicate which is
true when the edge is a self-loop. |
static Predicate | SELF_TRAVERSER_PREDICATE
A Traverser predicate which is true
when the edge is a self-loop. |
static Predicate | UNDIRECTED_EDGE_PREDICATE
An Graph.Edge predicate which is
true when undirected. |
static int | UNDIRECTED_MASK |
static Predicate | UNDIRECTED_TRAVERSER_PREDICATE
A Traverser predicate which is true
when the edge is undirected. |
Method Summary | |
---|---|
static void | add(Graph destination, Graph source)
Adds all the nodes and edges from source to
destination . |
static String | directionFlagsToString(int directionFlags)
Returns a String representation of the specified direction flags.
|
static boolean | equals(Object a, Object b)
Tests two objects for being .equals() , handling
null appropriately. |
static Object | getFirstCommonNode(Transformer incidentEdgeGetter, Object a, Object b)
Helper method primarily for OrientedForest
implementations. |
static Object | getLeastCommonAncestor(OrientedForest forest, Object a, Object b)
Helper method for OrientedForest implementations. |
static CharSequence | getTextValue(Graph.Edge edge, boolean includeUserObject)
Returns a CharSequence representing the specified edge. |
static int | invertDirection(int directionFlags)
Returns the inverse of the specified direction flags. |
static Iterator | singletonEdgeIterator(Graph graph, Graph.Edge edge)
Returns a modifiable Iterator over the specified
edge.
|
static Graph | singletonGraph(Object node)
Returns an unmodifiable, serializable Graph with
the single specified node and no edges.
|
static Traverser | singletonTraverser(Graph graph, Object endpoint, Graph.Edge edge)
Returns a modifiable Traverser over the specified
edge.
|
static ObservableGraph | synchronizedGraph(Graph graph)
Returns a synchronized view of the specified
Graph . |
static ObservableGraph | unmodifiableGraph(Graph graph)
Returns an unmodifiable view of the specified
Graph . |
static Iterator | unmodifiableIterator(Iterator iterator)
Returns an unmodifiable view of the specified
Iterator .
|
static Traverser | unmodifiableTraverser(Traverser traverser)
Returns an unmodifiable view of the specified
Traverser .
|
Graph.Edge
predicate which is
true
when directed.Traverser
predicate which is true
when
the edge is directed.Traverser
.Traverser
predicate which is true
when the edge is directed in.ObservableGraph
with no nodes or edges.Traverser
predicate which is true
when the edge is directed out.Graph.Edge
predicate which is
true
when the edge is a self-loop.Traverser
predicate which is true
when the edge is a self-loop.Graph.Edge
predicate which is
true
when undirected.Traverser
predicate which is true
when the edge is undirected.source
to
destination
. If the two Graphs
are
incompatible in some way (nodes and/or edges from from the
source graph not allowed in the destination), then a best
effort is still made."none"
"any"
"-"
">"
"<"
"< >"
"- >"
"< -"
.equals()
, handling
null
appropriately.OrientedForest
implementations. This method will repeatedly apply the
Transformer
to each node argument until
it returns null
, so the traversal should
terminate.OrientedForest
implementations.Iterator
over the specified
edge.
Parameters: graph the graph containing the edge over which the
returned Iterator
iterates.
edge the edge over which the returned
Iterator
iterates.
Returns: a modifiable Iterator
over the specified
edge.
Graph
with
the single specified node and no edges.
Parameters: node the node which the returned Graph
is
to contain.
Returns: an unmodifiable, serializable Graph
with
the single specified node and no edges.
Traverser
over the specified
edge.
Parameters: graph the graph containing the edge over which the
returned Traverser
iterates.
endpoint the endpoint of the edge over which the
returned Traverser
iterates.
edge the edge over which the returned
Traverser
iterates.
Returns: a modifiable Traverser
over the specified
edge.
Graph
. It is the user's responsibility to
manually synchronize on the returned Graph
when
iterating over it. If the specified Graph
does
not implement ObservableGraph, then ObservableGraph and ObservableGraph with throw
UnsupportedOperationExceptions
. The returned
Graph
will be serializable if the specified
Graph
is serializable.
Parameters: graph the Graph
for which a synchronized
view is to be returned.
Returns: a synchronized view of the specified
Graph
.
Graph
. If the specified Graph
does
not implement ObservableGraph, then ObservableGraph and ObservableGraph with throw
UnsupportedOperationExceptions
. The returned
Graph
will be serializable if the specified
Graph
is serializable.
Parameters: graph the Graph
for which an unmodifiable
view is to be returned.
Returns: an unmodifiable view of the specified
Graph
.
Iterator
.
Parameters: iterator the Iterator
for which an
unmodifiable view is to be returned.
Returns: an unmodifiable view of the specified
Iterator
.
Traverser
.
Parameters: traverser the Traverser
for which an
unmodifiable view is to be returned.
Returns: an unmodifiable view of the specified
Traverser
.