|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.opensymphony.xwork2.config.providers.DirectedGraph<T>
public final class DirectedGraph<T>
Constructor Summary | |
---|---|
DirectedGraph()
|
Method Summary | |
---|---|
void |
addEdge(T start,
T dest)
Given a start node, and a destination, adds an arc from the start node to the destination. |
boolean |
addNode(T node)
Adds a new node to the graph. |
boolean |
edgeExists(T start,
T end)
Given two nodes in the graph, returns whether there is an edge from the first node to the second node. |
Set<T> |
edgesFrom(T node)
Given a node in the graph, returns an immutable view of the edges leaving that node as a set of endpoints. |
boolean |
isEmpty()
Returns whether the graph is empty. |
Iterator<T> |
iterator()
Returns an iterator that can traverse the nodes in the graph. |
void |
removeEdge(T start,
T dest)
Removes the edge from start to dest from the graph. |
int |
size()
Returns the number of nodes in the graph. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DirectedGraph()
Method Detail |
---|
public boolean addNode(T node)
node
- The node to add.
public void addEdge(T start, T dest)
start
- The start node.dest
- The destination node.
NoSuchElementException
- If either the start or destination nodes do not exist.public void removeEdge(T start, T dest)
start
- The start node.dest
- The destination node.
NoSuchElementException
- If either node is not in the graph.public boolean edgeExists(T start, T end)
start
- The start node.end
- The destination node.
NoSuchElementException
- If either endpoint does not exist.public Set<T> edgesFrom(T node)
node
- The node whose edges should be queried.
NoSuchElementException
- If the node does not exist.public Iterator<T> iterator()
iterator
in interface Iterable<T>
public int size()
public boolean isEmpty()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |