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

Quick Search    Search Deep

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

java.lang.Object
  extended bycom.phoenixst.plexus.GraphWrapper
      extended bycom.phoenixst.plexus.GraphUtils.SynchronizedGraphWrapper
All Implemented Interfaces:
Graph, java.io.Serializable
Direct Known Subclasses:
GraphUtils.SynchronizedObservableGraphWrapper
Enclosing class:
GraphUtils

private static class GraphUtils.SynchronizedGraphWrapper
extends GraphWrapper


Nested Class Summary
private  class GraphUtils.SynchronizedGraphWrapper.SynchronizedEdgeWrapper
           
private  class GraphUtils.SynchronizedGraphWrapper.SynchronizedIteratorWrapper
           
private  class GraphUtils.SynchronizedGraphWrapper.SynchronizedTraverserWrapper
           
 
Nested classes inherited from class com.phoenixst.plexus.GraphWrapper
GraphWrapper.EdgeIteratorWrapper, GraphWrapper.EdgeWrapper, GraphWrapper.NodeIteratorWrapper, GraphWrapper.TraverserWrapper
 
Nested classes inherited from class com.phoenixst.plexus.Graph
Graph.Edge
 
Field Summary
protected  java.lang.Object mutex
           
 
Fields inherited from class com.phoenixst.plexus.GraphWrapper
g
 
Constructor Summary
private GraphUtils.SynchronizedGraphWrapper(Graph g)
           
private GraphUtils.SynchronizedGraphWrapper(Graph g, java.lang.Object mutex)
           
 
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  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.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 com.phoenixst.plexus.GraphWrapper
unwrapEdge, unwrapEdgeObject, unwrapNode, wrapEdgeObject, wrapNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mutex

protected java.lang.Object mutex
Constructor Detail

GraphUtils.SynchronizedGraphWrapper

private GraphUtils.SynchronizedGraphWrapper(Graph g)

GraphUtils.SynchronizedGraphWrapper

private GraphUtils.SynchronizedGraphWrapper(Graph g,
                                            java.lang.Object mutex)
Method Detail

wrapEdge

protected GraphWrapper.EdgeWrapper wrapEdge(Graph.Edge edge)
Description copied from class: GraphWrapper
Returns a wrapped Edge.

Overrides:
wrapEdge in class GraphWrapper

wrapNodeIterator

protected java.util.Iterator wrapNodeIterator(java.util.Iterator nodeIter)
Description copied from class: GraphWrapper
Returns a wrapped node iterator.

Overrides:
wrapNodeIterator in class GraphWrapper

wrapEdgeIterator

protected java.util.Iterator wrapEdgeIterator(java.util.Iterator edgeIter)
Description copied from class: GraphWrapper
Returns a wrapped edge iterator.

Overrides:
wrapEdgeIterator in class GraphWrapper

wrapTraverser

protected Traverser wrapTraverser(Traverser traverser)
Description copied from class: GraphWrapper
Returns a wrapped traverser.

Overrides:
wrapTraverser in class GraphWrapper

isDirected

public boolean isDirected()
Description copied from interface: Graph
Returns whether or not this Graph is directed.

Specified by:
isDirected in interface Graph
Overrides:
isDirected in class GraphWrapper

isSimple

public boolean isSimple()
Description copied from interface: Graph
Returns whether or not this Graph is simple.

Specified by:
isSimple in interface Graph
Overrides:
isSimple in class GraphWrapper

isEmpty

public boolean isEmpty()
Description copied from interface: Graph
Returns true if this Graph contains no edges, it may contain nodes.

Specified by:
isEmpty in interface Graph
Overrides:
isEmpty in class GraphWrapper

nodeSize

public int nodeSize()
Description copied from interface: Graph
Returns the number of nodes in this Graph. If this Graph contains more than Integer.MAX_VALUE nodes, returns Integer.MAX_VALUE.

Specified by:
nodeSize in interface Graph
Overrides:
nodeSize in class GraphWrapper

edgeSize

public int edgeSize()
Description copied from interface: Graph
Returns the number of edges in this Graph. If this Graph contains more than Integer.MAX_VALUE edges, returns Integer.MAX_VALUE.

Specified by:
edgeSize in interface Graph
Overrides:
edgeSize in class GraphWrapper

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 on node, with self-loops counted twice. If this node has more than Integer.MAX_VALUE incident edges, returns Integer.MAX_VALUE.

Specified by:
degree in interface Graph
Overrides:
degree in class GraphWrapper

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 leaving node. If this is not a directed graph, throws UnsupportedOperationException. If this node has more than Integer.MAX_VALUE edges leaving it, returns Integer.MAX_VALUE.

Specified by:
outDegree in interface Graph
Overrides:
outDegree in class GraphWrapper

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 entering node. If this is not a directed graph, throws UnsupportedOperationException. If this node has more than Integer.MAX_VALUE edges entering it, returns Integer.MAX_VALUE.

