APIdia Launch Partner
Top Description Fields Constructors Methods
javax.imageio.spi

pack-priv Class DigraphNode<E>

extends Object
implements Cloneable, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.lang.Cloneable
Imports
java.io.Serial, .Serializable, java.util.HashSet, .Iterator, .Set

A node in a directed graph. In addition to an arbitrary Object containing user data associated with the node, each node maintains a Sets of nodes which are pointed to by the current node (available from getOutNodes). The in-degree of the node (that is, number of nodes that point to the current node) may be queried.

Field Summary

Modifier and TypeField and Description
protected E
data

The data associated with this node.

protected int
inDegree

The in-degree of the node.

private Set<DigraphNode<E>>
inNodes

A Set of neighboring nodes that point to this node.

protected Set<DigraphNode<E>>
outNodes

A Set of neighboring nodes pointed to by this node.

private static final long
serialVersionUID

Use serialVersionUID from JDK 9 for interoperability.

Constructor Summary

AccessConstructor and Description
public
DigraphNode(E data)

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the node was not previously the target of an edge.
addEdge
(DigraphNode<E>
a DigraphNode.
node
)

Adds a directed edge to the graph.

private void
decrementInDegree()

Decrements the in-degree of this node.

public void
dispose()

Removes this node from the graph, updating neighboring nodes appropriately.

public E
getData()

Returns the Object referenced by this node.

public int
getInDegree()

Returns the in-degree of this node.

public Iterator<DigraphNode<E>>
getOutNodes()

Returns an Iterator containing the nodes pointed to by this node.

public boolean

Returns:

true if the node is the target of an edge.
hasEdge
(DigraphNode<E>
a DigraphNode.
node
)

Returns true if an edge exists between this node and the given node.

private void
incrementInDegree()

Increments the in-degree of this node.

public boolean

Returns:

true if the node was previously the target of an edge.
removeEdge
(DigraphNode<E> node)

Removes a directed edge from the graph.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

databack to summary
protected E data

The data associated with this node.

Annotations
@SuppressWarnings:serial
inDegreeback to summary
protected int inDegree

The in-degree of the node.

inNodesback to summary
private Set<DigraphNode<E>> inNodes

A Set of neighboring nodes that point to this node.

Annotations
@SuppressWarnings:serial
outNodesback to summary
protected Set<DigraphNode<E>> outNodes

A Set of neighboring nodes pointed to by this node.

Annotations
@SuppressWarnings:serial
serialVersionUIDback to summary
private static final long serialVersionUID

Use serialVersionUID from JDK 9 for interoperability.

Annotations
@Serial

Constructor Detail

DigraphNodeback to summary
public DigraphNode(E data)

Method Detail

addEdgeback to summary
public boolean addEdge(DigraphNode<E> 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.

Parameters
node:DigraphNode<E>

a DigraphNode.

Returns:boolean

true if the node was not previously the target of an edge.

decrementInDegreeback to summary
private void decrementInDegree()

Decrements the in-degree of this node.

disposeback to summary
public void dispose()

Removes this node from the graph, updating neighboring nodes appropriately.

getDataback to summary
public E getData()

Returns the Object referenced by this node.

getInDegreeback to summary
public int getInDegree()

Returns the in-degree of this node.

getOutNodesback to summary
public Iterator<DigraphNode<E>> getOutNodes()

Returns an Iterator containing the nodes pointed to by this node.

hasEdgeback to summary
public boolean hasEdge(DigraphNode<E> node)

Returns true if an edge exists between this node and the given node.

Parameters
node:DigraphNode<E>

a DigraphNode.

Returns:boolean

true if the node is the target of an edge.

incrementInDegreeback to summary
private void incrementInDegree()

Increments the in-degree of this node.

removeEdgeback to summary
public boolean removeEdge(DigraphNode<E> 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.

Returns:boolean

true if the node was previously the target of an edge.