Package net.ggtools.grand.graph
Interface SubGraph
-
public interface SubGraph
Interface to be implemented by classes providing the subgraph feature. A subgraph is a named node container which is primarily used as a storage helper by graphs. Compared to a graph, a subgraph lacks the factory/manager feature as well as the possibility to hierarchically store nodes using containers like subgraphs.- Author:
- Christophe Labouisse
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addNode(Node node)
Add a new node to the container.String
getName()
Returns the graph's name.Node
getNode(String nodeName)
Find a node from its name.Iterator<Node>
getNodes()
Get the nodes contained in the graph.boolean
hasNode(String nodeName)
Checks if the graph has a node with a specific name.
-
-
-
Method Detail
-
addNode
void addNode(Node node) throws DuplicateElementException
Add a new node to the container.- Parameters:
node
- Node to be added.- Throws:
DuplicateElementException
- if a node with the same name already exists in the container.
-
getName
String getName()
Returns the graph's name.- Returns:
- graph's name.
-
getNode
Node getNode(String nodeName)
Find a node from its name.- Parameters:
nodeName
- name of the node to find.- Returns:
- the node or null if not found.
-
getNodes
Iterator<Node> getNodes()
Get the nodes contained in the graph. The implementing class should guarantee that the Iterator will only returns object implementing the Node interface. The returned iterator should implement the optionalIterator.remove()
method in order to allow the filters to remove nodes.- Returns:
- an iterator to the graph's nodes.
-
hasNode
boolean hasNode(String nodeName)
Checks if the graph has a node with a specific name.- Parameters:
nodeName
- node to search.- Returns:
- true if the graph contains a node called
nodeName
.
-
-