uk.ed.inf.graph.compound.base
Class BaseSubCompoundGraph

java.lang.Object
  extended by uk.ed.inf.graph.compound.base.BaseSubCompoundGraph
All Implemented Interfaces:
IBasicGraph<BaseCompoundNode,BaseCompoundEdge>, IBasicSubgraph<BaseCompoundNode,BaseCompoundEdge>, ISubCompoundGraph<BaseCompoundNode,BaseCompoundEdge>, IDirectedGraph<BaseCompoundNode,BaseCompoundEdge>, IDirectedSubgraph<BaseCompoundNode,BaseCompoundEdge>
Direct Known Subclasses:
SubCompoundGraph

public abstract class BaseSubCompoundGraph
extends java.lang.Object
implements ISubCompoundGraph<BaseCompoundNode,BaseCompoundEdge>


Constructor Summary
protected BaseSubCompoundGraph()
           
 
Method Summary
(package private)  void addEdge(BaseCompoundEdge newEdge)
           
(package private)  void addTopNode(BaseCompoundNode newNode)
           
(package private)  void buildComplete()
           
 boolean containsConnection(BaseCompoundNode thisNode, BaseCompoundNode thatNode)
          Tests if the graph contains an edge connecting these nodes.
 boolean containsConnection(IBasicPair<? extends BaseCompoundNode,? extends BaseCompoundEdge> ends)
          Tests if the ends define any edge in this graph.
 boolean containsDirectedEdge(BaseCompoundNode outNode, BaseCompoundNode inNode)
          Tests if there is one or more directed edges from the outNode to the inNode.
 boolean containsDirectedEdge(IDirectedPair<? extends BaseCompoundNode,? extends BaseCompoundEdge> ends)
          Tests if the ends define one or more directed edges.
 boolean containsEdge(BaseCompoundEdge edge)
          Tests if the graph contains the edge.
 boolean containsEdge(int edgeIdx)
          Tests if the graph contains the edge of the given index.
 boolean containsNode(BaseCompoundNode node)
          Tests if this node exists in the graph.
 boolean containsNode(int nodeIdx)
          Tests if the graph contains the node with the given index number.
 boolean containsRoot()
          Checks if this SubGraph contains the RootNode of the CompoundGraph.
protected  void createEdgeSet(IDirectedEdgeSet<BaseCompoundNode,BaseCompoundEdge> edgeSet)
           
protected  void createNodeSet(INodeSet<BaseCompoundNode,BaseCompoundEdge> nodeSet)
           
 java.util.Iterator<BaseCompoundEdge> edgeIterator()
          Get an iterator that traverses all the edges in this graph.
 BaseCompoundEdge getEdge(int edgeIdx)
          Get the edge with this index.
 BaseCompoundNode getNode(int nodeIdx)
          Get the node matching the nodeIdx.
 int getNumEdges()
          Get the number of edges in the graph.
 int getNumNodes()
          Get the number of nodes in the graph.
 int getNumTopNodes()
           
abstract  BaseCompoundGraph getSuperGraph()
           
 boolean isConsistentSnapShot()
           
 boolean isInducedSubgraph()
           
 java.util.Iterator<BaseCompoundNode> nodeIterator()
          Get an iterator that traverses all the nodes in this graph.
 java.util.Iterator<BaseCompoundNode> topNodeIterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseSubCompoundGraph

protected BaseSubCompoundGraph()
Method Detail

createNodeSet

protected final void createNodeSet(INodeSet<BaseCompoundNode,BaseCompoundEdge> nodeSet)

createEdgeSet

protected final void createEdgeSet(IDirectedEdgeSet<BaseCompoundNode,BaseCompoundEdge> edgeSet)

getSuperGraph

public abstract BaseCompoundGraph getSuperGraph()
Specified by:
getSuperGraph in interface IBasicSubgraph<BaseCompoundNode,BaseCompoundEdge>
Specified by:
getSuperGraph in interface ISubCompoundGraph<BaseCompoundNode,BaseCompoundEdge>

isInducedSubgraph

public boolean isInducedSubgraph()
Specified by:
isInducedSubgraph in interface IBasicSubgraph<BaseCompoundNode,BaseCompoundEdge>

containsConnection

public boolean containsConnection(BaseCompoundNode thisNode,
                                  BaseCompoundNode thatNode)
Description copied from interface: IBasicGraph
Tests if the graph contains an edge connecting these nodes. Ignores the direction of the edge.

Specified by:
containsConnection in interface IBasicGraph<BaseCompoundNode,BaseCompoundEdge>
Parameters:
thisNode - a node to test.
thatNode - the other node to test.
Returns:
true if the edge exists, false otherwise.

containsEdge

public boolean containsEdge(BaseCompoundEdge edge)
Description copied from interface: IBasicGraph
Tests if the graph contains the edge.

Specified by:
containsEdge in interface IBasicGraph<BaseCompoundNode,BaseCompoundEdge>
Parameters:
edge - the edge to test.
Returns:
true if the edge exists in the graph, false otherwise.

containsEdge

public boolean containsEdge(int edgeIdx)
Description copied from interface: IBasicGraph
Tests if the graph contains the edge of the given index.

Specified by:
containsEdge in interface IBasicGraph<BaseCompoundNode,BaseCompoundEdge>
Parameters:
edgeIdx - the index to test.
Returns:
true if matching edge can be found, false otherwise.

containsNode

