shady.common.pathfinder
Class Node

java.lang.Object
  extended by shady.common.pathfinder.Node

public class Node
extends java.lang.Object

Used in the graph representation the possible shady connection points in the environment.

Target: 1.4 JRE.

Copyright (C) 2006 Marsette A. Vona, III

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Author:
Peter Osagie

Field Summary
private static java.lang.String cvsid
          CVS id.
private  double distanceToStartNode
          Distance to start node.
private  java.util.LinkedList edges
          All edges connected to this node.
private  java.util.LinkedList neighbours
          Neighbour nodes to this node.
private  Node next
          Next node in the path.
private  Point.OnSegment point
          Point on a segment in the environment.
private  Node previous
          Previous node in the path.
 
Constructor Summary
Node(Point.OnSegment point)
          Create a new Node with reference to a 2D point.
 
Method Summary
protected  void addEdge(Edge edge)
          Adds an edge to the list of edges.
protected  void addNeighbour(Node node)
          Adds a node to the list of neighbours.
protected  double getDistanceToStartNode()
          Gets the distance to the start node.
protected  java.util.LinkedList getEdges()
          Gets all edges that are assosiated with a node.
protected  Edge getEdgeWithEndNode(Node node)
          Gets the edge that terminates at a given node.
protected  java.util.LinkedList getNeighbours()
          Gets all neighbouring nodes, i.e syblings of a node.
protected  Node getNext()
          Gets the reference to the next node in the path.
 Point.OnSegment getPoint()
          Gets the point assosiated with this node.
protected  Node getPrevious()
          Gets the reference to the previous node in the path.
protected  void setDistanceToStartNode(double distance)
          Sets the distance to the start node.
protected  void setNext(Node node)
          Sets the reference to the next node in the path.
protected  void setPrevious(Node node)
          Sets the reference to the previous node in the path.
 java.lang.String toString()
          returns point.toString()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cvsid

private static final java.lang.String cvsid

CVS id.

See Also:
Constant Field Values

point

private Point.OnSegment point

Point on a segment in the environment.


previous

private Node previous

Previous node in the path.


next

private Node next

Next node in the path.


neighbours

private java.util.LinkedList neighbours

Neighbour nodes to this node.


edges

private java.util.LinkedList edges

All edges connected to this node.


distanceToStartNode

private double distanceToStartNode

Distance to start node.

Constructor Detail

Node

public Node(Point.OnSegment point)

Create a new Node with reference to a 2D point. The node has a distance to the start node set as posistive infinity.

N.B! that each node also know which edges connects to and from it.

Parameters:
point - the corresponding 2D point
Method Detail

getDistanceToStartNode

protected double getDistanceToStartNode()

Gets the distance to the start node.

Returns:
the distance

setDistanceToStartNode

protected void setDistanceToStartNode(double distance)

Sets the distance to the start node.

Parameters:
distance - the distance

getEdgeWithEndNode

protected Edge getEdgeWithEndNode(Node node)

Gets the edge that terminates at a given node.

Parameters:
node - the end node
Returns:
the edge

getNext

protected Node getNext()

Gets the reference to the next node in the path.

Returns:
the node

setNext

protected void setNext(Node node)

Sets the reference to the next node in the path.

Parameters:
node - the reference to the next node in the path

getPrevious

protected Node getPrevious()

Gets the reference to the previous node in the path.

Returns:
the node

setPrevious

protected void setPrevious(Node node)

Sets the reference to the previous node in the path.

Parameters:
node - the reference to the previous node in the path

addNeighbour

protected void addNeighbour(Node node)

Adds a node to the list of neighbours.

Parameters:
node - the node to add

getNeighbours

protected java.util.LinkedList getNeighbours()

Gets all neighbouring nodes, i.e syblings of a node.

Returns:
the list of neighbours

addEdge

protected void addEdge(Edge edge)

Adds an edge to the list of edges.

Parameters:
edge - the edge to add

getEdges

protected java.util.LinkedList getEdges()

Gets all edges that are assosiated with a node.

Returns:
the list of edges

getPoint

public Point.OnSegment getPoint()

Gets the point assosiated with this node.

Returns:
the point

toString

public java.lang.String toString()
returns point.toString()

Overrides:
toString in class java.lang.Object