T - the type of object hold in the graphpublic static class DirectedGraph.Node<T> extends Object
It stores elements and remembers edges.
| Modifier and Type | Field and Description |
|---|---|
T |
element
The actual element (data) hold by this node.
|
LinkedHashSet<DirectedGraph.Edge<T>> |
inEdges
The edges entering this node.
|
LinkedHashSet<DirectedGraph.Edge<T>> |
outEdges
The edges leaving from this node.
|
LinkedHashSet<DirectedGraph.Edge<T>> |
usedInEdges
Information used for sorting only.
|
LinkedHashSet<DirectedGraph.Edge<T>> |
usedOutEdges
Information used for sorting only.
|
| Constructor and Description |
|---|
Node(DirectedGraph<T> graph,
T element)
Creates a new node for the given graph and holding the given element.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEdge(T destinationElement)
Adds an edge starting from this node and going to a node holding the
given element.
|
void |
addEdges(T... destinationElements)
Adds edges starting from this node and going to nodes holding the
given elements.
|
void |
resetEdges()
Clears sorting info.
|
String |
toString() |
void |
useInEdge(DirectedGraph.Edge<T> edge)
Used for sorting only.
|
void |
useOutEdge(DirectedGraph.Edge<T> edge)
Used for sorting only.
|
public final T element
public final LinkedHashSet<DirectedGraph.Edge<T>> inEdges
public final LinkedHashSet<DirectedGraph.Edge<T>> usedInEdges
public final LinkedHashSet<DirectedGraph.Edge<T>> outEdges
public final LinkedHashSet<DirectedGraph.Edge<T>> usedOutEdges
public Node(DirectedGraph<T> graph, T element)
graph - the graph this node belongs toelement - the element hold by this nodepublic void addEdge(T destinationElement)
public void addEdges(T... destinationElements)
public void useInEdge(DirectedGraph.Edge<T> edge)
public void useOutEdge(DirectedGraph.Edge<T> edge)
public void resetEdges()