uk.ac.bbk.dcs.automed.graph
Class DirectedGraphNode

java.lang.Object
  extended by uk.ac.bbk.dcs.automed.graph.DirectedGraphNode

public class DirectedGraphNode
extends java.lang.Object

Class that abstracts a node in a directed unlabelled graph.

Author:
Lucas Zamboulis

Field Summary
(package private) static int dangling
           
(package private)  java.util.Set incomingEdges
           
(package private) static int intermediate
           
(package private) static int leaf
           
(package private)  java.lang.String nodeName
           
(package private)  java.util.Set outgoingEdges
           
(package private) static int root
           
private  int type
           
private  boolean visited
           
 
Constructor Summary
DirectedGraphNode(java.lang.String name)
           
 
Method Summary
 void addIncomingEdge(DirectedGraphNode n)
          Adds a node in the set of incoming edges of the calling node.
 void addOutgoingEdge(DirectedGraphNode n)
          Adds a node in the set of outgoing edges of the calling node.
protected  java.util.Set getIncomingEdges()
           
protected  java.lang.String getName()
           
protected  java.util.Set getOutgoingEdges()
           
protected  int getType()
           
protected  void unvisit()
          Marks the calling node as unvisited
protected  void visited()
          Marks the calling node as visited.
protected  boolean wasVisited()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

visited

private boolean visited

nodeName

java.lang.String nodeName

incomingEdges

java.util.Set incomingEdges

outgoingEdges

java.util.Set outgoingEdges

type

private int type

root

static final int root
See Also:
Constant Field Values

intermediate

static final int intermediate
See Also:
Constant Field Values

leaf

static final int leaf
See Also:
Constant Field Values

dangling

static final int dangling
See Also:
Constant Field Values
Constructor Detail

DirectedGraphNode

public DirectedGraphNode(java.lang.String name)
Parameters:
name - the name of the node
Method Detail

getName

protected java.lang.String getName()
Returns:
the name of the node

addIncomingEdge

public void addIncomingEdge(DirectedGraphNode n)
                     throws XMLException
Adds a node in the set of incoming edges of the calling node.

Parameters:
n -
Throws:
XMLException

addOutgoingEdge

public void addOutgoingEdge(DirectedGraphNode n)
                     throws XMLException
Adds a node in the set of outgoing edges of the calling node.

Parameters:
n - the node to add
Throws:
XMLException

getType

protected int getType()
Returns:
0 if the node has no incoming edges (root), 1 if the node has both incoming and outgoing edges, 2 if the node has incoming but no outgoing edges (leaf) and 3 if the node has no incoming or outgoing edges (dangling)

wasVisited

protected boolean wasVisited()
Returns:
true if the node was marked as visited

visited

protected void visited()
Marks the calling node as visited.


unvisit

protected void unvisit()
Marks the calling node as unvisited


getIncomingEdges

protected java.util.Set getIncomingEdges()
Returns:
the set of incoming edges

getOutgoingEdges

protected java.util.Set getOutgoingEdges()
Returns:
the set of outgoing edges