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

java.lang.Object
  extended by uk.ed.inf.graph.compound.base.BaseCompoundEdge
All Implemented Interfaces:
java.lang.Comparable<BaseCompoundEdge>, IBasicEdge<BaseCompoundNode,BaseCompoundEdge>, ICompoundEdge<BaseCompoundNode,BaseCompoundEdge>, IDirectedEdge<BaseCompoundNode,BaseCompoundEdge>, IRestorableGraphElement
Direct Known Subclasses:
ArchetypalCompoundEdge

public abstract class BaseCompoundEdge
extends java.lang.Object
implements ICompoundEdge<BaseCompoundNode,BaseCompoundEdge>, IRestorableGraphElement


Constructor Summary
protected BaseCompoundEdge()
           
 
Method Summary
protected  void changeInEdge()
          Ensures that edge is added to In Node
protected  void changeOutNode()
          Ensures that edge is added to Out Node
 int compareTo(BaseCompoundEdge o)
           
 IDirectedPair<BaseCompoundNode,BaseCompoundEdge> getConnectedNodes()
          Get the ends of
abstract  BaseCompoundGraph getGraph()
          Get the owning graph of this edge.
abstract  int getIndex()
          Get the index that uniquely identifies the edge within its owning graph.
protected abstract  BaseCompoundNode getInNode()
           
protected abstract  BaseCompoundNode getOutNode()
           
abstract  BaseChildCompoundGraph getOwningChildGraph()
           
 boolean hasDirectedEnds(IDirectedPair<? super BaseCompoundNode,? super BaseCompoundEdge> ends)
          Tests if this directed edge has these ends.
 boolean hasEnds(IBasicPair<? super BaseCompoundNode,? super BaseCompoundEdge> ends)
          Tests if this edge has these ends.
abstract  boolean isRemoved()
          Test if the edge has been removed from the graph.
 boolean isSelfEdge()
          Is this a self edge, i.e.
 void markRemoved(boolean removed)
          Used to reset the removal status of a graph edge or node.
protected abstract  void removalAction(boolean removed)
          additional actions to be executed upon this node being marked as removed.
protected abstract  void setRemoved(boolean removed)
          This should be used to set the removal status variable only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseCompoundEdge

protected BaseCompoundEdge()
Method Detail

getInNode

protected abstract BaseCompoundNode getInNode()

changeInEdge

protected final void changeInEdge()
Ensures that edge is added to In Node

Throws:
java.lang.IllegalStateException - if getInNode() == null

getOutNode

protected abstract BaseCompoundNode getOutNode()

setRemoved

protected abstract void setRemoved(boolean removed)
This should be used to set the removal status variable only. No other actions# should be performed here. To perform an action on removal then use removalAction(boolean).

Parameters:
removed - the removal status: true means the edge is removed.

changeOutNode

protected final void changeOutNode()
Ensures that edge is added to Out Node

Throws:
java.lang.IllegalStateException - if getOutNode() == null

getConnectedNodes

public final IDirectedPair<BaseCompoundNode,BaseCompoundEdge> getConnectedNodes()
Description copied from interface: IBasicEdge
Get the ends of

Specified by:
getConnectedNodes in interface IBasicEdge<BaseCompoundNode,BaseCompoundEdge>
Specified by:
getConnectedNodes in interface IDirectedEdge<BaseCompoundNode,BaseCompoundEdge>
Returns:

getOwningChildGraph

public abstract BaseChildCompoundGraph getOwningChildGraph()
Specified by:
getOwningChildGraph in interface ICompoundEdge<BaseCompoundNode,BaseCompoundEdge>

getGraph

public abstract BaseCompoundGraph getGraph()
Description copied from interface: IBasicEdge
Get the owning graph of this edge.

Specified by:
getGraph in interface IBasicEdge<BaseCompoundNode,BaseCompoundEdge>
Specified by:
getGraph in interface ICompoundEdge<BaseCompoundNode,BaseCompoundEdge>
Returns:
the owning graph.

getIndex

public abstract int getIndex()
Description copied from interface: IBasicEdge
Get the index that uniquely identifies the edge within its owning graph.

Specified by:
getIndex in interface IBasicEdge<BaseCompoundNode,BaseCompoundEdge>
Returns:
The index, which is a While number (>-0).

compareTo

public final int compareTo(BaseCompoundEdge o)
Specified by:
compareTo in interface java.lang.Comparable<BaseCompoundEdge>

isRemoved

public abstract boolean isRemoved()
Description copied from interface: IBasicEdge
Test if the edge has been removed from the graph.

Specified by:
isRemoved in interface IBasicEdge<BaseCompoundNode,BaseCompoundEdge>
Returns:
true if removed, false otherwise.

markRemoved

public final void markRemoved(boolean removed)
Description copied from interface: IRestorableGraphElement
Used to reset the removal status of a graph edge or node.

Specified by:
markRemoved in interface IRestorableGraphElement

removalAction

protected abstract void removalAction(boolean removed)
additional actions to be executed upon this node being marked as removed.


hasEnds

public final boolean hasEnds(IBasicPair<? super BaseCompoundNode,? super BaseCompoundEdge> ends)
Description copied from interface: IBasicEdge
Tests if this edge has these ends. Ignores the directions of the ends.

Specified by:
hasEnds in interface IBasicEdge<BaseCompoundNode,BaseCompoundEdge>
Parameters:
ends - The ends to be tested.
Returns:
true if the edge contains the ends, false otherwise.

hasDirectedEnds

public final boolean hasDirectedEnds(IDirectedPair<? super BaseCompoundNode,? super BaseCompoundEdge> ends)
Description copied from interface: IDirectedEdge
Tests if this directed edge has these ends. Ignores the directions of the ends.

Specified by:
hasDirectedEnds in interface IDirectedEdge<BaseCompoundNode,BaseCompoundEdge>
Parameters:
ends - The ends to be tested.
Returns:
true if the edge contains the ends, false otherwise.

isSelfEdge

public final boolean isSelfEdge()
Description copied from interface: IBasicEdge
Is this a self edge, i.e. both ends are the same node.

Specified by:
isSelfEdge in interface IBasicEdge<BaseCompoundNode,BaseCompoundEdge>
Returns:
true if removed.