Specified by:
inDegree in interface Graph
Overrides:
inDegree in class GraphWrapper

addNode

public boolean addNode(java.lang.Object node)
Description copied from interface: Graph
Adds node to this Graph (optional operation). Returns true if this Graph changed as a result of the call. Returns false if this Graph already contains node.

If a Graph refuses to add a particular node for any reason other than that it already contains the node, it must throw an exception (rather than returning false). This preserves the invariant that a Graph always contains the specified node after this call returns. Graph classes should clearly specify in their documentation any other restrictions on what nodes may be added.

Specified by:
addNode in interface Graph
Overrides:
addNode in class GraphWrapper

removeNode

public boolean removeNode(java.lang.Object node)
Description copied from interface: Graph
Removes node from this Graph (optional operation). This method will also remove all edges incident upon node.

Specified by:
removeNode in interface Graph
Overrides:
removeNode in class GraphWrapper

containsNode

public boolean containsNode(java.lang.Object node)
Description copied from interface: Graph
Returns true if this Graph contains the specified node.

Specified by:
containsNode in interface Graph
Overrides:
containsNode in class GraphWrapper

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 created Edge if this Graph changed as a result of the call. Returns null if this Graph does not allow duplicate edges and already contains the specified edge.

If a Graph refuses to add a particular edge for any reason other than that it already contains the edge, it must throw an exception (rather than returning null). This preserves the invariant that a Graph always contains the specified edge after this call returns. Graph classes should clearly specify in their documentation any other restrictions on what edges may be added.

Specified by:
addEdge in interface Graph
Overrides:
addEdge in class GraphWrapper

removeEdge

public boolean removeEdge(Graph.Edge edge)
Description copied from interface: Graph
Removes the specified Edge from this Graph (optional operation).

Specified by:
removeEdge in interface Graph
Overrides:
removeEdge in class GraphWrapper

containsEdge

public boolean containsEdge(Graph.Edge edge)
Description copied from interface: Graph
Returns true if this Graph contains the specified Edge.

Specified by:
containsEdge in interface Graph
Overrides:
containsEdge in class GraphWrapper

getEdge

public Graph.Edge getEdge(java.lang.Object tail,
                          java.lang.Object head)
Description copied from interface: Graph
Returns an Edge from this Graph with the specified tail and head, or null if it does not exist.

Specified by:
getEdge in interface Graph
Overrides:
getEdge in class GraphWrapper

clear

public void clear()
Description copied from interface: Graph
Removes all nodes and edges from this Graph (optional operation).

Specified by:
clear in interface Graph
Overrides:
clear in class GraphWrapper

nodeIterator

public java.util.Iterator nodeIterator()
Description copied from interface: Graph
Returns an Iterator over all the nodes in this Graph. Calling Iterator.remove()>Iterator.remove() 55 removes the last node returned by the Iterator, and all edges incident upon that node, from this Graph. There are no guarantees concerning the order in which the nodes are returned (unless this Graph is an instance of some class that provides a guarantee).

Specified by:
nodeIterator in interface Graph
Overrides:
nodeIterator in class GraphWrapper

edgeIterator

public java.util.Iterator edgeIterator()
Description copied from interface: Graph
Returns an Iterator over all the Edges in this Graph. There are no guarantees concerning the order in which the edges are returned (unless this Graph is an instance of some class that provides a guarantee).

Specified by:
edgeIterator in interface Graph
Overrides:
edgeIterator in class GraphWrapper

edgeIterator

public java.util.Iterator edgeIterator(java.lang.Object tail,
                                       java.lang.Object head)
Description copied from interface: Graph
Returns an Iterator over all Edges from this Graph with the specified tail and head.

Specified by:
edgeIterator in interface Graph
Overrides:
edgeIterator in class GraphWrapper

traverser

public Traverser traverser(java.lang.Object node)
Description copied from interface: Graph
Returns a Traverser from node to 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 this Graph is an instance of some class that provides a guarantee).

Specified by:
traverser in interface Graph
Overrides:
traverser in class GraphWrapper

outTraverser

public Traverser outTraverser(java.lang.Object node)
Description copied from interface: Graph
If this is a directed graph, returns a Traverser from node to all adjacent nodes reachable through edges whose tail is the given node. If this is not a directed graph, throws UnsupportedOperationException. 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 this Graph is an instance of some class that provides a guarantee).

Specified by:
outTraverser in interface Graph
Overrides:
outTraverser in class GraphWrapper

inTraverser

public Traverser inTraverser(java.lang.Object node)
Description copied from interface: Graph
If this is a directed graph, returns a Traverser from node to all adjacent nodes reachable through edges whose head is the given node. If this is not a directed graph, throws UnsupportedOperationException. 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 this Graph is an instance of some class that provides a guarantee).

Specified by:
inTraverser in interface Graph
Overrides:
inTraverser in class GraphWrapper