public boolean containsNode(int nodeIdx)
Description copied from interface: IBasicGraph
Tests if the graph contains the node with the given index number.

Specified by:
containsNode in interface IBasicGraph<BaseCompoundNode,BaseCompoundEdge>
Parameters:
nodeIdx - The index number of the node.
Returns:
True if the graph contains the node, false otherwise.

containsNode

public boolean containsNode(BaseCompoundNode node)
Description copied from interface: IBasicGraph
Tests if this node exists in the graph.

Specified by:
containsNode in interface IBasicGraph<BaseCompoundNode,BaseCompoundEdge>
Parameters:
node - to be tested.
Returns:
True if the graph contains the node, false otherwise.

getEdge

public BaseCompoundEdge getEdge(int edgeIdx)
Description copied from interface: IBasicGraph
Get the edge with this index.

Specified by:
getEdge in interface IBasicGraph<BaseCompoundNode,BaseCompoundEdge>
Specified by:
getEdge in interface ISubCompoundGraph<BaseCompoundNode,BaseCompoundEdge>
Parameters:
edgeIdx - The index of the edge.
Returns:
The edge matching the index.

edgeIterator

public java.util.Iterator<BaseCompoundEdge> edgeIterator()
Description copied from interface: IBasicGraph
Get an iterator that traverses all the edges in this graph. No traversal order is guaranteed.

Specified by:
edgeIterator in interface IBasicGraph<BaseCompoundNode,BaseCompoundEdge>
Returns:
The edge iterator, guaranteed to be non-null.

getNode

public BaseCompoundNode getNode(int nodeIdx)
Description copied from interface: IBasicGraph
Get the node matching the nodeIdx.

Specified by:
getNode in interface IBasicGraph<BaseCompoundNode,BaseCompoundEdge>
Specified by:
getNode in interface ISubCompoundGraph<BaseCompoundNode,BaseCompoundEdge>
Parameters:
nodeIdx - the node index to lookup.
Returns:
the node matching the index. Cannot be null.

nodeIterator

public java.util.Iterator<BaseCompoundNode> nodeIterator()
Description copied from interface: IBasicGraph
Get an iterator that traverses all the nodes in this graph. The traversal order is not guaranteed, but all nodes will be traversed.

Specified by:
nodeIterator in interface IBasicGraph<BaseCompoundNode,BaseCompoundEdge>
Returns:
The node iterator, guaranteed to be non-null.

getNumEdges

public int getNumEdges()
Description copied from interface: IBasicGraph
Get the number of edges in the graph.

Specified by:
getNumEdges in interface IBasicGraph<BaseCompoundNode,BaseCompoundEdge>
Returns:
The number of edges.

getNumNodes

public int getNumNodes()
Description copied from interface: IBasicGraph
Get the number of nodes in the graph.

Specified by:
getNumNodes in interface IBasicGraph<BaseCompoundNode,BaseCompoundEdge>
Returns:
The number of nodes.

addTopNode

void addTopNode(BaseCompoundNode newNode)

addEdge

void addEdge(BaseCompoundEdge newEdge)

buildComplete

void buildComplete()

containsDirectedEdge

public boolean containsDirectedEdge(BaseCompoundNode outNode,
                                    BaseCompoundNode inNode)
Description copied from interface: IDirectedGraph
Tests if there is one or more directed edges from the outNode to the inNode.

Specified by:
containsDirectedEdge in interface IDirectedGraph<BaseCompoundNode,BaseCompoundEdge>
Parameters:
outNode - the node the edge comes out from, can be null.
inNode - the node the edge goes into, can be null.
Returns:
true if there is such and edge, false otherwise.

isConsistentSnapShot

public boolean isConsistentSnapShot()
Specified by:
isConsistentSnapShot in interface IBasicSubgraph<BaseCompoundNode,BaseCompoundEdge>

containsDirectedEdge

public boolean containsDirectedEdge(IDirectedPair<? extends BaseCompoundNode,? extends BaseCompoundEdge> ends)
Tests if the ends define one or more directed edges.

Specified by:
containsDirectedEdge in interface IDirectedGraph<BaseCompoundNode,BaseCompoundEdge>
Parameters:
ends - the pair of nodes to be tested, can be null.
Returns:
true if there is at least one edge between then, false otherwise.

containsConnection

public boolean containsConnection(IBasicPair<? extends BaseCompoundNode,? extends BaseCompoundEdge> ends)
Tests if the ends define any edge in this graph. Note that the node pair must be created by this graph as the method expects ends to be of type IDirectedPair and will return false if it is not.

Specified by:
containsConnection in interface IBasicGraph<BaseCompoundNode,BaseCompoundEdge>
Parameters:
ends - the pair of nodes that may define the edges of an edge.
Returns:
true if it does, false otherwise.

topNodeIterator

public java.util.Iterator<BaseCompoundNode> topNodeIterator()
Specified by:
topNodeIterator in interface ISubCompoundGraph<BaseCompoundNode,BaseCompoundEdge>

getNumTopNodes

public int getNumTopNodes()
Specified by:
getNumTopNodes in interface ISubCompoundGraph<BaseCompoundNode,BaseCompoundEdge>

containsRoot

public boolean containsRoot()
Checks if this SubGraph contains the RootNode of the CompoundGraph.

Specified by:
containsRoot in interface ISubCompoundGraph<BaseCompoundNode,BaseCompoundEdge>
Returns:
true if the rootNode is contained in this SubGraph.