uk.ed.inf.graph.compound.impl
Class ChildCompoundEdgeFactory

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

public class ChildCompoundEdgeFactory
extends BaseChildCompoundEdgeFactory


Constructor Summary
ChildCompoundEdgeFactory(CompoundNode parentNode)
           
 
Method Summary
 boolean canCreateEdge()
          Tests if the edge can be created based on the node pair.
 CompoundEdge createEdge()
          Creates a new directed edge from outNode to inNode which is owned by the childCompoundGraph returned by getOwningChildGraph().
 CompoundNodePair getCurrentNodePair()
          Gets the current node pair.
 BaseCompoundGraph getGraph()
          Get the compound graph that owns this factory.
protected  CompoundNode getInNode()
           
protected  CompoundNode getOutNode()
           
 BaseChildCompoundGraph getOwningChildGraph()
          The child graph that will contain any edges created by this factory.
 boolean isValidNodePair(BaseCompoundNode outNode, BaseCompoundNode inNode)
          Test if the node pair is valid.
protected  ArchetypalCompoundEdge newEdge(BaseChildCompoundGraph owningChildGraph, int edgeIndex, BaseCompoundNode outNode, BaseCompoundNode inNode)
           
 void setPair(BaseCompoundNode outNode, BaseCompoundNode inNode)
          Sets the nodes to be used to create the edge.
 
Methods inherited from class uk.ed.inf.graph.compound.base.BaseChildCompoundEdgeFactory
isValidBaseNodePair
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChildCompoundEdgeFactory

public ChildCompoundEdgeFactory(CompoundNode parentNode)
Method Detail

newEdge

protected ArchetypalCompoundEdge newEdge(BaseChildCompoundGraph owningChildGraph,
                                         int edgeIndex,
                                         BaseCompoundNode outNode,
                                         BaseCompoundNode inNode)
Specified by:
newEdge in class BaseChildCompoundEdgeFactory

createEdge

public CompoundEdge 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>
Overrides:
createEdge in class BaseChildCompoundEdgeFactory
Returns:
The newly created edge.

getCurrentNodePair

public CompoundNodePair 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>
Specified by:
getCurrentNodePair in class BaseChildCompoundEdgeFactory
Returns:
the current node pair, or null if no node pair has been set yet.

getGraph

public 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>
Specified by:
getGraph in class BaseChildCompoundEdgeFactory
Returns:
the graph, which cannot be null.

getInNode

protected CompoundNode getInNode()
Specified by:
getInNode in class BaseChildCompoundEdgeFactory

getOutNode

protected CompoundNode getOutNode()
Specified by:
getOutNode in class BaseChildCompoundEdgeFactory

getOwningChildGraph

public 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>
Specified by:
getOwningChildGraph in class BaseChildCompoundEdgeFactory
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.

setPair

public 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>
Specified by:
setPair in class BaseChildCompoundEdgeFactory
Parameters:
outNode - outNode, cannot be null.
inNode - inNode, cannot be null.

canCreateEdge

public 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>
Specified by:
canCreateEdge in class BaseChildCompoundEdgeFactory
Returns:
true if this is the case, false otherwise.

isValidNodePair

public boolean isValidNodePair(BaseCompoundNode outNode,
                               BaseCompoundNode inNode)
Description copied from interface: IBasicEdgeFactory
Test if the node pair is valid. Tests include, does the node pair belong to the same graph as that return by getGraph(), do both nodes belong to the same graph and are both nodes not null.

Parameters:
outNode - a node that may be the end of an edge.
inNode - another node that may be the end of an edge.
Returns:
true if the above conditions are met, false otherwise.