Prev Class | Next Class | Frames | No Frames |

Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |

`java.lang.Object`

`vnt.Node`

`(package private) class `**Node**

`extends java.lang.Object`

A class that holds the circular (X,Y) coordinate center,
radius data, and adjacency list information.
Acts as a Graph Theory node (vertex).

Note: This class is used heavily by the Node_Analysis plug-in, which is still very recent and needs significant testing. As a result, this class has a large number of print statements for debugging purposes.

**Author:**- Michael Miller - Truman State University

**Since:**- 1.0

## Field Summary

`private int`

`adjacencyCount`

- The number of adjacencies to this node.

`private Node_LinkedList`

`adjacent`

- The adjacency list for this node.

`private int`

`radius`

- The radius (in pixels) of this node.

`private int`

`x`

- The x-coordinate (in the image) of this node.

`private int`

`y`

- The y-coordinate (in the image) of this node.

## Constructor Summary

`Node(int myX, int myY, int myRadius)`

- Initializes the class with the given information.

## Method Summary

`boolean`

`addAdjacency(Node addMe)`

- Adds a given node to the adjacency list.

`int`

`dissolve()`

- Kill the adjacency linked list.

`Node_LinkedList`

`getAdjacency()`

- A standard accessor to the adjacency list variable.

`int`

`getAdjacencySize()`

- Returns the number of nodes in the adjacency list.

`int`

`getRadius()`

- Accessor for radius variable.

`int`

`getX()`

- Accessor for X variable.

`int`

`getY()`

- Accessor for Y variable.

`void`

`mergeNodes(Node mergeMe)`

- This node is kept.

`boolean`

`removeAdjacency(Node removeMe)`

- Searches this node's adjacency list for the given node.

private int adjacencyCount

The number of adjacencies to this node. This is not merely the size of the list 'adjacent', as that contains a link to this node. The adjacencyCount is the number of other nodes connected to this one.

private Node_LinkedList adjacent

The adjacency list for this node. The list points to an instantiated Node_LinkedList who's myNode == this.

private int radius

The radius (in pixels) of this node.

private int x

The x-coordinate (in the image) of this node.

private int y

The y-coordinate (in the image) of this node.

public Node(int myX, int myY, int myRadius)

Initializes the class with the given information.

Parameters:`myX`

- The x-coordinate of the pixel.`myY`

- The y-coordinate of the pixel.

public boolean addAdjacency(Node addMe)

Adds a given node to the adjacency list. Also adds this to the given node's adjacency list (preserves symmetry).Pre: The given node must exist and the local member adjacent must be non-null. Assumes the list is not improperly linked (broken chains, infinite loops, etc)

Post: If the node was not a duplicate, then it is added to the adjacency list of this node. Symmetry is preserved.

Parameters:`addMe`

- The node to add to the adjacency list.

Returns:- Returns whether the connection was new (and therefore added) or not.

See Also:`Node`

public int dissolve()

Kill the adjacency linked list. Preserves symmetry (adjacent nodes lose reference to this one).Pre: This adjacent must not be null.

Post: Removes all adjacencies this node has with other nodes. Preserves symmetry.

Returns:- Returns the number of adjacent connections that were dissolved.

See Also:`Node`

public Node_LinkedList getAdjacency()

A standard accessor to the adjacency list variable.Pre: This class must exist.

Post: No change.

Returns:- Returns the adjacency list for this node.

public int getAdjacencySize()

Returns the number of nodes in the adjacency list. Nodes cannot be identical (same X and Y coordinate).Pre: This class must exist.

Post: No change.

Returns:- Returns the number of nodes in the adjacency list.

public int getRadius()

Accessor for radius variable.Pre: This class must exist.

Post: No change.

Returns:- radius radius pixel distance value

public int getX()

Accessor for X variable.Pre: This class must exist.

Post: No change.

Returns:- x pixel coordinate value

public int getY()

Accessor for Y variable.Pre: This class must exist.

Post: No change.

Returns:- y pixel coordinate value

public void mergeNodes(Node mergeMe)

This node is kept. The given node mergeMe is deleted. All the connections mergeMe had are added to this node. Since topological information is the only concern, we are interested in preserving the structure of the graph only. The only reason node location needs adjustment is the possibility of capturing more node overlap.Pre: The given node must exist and the local member adjacent must be non-null. Assumes the list is not improperly linked (broken chains, infinite loops, etc)

Post: This node gains all the non-duplicate connections (with symmetry preserved) of mergeMe. In addition, mergeMe is dissolve()'d.

Parameters:`mergeMe`

- The node to be deleted. All information is unioned to this node.

public boolean removeAdjacency(Node removeMe)

Searches this node's adjacency list for the given node. If it is found, it is removed.Pre: This adjacent must not be null.

Post: Searches all adjacencies this node has with other nodes. If the given node is found, the connection is deleted. Preserves symmetry.

Parameters:`removeMe`

- The node to search for. If it is found, it is deleted.

Returns:- Returns whether or not the node was found (and consequently removed).

See Also:`Node`