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

java.lang.Object
  extended by uk.ed.inf.graph.compound.base.BaseSubCompoundGraphBuilder
All Implemented Interfaces:
ISubCompoundGraphBuilder<BaseCompoundNode,BaseCompoundEdge>
Direct Known Subclasses:
SubCompoundGraphBuilder

public abstract class BaseSubCompoundGraphBuilder
extends java.lang.Object
implements ISubCompoundGraphBuilder<BaseCompoundNode,BaseCompoundEdge>


Constructor Summary
protected BaseSubCompoundGraphBuilder()
          Construct the builder, providing it with a list of nodes and edges with which to populate the subgraph that will be constructed.
 
Method Summary
protected abstract  void addAdditionalEdges()
           
protected abstract  void addAdditionalNodes()
           
 void addIncidentEdges()
          Add the incident edges between the nodes already added to the subgraph.
 void buildSubgraph()
          Build the new subgraph, based on the previous processing of the initial nodes and edges.
 void expandChildNodes()
          Expand the nodes provided to the builder so that all the contents of their compound graphs are included in the new subgraph.
protected  java.util.Set<BaseCompoundEdge> getEdgeList()
           
abstract  BaseCompoundGraph getGraph()
           
protected  java.util.Set<BaseCompoundNode> getNodeList()
           
abstract  BaseSubCompoundGraph getSubgraph()
          Retrieve the created subgraph.
 boolean hasAdditionalNodes()
           
protected abstract  void newSubgraph()
           
 void setEdgeList(java.util.Set<? extends BaseCompoundEdge> edgeList)
           
 void setNodeList(java.util.Set<? extends BaseCompoundNode> nodeList)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseSubCompoundGraphBuilder

protected BaseSubCompoundGraphBuilder()
Construct the builder, providing it with a list of nodes and edges with which to populate the subgraph that will be constructed.

Parameters:
graph - the graph to which the subgraph will refer, cannot be null.
nodeList - the list of nodes to be added to the subgraph, cannot be null.
edgeList - the list of edges to be added to the subgraph, cannot be null.
Throws:
java.lang.NullPointerException - if any of the the parameters are null.
Method Detail

setNodeList

public void setNodeList(java.util.Set<? extends BaseCompoundNode> nodeList)
Specified by:
setNodeList in interface ISubCompoundGraphBuilder<BaseCompoundNode,BaseCompoundEdge>

setEdgeList

public void setEdgeList(java.util.Set<? extends BaseCompoundEdge> edgeList)
Specified by:
setEdgeList in interface ISubCompoundGraphBuilder<BaseCompoundNode,BaseCompoundEdge>

getNodeList

protected java.util.Set<BaseCompoundNode> getNodeList()

getEdgeList

protected java.util.Set<BaseCompoundEdge> getEdgeList()

expandChildNodes

public void expandChildNodes()
Expand the nodes provided to the builder so that all the contents of their compound graphs are included in the new subgraph. This is done recursively so that the branches from each of the original nodes are fully expanded. Nodes that are already children are merged into their respective branches.

Specified by:
expandChildNodes in interface ISubCompoundGraphBuilder<BaseCompoundNode,BaseCompoundEdge>

addIncidentEdges

public void addIncidentEdges()
Add the incident edges between the nodes already added to the subgraph. This is required to produce an induced subgraph.

Specified by:
addIncidentEdges in interface ISubCompoundGraphBuilder<BaseCompoundNode,BaseCompoundEdge>

addAdditionalNodes

protected abstract void addAdditionalNodes()

addAdditionalEdges

protected abstract void addAdditionalEdges()

buildSubgraph

public void buildSubgraph()
Build the new subgraph, based on the previous processing of the initial nodes and edges.

Specified by:
buildSubgraph in interface ISubCompoundGraphBuilder<BaseCompoundNode,BaseCompoundEdge>

newSubgraph

protected abstract void newSubgraph()

getSubgraph

public abstract BaseSubCompoundGraph getSubgraph()
Retrieve the created subgraph. If the subgraph has not been build then this method will fail.

Specified by:
getSubgraph in interface ISubCompoundGraphBuilder<BaseCompoundNode,BaseCompoundEdge>
Returns:
The created subgraph, cannot be null.
Throws:
java.lang.IllegalStateException - if the subgraph has not been created by a call to buildSubgraph.

getGraph

public abstract BaseCompoundGraph getGraph()
Specified by:
getGraph in interface ISubCompoundGraphBuilder<BaseCompoundNode,BaseCompoundEdge>

hasAdditionalNodes

public boolean hasAdditionalNodes()