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

java.lang.Object
  extended by uk.ed.inf.graph.compound.base.BaseChildCompoundEdgeFactory
All Implemented Interfaces:
IBasicEdgeFactory<BaseCompoundNode,BaseCompoundEdge>, ICompoundChildEdgeFactory<BaseCompoundNode,BaseCompoundEdge>, ICompoundEdgeFactory<BaseCompoundNode,BaseCompoundEdge>, IDirectedEdgeFactory<BaseCompoundNode,BaseCompoundEdge>
Direct Known Subclasses:
ChildCompoundEdgeFactory

public abstract class BaseChildCompoundEdgeFactory
extends java.lang.Object
implements ICompoundChildEdgeFactory<BaseCompoundNode,BaseCompoundEdge>


Constructor Summary
BaseChildCompoundEdgeFactory()
           
 
Method Summary
abstract  boolean canCreateEdge()
          Tests if the edge can be created based on the node pair.
 BaseCompoundEdge createEdge()
          Creates a new directed edge from outNode to inNode which is owned by the childCompoundGraph returned by getOwningChildGraph().
abstract  BaseCompoundNodePair getCurrentNodePair()
          Gets the current node pair.
abstract  BaseCompoundGraph getGraph()
          Get the compound graph that owns this factory.
protected abstract  BaseCompoundNode getInNode()
           
protected abstract  BaseCompoundNode getOutNode()
           
abstract  BaseChildCompoundGraph getOwningChildGraph()
          The child graph that will contain any edges created by this factory.
protected  boolean isValidBaseNodePair(BaseCompoundNode outNode, BaseCompoundNode inNode)
          Methods implementing the isValidNodePair() should call this method in addition to carrying out it's own checks.
protected abstract  BaseCompoundEdge newEdge(BaseChildCompoundGraph owningChildGraph, int edgeIndex, BaseCompoundNode outNode, BaseCompoundNode inNode)
           
abstract  void setPair(BaseCompoundNode outNode, BaseCompoundNode inNode)
          Sets the nodes to be used to create the edge.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uk.ed.inf.graph.basic.IBasicEdgeFactory
isValidNodePair
 

Constructor Detail

BaseChildCompoundEdgeFactory

public BaseChildCompoundEdgeFactory()
Method Detail

getOwningChildGraph

public abstract BaseChildCompoundGraph getOwningChildGraph()
Description copied from interface: ICompoundEdgeFactory
The child graph that will contain any edges created by this factory.

Specified by:
getOwningChildGraph in interface ICompoundChildEdgeFactory<BaseCompoundNode,BaseCompoundEdge>
Specified by:
getOwningChildGraph in interface ICompoundEdgeFactory<BaseCompoundNode,BaseCompoundEdge>
Returns:
the owning child graph of the new edge.
See Also:
for definition. Not that this implementation will always return the child graph regardless of whether the node pair is set.

isValidBaseNodePair

protected final boolean isValidBaseNodePair(BaseCompoundNode outNode,
                                            BaseCompoundNode inNode)
Methods implementing the isValidNodePair() should call this method in addition to carrying out it's own checks.

Parameters:
outNode -
inNode -
Returns:

setPair

public abstract void setPair(BaseCompoundNode outNode,
                             BaseCompoundNode inNode)
Description copied from interface: IDirectedEdgeFactory
Sets the nodes to be used to create the edge.

Specified by:
setPair in interface IBasicEdgeFactory<BaseCompoundNode,BaseCompoundEdge>
Specified by:
setPair in interface IDirectedEdgeFactory<BaseCompoundNode,BaseCompoundEdge>
Parameters:
outNode - outNode, cannot be null.
inNode - inNode, cannot be null.

getOutNode

protected abstract BaseCompoundNode getOutNode()

getInNode

protected abstract BaseCompoundNode getInNode()

getCurrentNodePair

public abstract BaseCompoundNodePair getCurrentNodePair()
Description copied from interface: IDirectedEdgeFactory
Gets the current node pair.

Specified by:
getCurrentNodePair in interface IBasicEdgeFactory<BaseCompoundNode,BaseCompoundEdge>
Specified by:
getCurrentNodePair in interface IDirectedEdgeFactory<BaseCompoundNode,BaseCompoundEdge>
Returns:
the current node pair, or null if no node pair has been set yet.

createEdge

public BaseCompoundEdge createEdge()
Description copied from interface: ICompoundEdgeFactory
Creates a new directed edge from outNode to inNode which is owned by the childCompoundGraph returned by getOwningChildGraph().

Specified by:
createEdge in interface IBasicEdgeFactory<BaseCompoundNode,BaseCompoundEdge>
Specified by:
createEdge in interface ICompoundEdgeFactory<BaseCompoundNode,BaseCompoundEdge>
Returns:
The newly created edge.

newEdge

protected abstract BaseCompoundEdge newEdge(BaseChildCompoundGraph owningChildGraph,
                                            int edgeIndex,
                                            BaseCompoundNode outNode,
                                            BaseCompoundNode inNode)

getGraph

public abstract BaseCompoundGraph getGraph()
Description copied from interface: ICompoundEdgeFactory
Get the compound graph that owns this factory.

Specified by:
getGraph in interface IBasicEdgeFactory<BaseCompoundNode,BaseCompoundEdge>
Specified by:
getGraph in interface ICompoundEdgeFactory<BaseCompoundNode,BaseCompoundEdge>
Returns:
the graph, which cannot be null.

canCreateEdge

public abstract boolean canCreateEdge()
Description copied from interface: ICompoundEdgeFactory
Tests if the edge can be created based on the node pair.

Specified by:
canCreateEdge in interface IBasicEdgeFactory<BaseCompoundNode,BaseCompoundEdge>
Specified by:
canCreateEdge in interface ICompoundEdgeFactory<BaseCompoundNode,BaseCompoundEdge>
Returns:
true if this is the case, false otherwise.