diva.graphx.toolbox
Class BasicNode

java.lang.Object
  extended by diva.util.BasicPropertyContainer
      extended by diva.graphx.toolbox.BasicNode
All Implemented Interfaces:
PropertyContainer

public class BasicNode
extends BasicPropertyContainer

A basic implementation of a node. This node can be a composite node, that is, it can contain other nodes. The implementation does not enforce whether a node is composite or not (eg by having a flag to say whether it is and disallowing methods that add child nodes or not). Rather, it always returns true to the isComposite() method.

Version:
$Revision: 1.1 $
Author:
Michael Shilman (michaels@eecs.berkeley.edu)

Constructor Summary
BasicNode()
           
 
Method Summary
 boolean contains(BasicNode n)
          Test if the node is a child of this node
 int getNodeCount()
          Return the number of child nodes
 BasicNode getParent()
          Return the parent node of this node
 Iterator inEdges()
          Return an iterator over the in edges of this node.
 Iterator nodes()
          Return an iterator over the contained nodes.
 Iterator outEdges()
          Return an iterator over the out edges of this node.
 Iterator predecessors()
          Return an iterator over the predecessor nodes of this node.
 void setParent(BasicNode parent)
          Set the parent of this node.
 Iterator successors()
          Return an iterator over the successor nodes of this node.
 
Methods inherited from class diva.util.BasicPropertyContainer
getProperty, properties, propertyNames, removeAllProperties, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicNode

public BasicNode()
Method Detail

contains

public boolean contains(BasicNode n)
Test if the node is a child of this node


getParent

public BasicNode getParent()
Return the parent node of this node


getNodeCount

public int getNodeCount()
Return the number of child nodes


inEdges

public Iterator inEdges()
Return an iterator over the in edges of this node. This iterator does not support removal operations.


predecessors

public Iterator predecessors()
Return an iterator over the predecessor nodes of this node. This iterator does not support removal operations. This method provides a convenient way of traversing a graph. FIXME: this will be incorrect if an edge does not have a tail node.


nodes

public Iterator nodes()
Return an iterator over the contained nodes.


outEdges

public Iterator outEdges()
Return an iterator over the out edges of this node. This iterator does not support removal operations.


successors

public Iterator successors()
Return an iterator over the successor nodes of this node. This iterator does not support removal operations. This method provides a convenient way of traversing a graph. FIXME: this will be incorrect if an edge does not have a head node.


setParent

public void setParent(BasicNode parent)
Set the parent of this node. Do not add the node to the parent (that is, adding nodes to a node should be done with the addNode() method).



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.