|
|||||||||
| Home >> All >> com >> phoenixst >> [ plexus overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.phoenixst.plexus
Class GraphWrapper

java.lang.Objectcom.phoenixst.plexus.GraphWrapper
- All Implemented Interfaces:
- Graph, java.io.Serializable
- Direct Known Subclasses:
- GraphTransformer, GraphUtils.SynchronizedGraphWrapper, GraphUtils.UnmodifiableGraphWrapper, ObservableGraphWrapper
- public class GraphWrapper
- extends java.lang.Object
- implements Graph, java.io.Serializable
- extends java.lang.Object
A Graph which wraps another. This class is intended
to be extended.
- Since:
- 1.0
- Version:
- $Revision: 1.12 $
| Nested Class Summary | |
protected class |
GraphWrapper.EdgeIteratorWrapper
Protected edge iterator implementation. |
protected class |
GraphWrapper.EdgeWrapper
Edge wrapper. |
protected class |
GraphWrapper.NodeIteratorWrapper
Protected node iterator implementation. |
protected class |
GraphWrapper.TraverserWrapper
Protected implementation of Traverser. |
| Nested classes inherited from class com.phoenixst.plexus.Graph |
Graph.Edge |
| Field Summary | |
protected Graph |
g
The wrapped graph. |
| Constructor Summary | |
GraphWrapper(Graph g)
Creates a new GraphWrapper. |
|
| Method Summary | |
Graph.Edge |
addEdge(java.lang.Object object,
java.lang.Object tail,
java.lang.Object head)
Adds the specified edge to the Graph (optional
operation). |
boolean |
addNode(java.lang.Object node)
Adds node to this Graph (optional
operation). |
void |
clear()
Removes all nodes and edges from this Graph
(optional operation). |
boolean |
containsEdge(Graph.Edge edge)
Returns true if this Graph contains
the specified Edge. |
boolean |
containsNode(java.lang.Object node)
Returns true if this Graph contains
the specified node. |
int |
degree(java.lang.Object node)
Returns the degree of node, defined as the number
of edges incident on node, with self-loops
counted twice. |
java.util.Iterator |
edgeIterator()
Returns an Iterator over all the
Edges in this Graph. |
java.util.Iterator |
edgeIterator(java.lang.Object tail,
java.lang.Object head)
Returns an Iterator over all Edges
from this Graph with the specified tail and head. |
int |
edgeSize()
Returns the number of edges in this Graph. |
Graph.Edge |
getEdge(java.lang.Object tail,
java.lang.Object head)
Returns an Edge from this Graph with
the specified tail and head, or null if it does
not exist. |
int |
inDegree(java.lang.Object node)
If this is a directed graph, returns the in degree of node, defined as the number of edges entering
node. |
Traverser |
inTraverser(java.lang.Object node)
If this is a directed graph, returns a Traverser
from node to all adjacent nodes reachable through
edges whose head is the given node. |
boolean |
isDirected()
Returns whether or not this Graph is directed. |
boolean |
isEmpty()
Returns true if this Graph contains
no edges, it may contain nodes. |
boolean |
isSimple()
Returns whether or not this Graph is simple. |
java.util.Iterator |
nodeIterator()
Returns an Iterator over all the nodes in this
Graph. |
int |
nodeSize()
Returns the number of nodes in this Graph. |
int |
outDegree(java.lang.Object node)
If this is a directed graph, returns the out degree of node, defined as the number of edges leaving
node. |
Traverser |
outTraverser(java.lang.Object node)
If this is a directed graph, returns a Traverser
from node to all adjacent nodes reachable through
edges whose tail is the given node. |
boolean |
removeEdge(Graph.Edge edge)
Removes the specified Edge from this
Graph (optional operation). |
boolean |
removeNode(java.lang.Object node)
Removes node from this Graph
(optional operation). |
Traverser |
traverser(java.lang.Object node)
Returns a Traverser from node to all
adjacent nodes. |
protected Graph.Edge |
unwrapEdge(Graph.Edge edge)
Returns an unwrapped Edge, or null if the edge didn't come from this graph. |
protected java.lang.Object |
unwrapEdgeObject(java.lang.Object edgeObject)
Returns an unwrapped edge Object. |
protected java.lang.Object |
unwrapNode(java.lang.Object node)
Returns an unwrapped node. |
protected GraphWrapper.EdgeWrapper |
wrapEdge(Graph.Edge edge)
Returns a wrapped Edge. |
protected java.util.Iterator |
wrapEdgeIterator(java.util.Iterator edgeIter)
Returns a wrapped edge iterator. |
protected java.lang.Object |
wrapEdgeObject(java.lang.Object edgeObject)
Returns a wrapped edge Object. |
protected java.lang.Object |
wrapNode(java.lang.Object node)
Returns a wrapped node. |
protected java.util.Iterator |
wrapNodeIterator(java.util.Iterator nodeIter)
Returns a wrapped node iterator. |
protected Traverser |
wrapTraverser(Traverser traverser)
Returns a wrapped traverser. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
g
protected Graph g
- The wrapped graph.
| Constructor Detail |
GraphWrapper
public GraphWrapper(Graph g)
- Creates a new
GraphWrapper.
| Method Detail |
wrapNode
protected java.lang.Object wrapNode(java.lang.Object node)
- Returns a wrapped node. If the argument node is an
Edgeproduced by the wrapped graph, then it wraps it as anEdge.
unwrapNode
protected java.lang.Object unwrapNode(java.lang.Object node)
- Returns an unwrapped node. If the argument node is an
Edgeproduced by this graph, then it returns the unwrappedEdge.
wrapEdgeObject
protected java.lang.Object wrapEdgeObject(java.lang.Object edgeObject)
- Returns a wrapped edge Object.
unwrapEdgeObject
protected java.lang.Object unwrapEdgeObject(java.lang.Object edgeObject)
- Returns an unwrapped edge Object.
wrapEdge
protected GraphWrapper.EdgeWrapper wrapEdge(Graph.Edge edge)
- Returns a wrapped Edge.
unwrapEdge
protected Graph.Edge unwrapEdge(Graph.Edge edge)
- Returns an unwrapped Edge, or null if the edge didn't come
from this graph.
wrapNodeIterator
protected java.util.Iterator wrapNodeIterator(java.util.Iterator nodeIter)
- Returns a wrapped node iterator.
wrapEdgeIterator
protected java.util.Iterator wrapEdgeIterator(java.util.Iterator edgeIter)
- Returns a wrapped edge iterator.
wrapTraverser
protected Traverser wrapTraverser(Traverser traverser)
- Returns a wrapped traverser.
isDirected
public boolean isDirected()
- Description copied from interface:
Graph - Returns whether or not this
Graphis directed.- Specified by:
isDirectedin interfaceGraph
isSimple
public boolean isSimple()
- Description copied from interface:
Graph - Returns whether or not this
Graphis simple.
isEmpty
public boolean isEmpty()
- Description copied from interface:
Graph - Returns
trueif thisGraphcontains no edges, it may contain nodes.
nodeSize
public int nodeSize()
- Description copied from interface:
Graph - Returns the number of nodes in this
Graph. If thisGraphcontains more thanInteger.MAX_VALUEnodes, returnsInteger.MAX_VALUE.
edgeSize
public int edgeSize()
- Description copied from interface:
Graph - Returns the number of edges in this
Graph. If thisGraphcontains more thanInteger.MAX_VALUEedges, returnsInteger.MAX_VALUE.
degree
public int degree(java.lang.Object node)
- Description copied from interface:
Graph - Returns the degree of
node, defined as the number of edges incident onnode, with self-loops counted twice. If this node has more thanInteger.MAX_VALUEincident edges, returnsInteger.MAX_VALUE.
outDegree
public int outDegree(java.lang.Object node)
- Description copied from interface:
Graph - If this is a directed graph, returns the out degree of
node, defined as the number of edges leavingnode. If this is not a directed graph, throwsUnsupportedOperationException. If this node has more thanInteger.MAX_VALUEedges leaving it, returnsInteger.MAX_VALUE.
inDegree
public int inDegree(java.lang.Object node)
- Description copied from interface:
Graph - If this is a directed graph, returns the in degree of
node, defined as the number of edges enteringnode. If this is not a directed graph, throwsUnsupportedOperationException. If this node has more thanInteger.MAX_VALUEedges entering it, returnsInteger.MAX_VALUE.
addNode
public boolean addNode(java.lang.Object node)
- Description copied from interface:
Graph - Adds
nodeto thisGraph(optional operation). Returnstrueif thisGraphchanged as a result of the call. Returnsfalseif thisGraphalready containsnode.If a
Graphrefuses to add a particular node for any reason other than that it already contains the node, it must throw an exception (rather than returningfalse). This preserves the invariant that aGraphalways contains the specified node after this call returns.Graphclasses should clearly specify in their documentation any other restrictions on what nodes may be added.
removeNode
public boolean removeNode(java.lang.Object node)
- Description copied from interface:
Graph - Removes
nodefrom thisGraph(optional operation). This method will also remove all edges incident uponnode.- Specified by:
removeNodein interfaceGraph
containsNode
public boolean containsNode(java.lang.Object node)
- Description copied from interface:
Graph - Returns
trueif thisGraphcontains the specified node.- Specified by:
containsNodein interfaceGraph
addEdge
public Graph.Edge addEdge(java.lang.Object object, java.lang.Object tail, java.lang.Object head)
- Description copied from interface:
Graph - Adds the specified edge to the
Graph(optional operation). Returns the newly createdEdgeif thisGraphchanged as a result of the call. Returnsnullif thisGraphdoes not allow duplicate edges and already contains the specified edge.If a
Graphrefuses to add a particular edge for any reason other than that it already contains the edge, it must throw an exception (rather than returningnull). This preserves the invariant that aGraphalways contains the specified edge after this call returns.Graphclasses should clearly specify in their documentation any other restrictions on what edges may be added.
removeEdge
public boolean removeEdge(Graph.Edge edge)
- Description copied from interface:
Graph - Removes the specified
Edgefrom thisGraph(optional operation).- Specified by:
removeEdgein interfaceGraph
containsEdge
public boolean containsEdge(Graph.Edge edge)
- Description copied from interface:
Graph - Returns
trueif thisGraphcontains the specifiedEdge.- Specified by:
containsEdgein interfaceGraph
getEdge
public Graph.Edge getEdge(java.lang.Object tail, java.lang.Object head)
- Description copied from interface:
Graph - Returns an
Edgefrom thisGraphwith the specified tail and head, ornullif it does not exist.
clear
public void clear()
- Description copied from interface:
Graph - Removes all nodes and edges from this
Graph(optional operation).
nodeIterator
public java.util.Iterator nodeIterator()
- Description copied from interface:
Graph - Returns an
Iteratorover all the nodes in thisGraph. Calling Iterator.remove()>Iterator.remove()55 removes the last node returned by theIterator, and all edges incident upon that node, from thisGraph. There are no guarantees concerning the order in which the nodes are returned (unless thisGraphis an instance of some class that provides a guarantee).- Specified by:
nodeIteratorin interfaceGraph
edgeIterator
public java.util.Iterator edgeIterator()
- Description copied from interface:
Graph - Returns an
Iteratorover all theEdgesin thisGraph. There are no guarantees concerning the order in which the edges are returned (unless thisGraphis an instance of some class that provides a guarantee).- Specified by:
edgeIteratorin interfaceGraph
edgeIterator
public java.util.Iterator edgeIterator(java.lang.Object tail, java.lang.Object head)
- Description copied from interface:
Graph - Returns an
Iteratorover allEdgesfrom thisGraphwith the specified tail and head.- Specified by:
edgeIteratorin interfaceGraph
traverser
public Traverser traverser(java.lang.Object node)
- Description copied from interface:
Graph - Returns a
Traverserfromnodeto all adjacent nodes. If the implementation is a multigraph, the nodes returned by Iterator.next()>Iterator.next()55 are not necessarily distinct. Self-loops are only traversed once. There are no guarantees concerning the order in which the nodes are returned (unless thisGraphis an instance of some class that provides a guarantee).
outTraverser
public Traverser outTraverser(java.lang.Object node)
- Description copied from interface:
Graph - If this is a directed graph, returns a
Traverserfromnodeto all adjacent nodes reachable through edges whose tail is the given node. If this is not a directed graph, throwsUnsupportedOperationException. If the implementation is a multigraph, the nodes returned by Iterator.next()>Iterator.next()55 are not necessarily distinct. There are no guarantees concerning the order in which the nodes are returned (unless thisGraphis an instance of some class that provides a guarantee).- Specified by:
outTraverserin interfaceGraph
inTraverser
public Traverser inTraverser(java.lang.Object node)
- Description copied from interface:
Graph - If this is a directed graph, returns a
Traverserfromnodeto all adjacent nodes reachable through edges whose head is the given node. If this is not a directed graph, throwsUnsupportedOperationException. If the implementation is a multigraph, the nodes returned by Iterator.next()>Iterator.next()55 are not necessarily distinct. There are no guarantees concerning the order in which the nodes are returned (unless thisGraphis an instance of some class that provides a guarantee).- Specified by:
inTraverserin interfaceGraph
|
|||||||||
| Home >> All >> com >> phoenixst >> [ plexus overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.phoenixst.plexus.GraphWrapper