|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.rwth.graph.Graph | +--de.rwth.graph.RootedGraph
This class represents a graph with roots and leafs.
Inner Class Summary | |
class |
RootedGraph.Node
This class represents a node in a RootedGraph . |
Inner classes inherited from class de.rwth.graph.Graph |
Graph.Node, Graph.NodeDyer |
Field Summary | |
protected java.util.HashSet |
leafs
The set of leaf nodes. |
protected java.util.HashSet |
roots
The set of root nodes. |
Fields inherited from class de.rwth.graph.Graph |
curNumber, label, nodes, sizeEdges |
Constructor Summary | |
RootedGraph()
Creates a new RootedGraph without a label. |
|
RootedGraph(java.lang.Object label)
Creates a new RootedGraph with a label. |
Method Summary | |
void |
addLeaf(Graph.Node node)
Adds a node as one of the leafs of this graph. |
void |
addRoot(Graph.Node node)
Adds a node as one of the roots of this graph. |
Graph.Node[] |
getLeafArray()
Returns an array of all leaf nodes. |
java.util.Iterator |
getLeafs()
Returns an iterator of the set of leaf nodes. |
Graph.Node[] |
getRootArray()
Returns an array of all root nodes. |
java.util.Iterator |
getRoots()
Returns an iterator of the set of root nodes. |
boolean |
isLeaf(Graph.Node node)
Checks if the node is a leaf node. |
boolean |
isRoot(Graph.Node node)
Checks if the node is a root node. |
void |
removeLeaf(Graph.Node node)
Removes a node from the set of leaf nodes. |
void |
removeRoot(Graph.Node node)
Removes a node from the set of root nodes. |
Methods inherited from class de.rwth.graph.Graph |
getLabel, getNodes, main, setLabel, sizeEdges, sizeNodes, toString, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.util.HashSet roots
protected java.util.HashSet leafs
Constructor Detail |
public RootedGraph()
RootedGraph
without a label.public RootedGraph(java.lang.Object label)
RootedGraph
with a label.label
- the label of the graph.Method Detail |
public void addRoot(Graph.Node node) throws java.lang.IllegalArgumentException
node
- the node which should be added. It must be a node in this graph.java.lang.IllegalArgumentException
- if the node is not in this graph.public void addLeaf(Graph.Node node) throws java.lang.IllegalArgumentException
node
- the node which should be added. It must be a node in this graph.java.lang.IllegalArgumentException
- if the node is not in this graph.public void removeRoot(Graph.Node node)
node
- the node which should be removed.public void removeLeaf(Graph.Node node)
node
- the node which should be removed.public java.util.Iterator getRoots()
public java.util.Iterator getLeafs()
public Graph.Node[] getRootArray()
public Graph.Node[] getLeafArray()
public boolean isRoot(Graph.Node node)
true
if node
is a root node;
false
otherwise.public boolean isLeaf(Graph.Node node)
true
if node
is a leaf node;
false
otherwise.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |