org.graffiti.graph
Class AdjListNode

java.lang.Object
  extended by org.graffiti.attributes.AbstractAttributable
      extended by org.graffiti.graph.AbstractGraphElement
          extended by org.graffiti.graph.AbstractNode
              extended by org.graffiti.graph.AdjListNode
All Implemented Interfaces:
Attributable, GraphElement, Node

public class AdjListNode
extends AbstractNode
implements Node, GraphElement

Implements a graph node with adjacency list representation.

Version:
$Revision: 5779 $
See Also:
AdjListGraph, AdjListEdge

Field Summary
protected  List<Edge> directedInEdges
          Contains all the directed ingoing edges of the current Node.
protected  List<Edge> directedOutEdges
          Contains all the directed outgoing edges of the current Node .
protected  List<Edge> undirectedEdges
          Contains all the undirected edges connected to the current Node.
 
Fields inherited from class org.graffiti.graph.AbstractGraphElement
graph
 
Fields inherited from class org.graffiti.attributes.AbstractAttributable
attributes
 
Constructor Summary
protected AdjListNode(Graph graph)
          Constructs a new AdjListNode.
protected AdjListNode(Graph graph, CollectionAttribute coll)
          Constructs a new AdjListNode.
 
Method Summary
(package private)  void addInEdge(AdjListEdge edge)
          Adds a new ingoing Edge to the corresponding Edge list.
(package private)  void addOutEdge(AdjListEdge edge)
          Adds a new outgoing Edge to the corresponding Edge list.
 Iterator<Edge> getDirectedInEdgesIterator()
          Returns an iterator containing the directed ingoing edges of the Node.
 Iterator<Edge> getDirectedOutEdgesIterator()
          Returns an iterator containing the outgoing directed edges of the Node.
 Iterator<Edge> getEdgesIterator()
          Returns an iterator containing all the ingoing and outgoing directed and undirected edges of the current Node.
 int getInDegree()
          Returns the in-degree of the current Node.
 int getOutDegree()
          Returns the out-degree of the current Node.
 Iterator<Edge> getUndirectedEdgesIterator()
          Returns an iterator containing the undirected ingoing and outgoing edges of the Node.
(package private)  void removeInEdge(AdjListEdge edge)
          Removes an ingoing Edge from the corresponding Edge list.
(package private)  void removeOutEdge(AdjListEdge edge)
          Removes an outgoing Edge from the corresponding Edge list.
(package private)  void setGraphToNull()
          Sets the graph member variable to null.
 
Methods inherited from class org.graffiti.graph.AbstractNode
getAllInEdges, getAllInNeighbors, getAllOutEdges, getAllOutNeighbors, getDirectedInEdges, getDirectedOutEdges, getEdges, getInNeighbors, getInNeighborsIterator, getNeighbors, getNeighborsIterator, getOutNeighbors, getOutNeighborsIterator, getUndirectedEdges, getUndirectedNeighbors
 
Methods inherited from class org.graffiti.graph.AbstractGraphElement
getGraph, getListenerManager, remove, toString
 
Methods inherited from class org.graffiti.attributes.AbstractAttributable
addAttribute, addBoolean, addByte, addDouble, addFloat, addInteger, addLong, addShort, addString, changeBoolean, changeByte, changeDouble, changeFloat, changeInteger, changeLong, changeShort, changeString, containsAttribute, getAttribute, getAttributes, getBoolean, getByte, getDouble, getFloat, getInteger, getLong, getShort, getString, removeAttribute, setBoolean, setByte, setDouble, setFloat, setInteger, setLong, setShort, setString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.graffiti.graph.Node
getAllInEdges, getAllInNeighbors, getAllOutEdges, getAllOutNeighbors, getDirectedInEdges, getDirectedOutEdges, getEdges, getInNeighbors, getInNeighborsIterator, getNeighbors, getNeighborsIterator, getOutNeighbors, getOutNeighborsIterator, getUndirectedEdges, getUndirectedNeighbors
 
Methods inherited from interface org.graffiti.graph.GraphElement
getGraph, remove
 
Methods inherited from interface org.graffiti.attributes.Attributable
addAttribute, addBoolean, addByte, addDouble, addFloat, addInteger, addLong, addShort, addString, changeBoolean, changeByte, changeDouble, changeFloat, changeInteger, changeLong, changeShort, changeString, containsAttribute, getAttribute, getAttributes, getBoolean, getByte, getDouble, getFloat, getInteger, getListenerManager, getLong, getShort, getString, removeAttribute, setBoolean, setByte, setDouble, setFloat, setInteger, setLong, setShort, setString
 

Field Detail

directedInEdges

protected List<Edge> directedInEdges
Contains all the directed ingoing edges of the current Node.


directedOutEdges

protected List<Edge> directedOutEdges
Contains all the directed outgoing edges of the current Node .


undirectedEdges

protected List<Edge> undirectedEdges
Contains all the undirected edges connected to the current Node.

Constructor Detail

AdjListNode

protected AdjListNode(Graph graph)
Constructs a new AdjListNode.

Parameters:
graph - the Graph the Node belongs to.

AdjListNode

protected AdjListNode(Graph graph,
                      CollectionAttribute coll)
Constructs a new AdjListNode.

Parameters:
graph - the Graph the Node belongs to.
coll - the CollectionAttribute of the newly created AdjListNode.
Method Detail

getDirectedInEdgesIterator

public Iterator<Edge> getDirectedInEdgesIterator()
Returns an iterator containing the directed ingoing edges of the Node.

Specified by:
getDirectedInEdgesIterator in interface Node
Returns:
an iterator containing the directed ingoing edges of the Node.

getDirectedOutEdgesIterator

public Iterator<Edge> getDirectedOutEdgesIterator()
Returns an iterator containing the outgoing directed edges of the Node.

Specified by:
getDirectedOutEdgesIterator in interface Node
Returns:
an iterator containing the outgoing directed edges of the Node.

getEdgesIterator

public Iterator<Edge> getEdgesIterator()
Returns an iterator containing all the ingoing and outgoing directed and undirected edges of the current Node. Ingoing and outgoing edges will not be separated and there will be no ordering on the collection.

Specified by:
getEdgesIterator in interface Node
Returns:
an iterator containing all ingoing and outgoing directed and undirected edges of the current Node.

getInDegree

public int getInDegree()
Returns the in-degree of the current Node. The in-degree is defined as the number of ingoing, directed edges plus the number of undirected edges.

Specified by:
getInDegree in interface Node
Overrides:
getInDegree in class AbstractNode
Returns:
the in-degree of the current Node.

getOutDegree

public int getOutDegree()
Returns the out-degree of the current Node. The out-degree is defined as the number of outgoing, directed edges plus the number of undirected edges.

Specified by:
getOutDegree in interface Node
Overrides:
getOutDegree in class AbstractNode
Returns:
the out-degree of the current Node.

getUndirectedEdgesIterator

public Iterator<Edge> getUndirectedEdgesIterator()
Returns an iterator containing the undirected ingoing and outgoing edges of the Node.

Specified by:
getUndirectedEdgesIterator in interface Node
Returns:
a iterator containing the undirected ingoing and outgoing edges of the Node.

setGraphToNull

void setGraphToNull()
Sets the graph member variable to null. Be Careful: This function should only be called when the node gets deleted.


addInEdge

void addInEdge(AdjListEdge edge)
Adds a new ingoing Edge to the corresponding Edge list. Informs the ListenerManageer about the change.

Parameters:
edge - the Edge to be added.

addOutEdge

void addOutEdge(AdjListEdge edge)
Adds a new outgoing Edge to the corresponding Edge list. Informs the ListenerManageer about the change.

Parameters:
edge - the Edge to be added.

removeInEdge

void removeInEdge(AdjListEdge edge)
            throws GraphElementNotFoundException
Removes an ingoing Edge from the corresponding Edge list. Informs the ListenerManager about the change.

Parameters:
edge - the Edge to remove.
Throws:
GraphElementNotFoundException - if the Edge cannot be found in any of the Edge lists.

removeOutEdge

void removeOutEdge(AdjListEdge edge)
             throws GraphElementNotFoundException
Removes an outgoing Edge from the corresponding Edge list. Informs the ListenerManager about the change.

Parameters:
edge - the Edge to remove.
Throws:
GraphElementNotFoundException - if the Edge cannot be found in any of the Edge lists.


Generated at 2012-05-30 11:00:36 PM CEST