org.globus.cog.util.graph
Class Node

java.lang.Object
  extended byorg.globus.cog.util.graph.Node

public class Node
extends Object

A generic node object that contains lists for edges connected to it and wraps an object


Constructor Summary
Node()
          Creates a new node object
Node(Object contents)
          Creates a new node object storing contents in it
 
Method Summary
 void addInEdge(Edge edge)
          Add an in-edge to this node
 void addOutEdge(Edge edge)
          Adds an out-edge to this node
 int degree()
          Determines the total number of edges connected to this node
 Object getContents()
          Gets the contents of the node
 List getInEdges()
           
 EdgeIterator getInEdgesIterator()
          Returns an iterator with the in-edges of this node It is advisable for multi-threaded applications to synchronize on this Node object when using the Iterator
 List getOutEdges()
           
 EdgeIterator getOutEdgesIterator()
          Returns an iterator with the out-edges of this node It is advisable for multi-threaded applications to synchronize on this Node object when using the Iterator
 int inDegree()
          Determines the number of in-edges for this node
 int outDegree()
          Determines the number of out-edges for this node
 void removeEdge(Edge edge)
          Removes an edge regardless of its orientation
 void removeInEdge(Edge edge)
          Removes an in-edge
 void removeOutEdge(Edge edge)
          Removes an out-edge
 void setContents(Object contents)
          Stores an object to this node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Node

public Node()
Creates a new node object


Node

public Node(Object contents)
Creates a new node object storing contents in it

Parameters:
contents -
Method Detail

getContents

public Object getContents()
Gets the contents of the node

Returns:
the object stored in this node or null

setContents

public void setContents(Object contents)
Stores an object to this node

Parameters:
contents - the object to be added

addInEdge

public void addInEdge(Edge edge)
Add an in-edge to this node

Parameters:
edge - The feature to be added to the InEdge attribute

addOutEdge

public void addOutEdge(Edge edge)
Adds an out-edge to this node

Parameters:
edge - The feature to be added to the OutEdge attribute

removeInEdge

public void removeInEdge(Edge edge)
                  throws EdgeNotFoundException
Removes an in-edge

Parameters:
edge - the edge to be removed
Throws:
EdgeNotFoundException - in case the edge does not exist

removeOutEdge

public void removeOutEdge(Edge edge)
                   throws EdgeNotFoundException
Removes an out-edge

Parameters:
edge - the edge to be removed
Throws:
EdgeNotFoundException - if the edge is not found

removeEdge

public void removeEdge(Edge edge)
                throws EdgeNotFoundException
Removes an edge regardless of its orientation

Parameters:
edge - The edge to be removed
Throws:
EdgeNotFoundException

inDegree

public int inDegree()
Determines the number of in-edges for this node

Returns:
The number of in-edges

outDegree

public int outDegree()
Determines the number of out-edges for this node

Returns:
The number of out-edges

degree

public int degree()
Determines the total number of edges connected to this node

Returns:
The number of edges

getInEdgesIterator

public EdgeIterator getInEdgesIterator()
Returns an iterator with the in-edges of this node It is advisable for multi-threaded applications to synchronize on this Node object when using the Iterator

Returns:
An iterator with the in-edges

getOutEdgesIterator

public EdgeIterator getOutEdgesIterator()
Returns an iterator with the out-edges of this node It is advisable for multi-threaded applications to synchronize on this Node object when using the Iterator

Returns:
An iterator with the out-edges

getOutEdges

public List getOutEdges()

getInEdges

public List getInEdges()