Methods Summary |
---|
public boolean | addEdge(javax.imageio.spi.DigraphNode node)Adds a directed edge to the graph. The outNodes list of this
node is updated and the in-degree of the other node is incremented.
if (outNodes.contains(node)) {
return false;
}
outNodes.add(node);
node.inNodes.add(this);
node.incrementInDegree();
return true;
|
private void | decrementInDegree()Decrements the in-degree of this node.
--inDegree;
|
public void | dispose()Removes this node from the graph, updating neighboring nodes
appropriately.
Object[] inNodesArray = inNodes.toArray();
for(int i=0; i<inNodesArray.length; i++) {
DigraphNode node = (DigraphNode) inNodesArray[i];
node.removeEdge(this);
}
Object[] outNodesArray = outNodes.toArray();
for(int i=0; i<outNodesArray.length; i++) {
DigraphNode node = (DigraphNode) outNodesArray[i];
removeEdge(node);
}
|
public java.lang.Object | getData()Returns the Object referenced by this node.
return data;
|
public int | getInDegree()Returns the in-degree of this node.
return inDegree;
|
public java.util.Iterator | getOutNodes()Returns an Iterator containing the nodes pointed
to by this node.
return outNodes.iterator();
|
public boolean | hasEdge(javax.imageio.spi.DigraphNode node)Returns true if an edge exists between this node
and the given node.
return outNodes.contains(node);
|
private void | incrementInDegree()Increments the in-degree of this node.
++inDegree;
|
public boolean | removeEdge(javax.imageio.spi.DigraphNode node)Removes a directed edge from the graph. The outNodes list of this
node is updated and the in-degree of the other node is decremented.
if (!outNodes.contains(node)) {
return false;
}
outNodes.remove(node);
node.inNodes.remove(this);
node.decrementInDegree();
return true;
|