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

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

public class CompoundEdgeFactory
extends BaseCompoundEdgeFactory


Constructor Summary
CompoundEdgeFactory(CompoundGraph graph)
           
 
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.
 CompoundGraph getGraph()
          Get the compound graph that owns this factory.
protected  BaseCompoundNode getInNode()
           
protected  BaseCompoundNode getOutNode()
           
 ChildCompoundGraph 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 owningGraph, int nodeIndex, BaseCompoundNode outNode, BaseCompoundNode inNode)
           
 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
 

Constructor Detail

CompoundEdgeFactory

CompoundEdgeFactory(CompoundGraph graph)
Method Detail

newEdge

protected ArchetypalCompoundEdge newEdge(BaseChildCompoundGraph owningGraph,
                                         int nodeIndex,
                                         BaseCompoundNode outNode,
                                         BaseCompoundNode inNode)
Specified by:
newEdge in class BaseCompoundEdgeFactory

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 BaseCompoundEdgeFactory
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 BaseCompoundEdgeFactory
Returns:
the current node pair, or null if no node pair has been set yet.

getGraph

public CompoundGraph 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 BaseCompoundEdgeFactory
Returns:
the graph, which cannot be null.

getInNode

protected BaseCompoundNode getInNode()
Specified by:
getInNode in class BaseCompoundEdgeFactory

getOutNode

protected BaseCompoundNode getOutNode()
Specified by:
getOutNode in class BaseCompoundEdgeFactory

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 BaseCompoundEdgeFactory
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 BaseCompoundEdgeFactory
Returns:
true if this is the case, false otherwise.

getOwningChildGraph

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

Specified by:
getOwningChildGraph in interface ICompoundEdgeFactory<BaseCompoundNode,BaseCompoundEdge>
Overrides:
getOwningChildGraph in class BaseCompoundEdgeFactory
Returns:
The child graph, cannot be null.

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.