net.ggtools.grand.graph
Class SubGraphImpl

java.lang.Object
  extended by net.ggtools.grand.graph.SubGraphImpl
All Implemented Interfaces:
NodeContainer, SubGraph

 class SubGraphImpl
extends java.lang.Object
implements SubGraph

Author:
Christophe Labouisse

Nested Class Summary
(package private) static interface SubGraphImpl.NodeIteratorFactory
           
 
Constructor Summary
SubGraphImpl(java.lang.String name)
          Creates a new instance using a trival SubGraphImpl.NodeIteratorFactory.
SubGraphImpl(java.lang.String name, SubGraphImpl.NodeIteratorFactory nodeIteratorFactory)
          Creates a new instance using a specific SubGraphImpl.NodeIteratorFactory.
 
Method Summary
 void addNode(Node node)
          Add a new node to the container.
 java.lang.String getName()
          Returns the graph's name.
 Node getNode(java.lang.String nodeName)
          Find a node from its name.
 java.util.Iterator getNodes()
          Get the nodes contained in the graph.
 boolean hasNode(java.lang.String nodeName)
          Checks if the graph has a node with a specific name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubGraphImpl

SubGraphImpl(java.lang.String name)
Creates a new instance using a trival SubGraphImpl.NodeIteratorFactory.

Parameters:
name - sub graph name.

SubGraphImpl

SubGraphImpl(java.lang.String name,
             SubGraphImpl.NodeIteratorFactory nodeIteratorFactory)
Creates a new instance using a specific SubGraphImpl.NodeIteratorFactory.

Parameters:
name - sub graph name.
nodeIteratorFactory - factory to be used for getNodes().
Method Detail

addNode

public void addNode(Node node)
             throws DuplicateElementException
Description copied from interface: SubGraph
Add a new node to the container.

Specified by:
addNode in interface SubGraph
Parameters:
node - Node to be added.
Throws:
DuplicateElementException - if a node with the same name already exists in the container.

getName

public java.lang.String getName()
Description copied from interface: SubGraph
Returns the graph's name.

Specified by:
getName in interface SubGraph
Returns:
graph's name.

getNode

public Node getNode(java.lang.String nodeName)
Description copied from interface: NodeContainer
Find a node from its name.

Specified by:
getNode in interface NodeContainer
Parameters:
nodeName - name of the node to find.
Returns:
the node or null if not found.

getNodes

public java.util.Iterator getNodes()
Description copied from interface: NodeContainer
Get the nodes contained in the graph. The implementing class should garantee that the Iterator will only returns object implementing the Node interface. The returned iterator should implement the optional Iterator.remove()method in order to allow the filters to remove nodes.

Specified by:
getNodes in interface NodeContainer
Returns:
an iterator to the graph's nodes.

hasNode

public boolean hasNode(java.lang.String nodeName)
Description copied from interface: NodeContainer
Checks if the graph has a node with a specific name.

Specified by:
hasNode in interface NodeContainer
Parameters:
nodeName - node to search.
Returns:
true if the graph contains a node called nodeName.


Copyright © 2004-2005 ggTools. All Rights Reserved.