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

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

public abstract class BaseGraphCopyBuilder
extends java.lang.Object
implements ICompoundGraphCopyBuilder<BaseCompoundNode,BaseCompoundEdge>


Constructor Summary
BaseGraphCopyBuilder()
           
 
Method Summary
protected abstract  void additionalCopyTasks()
          Provide a hook for super classes to perform additional operations after this class has completed copying the compound graph.
protected abstract  void additionalInitialisation()
          Provides a hook for super classes to initialise its data-structures before copying begins, but after this classes copy data-structures have been initialised.
protected abstract  BaseCompoundEdge createCopyOfEdge(BaseCompoundEdge srcEdge, BaseChildCompoundGraph edgeOwner, BaseCompoundNode outNode, BaseCompoundNode inNode)
          Create a new edge that us a copy of another, which may be in a different graph this this one.
protected abstract  BaseCompoundNode createCopyOfNode(BaseCompoundNode srcNode, BaseCompoundNode destParentNode)
          Create a compound node.
 BaseSubCompoundGraph getCopiedComponents()
          Gets the copied nodes and edges that were created in the destination graph as a subgraph of the destination graph.
protected  BaseCompoundNode getCopiedNode(BaseCompoundNode originalNode)
          Gets the equivalent copied node to the specified node, if it exists.
 BaseChildCompoundGraph getDestinationChildGraph()
           
 BaseSubCompoundGraph getSourceSubgraph()
           
 void makeCopy()
          Make a copy of subgraph into the destination graph
 void setDestinatChildCompoundGraph(IChildCompoundGraph<? extends BaseCompoundNode,? extends BaseCompoundEdge> childCompoundGraph)
          Sets the child compound graph that is to be copied to.
 void setSourceSubgraph(ISubCompoundGraph<? extends BaseCompoundNode,? extends BaseCompoundEdge> sourceSubCompoundGraph)
          Sets the subgraph which is to be copied.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseGraphCopyBuilder

public BaseGraphCopyBuilder()
Method Detail

setSourceSubgraph

public void setSourceSubgraph(ISubCompoundGraph<? extends BaseCompoundNode,? extends BaseCompoundEdge> sourceSubCompoundGraph)
Description copied from interface: ICompoundGraphCopyBuilder
Sets the subgraph which is to be copied.

Specified by:
setSourceSubgraph in interface ICompoundGraphCopyBuilder<BaseCompoundNode,BaseCompoundEdge>
Parameters:
sourceSubCompoundGraph - source subgraph to be copied
Throws:
java.lang.IllegalArgumentException - if sourceSubCompoundGraph is not of type BaseSubCompoundGraph.
See Also:
uk.ed.inf.graph.compound.base.ICompoundGraphCopyBuilder#setSourceSubgraph(uk.ed.inf.graph.compound.ISubCompoundGraph)

setDestinatChildCompoundGraph

public void setDestinatChildCompoundGraph(IChildCompoundGraph<? extends BaseCompoundNode,? extends BaseCompoundEdge> childCompoundGraph)
Description copied from interface: ICompoundGraphCopyBuilder
Sets the child compound graph that is to be copied to.

Specified by:
setDestinatChildCompoundGraph in interface ICompoundGraphCopyBuilder<BaseCompoundNode,BaseCompoundEdge>
Parameters:
sourceSubCompoundGraph - target child graph to be copied to
Throws:
java.lang.IllegalArgumentException - if childCompoundGraph is not of type BaseChildCompoundGraph.
See Also:
uk.ed.inf.graph.compound.base.ICompoundGraphCopyBuilder#setDestinatChildCompoundGraph(uk.ed.inf.graph.compound.base.BaseChildCompoundGraph)

getCopiedNode

protected final BaseCompoundNode getCopiedNode(BaseCompoundNode originalNode)
Gets the equivalent copied node to the specified node, if it exists.

Parameters:
originalNode - the original node that we want to get the copy of.
Returns:
the copied node, or null if none exists.

makeCopy

public void makeCopy()
Description copied from interface: ICompoundGraphCopyBuilder
Make a copy of subgraph into the destination graph

Specified by:
makeCopy in interface ICompoundGraphCopyBuilder<BaseCompoundNode,BaseCompoundEdge>

additionalInitialisation

protected abstract void additionalInitialisation()
Provides a hook for super classes to initialise its data-structures before copying begins, but after this classes copy data-structures have been initialised.


additionalCopyTasks

protected abstract void additionalCopyTasks()
Provide a hook for super classes to perform additional operations after this class has completed copying the compound graph.


getSourceSubgraph

public final BaseSubCompoundGraph getSourceSubgraph()
Specified by:
getSourceSubgraph in interface ICompoundGraphCopyBuilder<BaseCompoundNode,BaseCompoundEdge>

getDestinationChildGraph

public final BaseChildCompoundGraph getDestinationChildGraph()
Specified by:
getDestinationChildGraph in interface ICompoundGraphCopyBuilder<BaseCompoundNode,BaseCompoundEdge>

createCopyOfNode

protected abstract BaseCompoundNode createCopyOfNode(BaseCompoundNode srcNode,
                                                     BaseCompoundNode destParentNode)
Create a compound node. This node MUST be added to the child graph of the destParentNode.

Parameters:
srcNode -
destParentNode -
newNodeIndex -
Returns:

createCopyOfEdge

protected abstract BaseCompoundEdge createCopyOfEdge(BaseCompoundEdge srcEdge,
                                                     BaseChildCompoundGraph edgeOwner,
                                                     BaseCompoundNode outNode,
                                                     BaseCompoundNode inNode)
Create a new edge that us a copy of another, which may be in a different graph this this one. This edge MUST be added to the destination child graph.

Parameters:
srcEdge - The edge to copy.
edgeOwner - The compound node that will "own" this edge.
newEdgeIndex - The index to use for the newly created edge.
Returns:
The newly created edge.

getCopiedComponents

public BaseSubCompoundGraph getCopiedComponents()
Description copied from interface: ICompoundGraphCopyBuilder
Gets the copied nodes and edges that were created in the destination graph as a subgraph of the destination graph.

Specified by:
getCopiedComponents in interface ICompoundGraphCopyBuilder<BaseCompoundNode,BaseCompoundEdge>
Returns:
The subgraph of copied nodes, which will be empty of no nodes are copied.