public static class DirectedGraph.Node<E extends java.lang.Comparable<E>> extends java.lang.Object implements java.lang.Comparable<DirectedGraph.Node<E>>
| Modifier and Type | Field and Description |
|---|---|
protected java.util.SortedSet<DirectedGraph.Node<E>> |
children
Points to the children of thise node
|
protected E |
label
Holds the label of node
|
protected java.util.SortedSet<DirectedGraph.Node<E>> |
parents
Points to the parents of this node
|
| Modifier | Constructor and Description |
|---|---|
protected |
Node(E l,
boolean directed)
Created a node with a label -- in a directed or undirected graph
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(DirectedGraph.Node<E> child)
Adds a child
|
void |
addLink(DirectedGraph.Node<E> node)
Adds a node in an undirected graph
|
void |
addParent(DirectedGraph.Node<E> parent)
Adds a parents
|
java.util.SortedSet<DirectedGraph.Node<E>> |
ancestors()
Computes the ancestors of this node
|
protected void |
ancestors(java.util.Set<DirectedGraph.Node<E>> ancestors)
Helper method
|
java.util.Set<DirectedGraph.Node<E>> |
children()
Returns the children
|
protected void |
closure(java.util.Set<DirectedGraph.Node<E>> ancestors)
Helper for Graph.makeClosure
|
int |
compareTo(DirectedGraph.Node<E> arg0) |
java.util.Set<DirectedGraph.Node<E>> |
descendants()
Computes the ancestors of this node
|
protected void |
descendants(java.util.Set<DirectedGraph.Node<E>> descendants)
Helper method
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
E |
label()
Returns the label
|
java.util.Set<DirectedGraph.Node<E>> |
links()
returns the links in an undirected graph
|
java.util.Set<DirectedGraph.Node<E>> |
parents()
Returns the parents
|
java.lang.String |
toString() |
protected java.util.SortedSet<DirectedGraph.Node<E extends java.lang.Comparable<E>>> parents
protected java.util.SortedSet<DirectedGraph.Node<E extends java.lang.Comparable<E>>> children
protected Node(E l, boolean directed)
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic void addChild(DirectedGraph.Node<E> child)
public void addParent(DirectedGraph.Node<E> parent)
public void addLink(DirectedGraph.Node<E> node)
public java.util.Set<DirectedGraph.Node<E>> links()
public java.util.Set<DirectedGraph.Node<E>> children()
public java.util.Set<DirectedGraph.Node<E>> parents()
public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectprotected void closure(java.util.Set<DirectedGraph.Node<E>> ancestors)
public java.util.SortedSet<DirectedGraph.Node<E>> ancestors()
protected void ancestors(java.util.Set<DirectedGraph.Node<E>> ancestors)
public java.util.Set<DirectedGraph.Node<E>> descendants()
protected void descendants(java.util.Set<DirectedGraph.Node<E>> descendants)
public int compareTo(DirectedGraph.Node<E> arg0)
compareTo in interface java.lang.Comparable<DirectedGraph.Node<E extends java.lang.Comparable<E>>>public E label()