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

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

public abstract class BaseGraphMoveBuilder
extends java.lang.Object
implements ICompoundGraphMoveBuilder<BaseCompoundNode,BaseCompoundEdge>


Constructor Summary
BaseGraphMoveBuilder()
           
 
Method Summary
protected abstract  void additionalInitialisation()
          Provides a hook for super classes to initialise its data-structures before copying begins, but after this classes move data-structures have been initialised.
protected abstract  void additionalMoveTasks()
          Provide a hook for super classes to perform additional operations after this class has completed moving the compound graph.
protected abstract  BaseCompoundEdge createMoveOfEdge(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 createMoveOfNode(BaseCompoundNode srcNode, BaseCompoundNode destParentNode)
          Create a compound node.
 BaseChildCompoundGraph getDestinationChildGraph()
           
 BaseSubCompoundGraph getMovedComponents()
          Gets the moved nodes and edges that were created in the destination graph as a subgraph of the destination graph.
 BaseSubCompoundGraph getSourceSubgraph()
           
 void makeMove()
          Make a move of subgraph into the destination graph
 void setDestinatChildCompoundGraph(IChildCompoundGraph<? extends BaseCompoundNode,? extends BaseCompoundEdge> childCompoundGraph)
          Sets the child compound graph that is to be moved to.
 void setSourceSubgraph(ISubCompoundGraph<? extends BaseCompoundNode,? extends BaseCompoundEdge> sourceSubCompoundGraph)
          Sets the subgraph which is to be moved.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseGraphMoveBuilder

public BaseGraphMoveBuilder()
Method Detail

setSourceSubgraph

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

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

setDestinatChildCompoundGraph

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

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

makeMove

public void makeMove()
Description copied from interface: ICompoundGraphMoveBuilder
Make a move of subgraph into the destination graph

Specified by:
makeMove in interface ICompoundGraphMoveBuilder<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 move data-structures have been initialised.


additionalMoveTasks

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


getSourceSubgraph

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

getDestinationChildGraph

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

createMoveOfNode

protected abstract BaseCompoundNode createMoveOfNode(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:

createMoveOfEdge

protected abstract BaseCompoundEdge createMoveOfEdge(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.

getMovedComponents

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

Specified by:
getMovedComponents in interface ICompoundGraphMoveBuilder<BaseCompoundNode,BaseCompoundEdge>
Returns:
The subgraph of moved nodes, which will be empty of no nodes are moved.