Hemisson
Tjerk Kostelijk & Anne Schuth
<-- BACK TO CLASSES

Class NodeList

java.lang.Object
  extended byNodeList

public class NodeList
extends java.lang.Object

NodeList is designed to hold a number of Nodes and to perform some operations, specific to the A* algoritm, on them*


Constructor Summary
NodeList()
          No-arg constructor, creates the vector that is used inside NodeList
 
Method Summary
 void add(Node n)
          Adds Node n to the end of the list.
 boolean beenThereDoneThat(Node n)
           
 Node get(int i)
           
 Node get(int x, int y)
           
 Node getCurrentNode()
           
 int getCurrentOrientation()
           
 boolean includesPoint(Point p)
           
 boolean isNotEmpty()
          Checks wheter a list is not empty.
 Node lastElement()
           
 int nodeExist(int x, int y)
           
 Node popNodeWithLowestF()
           
 void remove(Node _Node)
           
 void removeEqualPoints(Node n)
          Removes all node from the list where the X and Y values are the same.
 void setCurrentNodeAndOrientation(Node _nCurrent, int _iOrientation)
          Sets the current Node with its orientation
 int size()
           
 java.lang.String toString()
           
 int[] worldBoundaries()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NodeList

public NodeList()
No-arg constructor, creates the vector that is used inside NodeList

Method Detail

add

public void add(Node n)
Adds Node n to the end of the list.


get

public Node get(int i)
Returns:
Node with index i from the list.

lastElement

public Node lastElement()
Returns:
The last (added) Node from the list

remove

public void remove(Node _Node)
Parameters:
_Node - is removed from the list

get

public Node get(int x,
                int y)
Returns:
A Node with the specified x and y values

size

public int size()
Returns:
int with the lenght/size of the list.

nodeExist

public int nodeExist(int x,
                     int y)
Returns:
the index in the NodeList of the requested location

worldBoundaries

public int[] worldBoundaries()
Returns:
an array with the min/max values van x/y

removeEqualPoints

public void removeEqualPoints(Node n)
Removes all node from the list where the X and Y values are the same.


popNodeWithLowestF

public Node popNodeWithLowestF()
Returns:
Node with the lowest f(n) value of the Node. The f(n) value is the value used for A*. f(n) = g(n) + h(n). The returned Node is deleted (popped) as well.

isNotEmpty

public boolean isNotEmpty()
Checks wheter a list is not empty.

Returns:
true if the list is not empty.

beenThereDoneThat

public boolean beenThereDoneThat(Node n)
Returns:
true if a location (x and y value the same) was visited before with a better f(n) value.

includesPoint

public boolean includesPoint(Point p)
Returns:
True if there is a Node with the specified x and y values

toString

public java.lang.String toString()
Returns:
string with all the nodes concatenated.

getCurrentNode

public Node getCurrentNode()
Returns:
The Node that is set as CurrentNode

getCurrentOrientation

public int getCurrentOrientation()
Returns:
The orientation that is set as CurrentOrientation (0 - 3)

setCurrentNodeAndOrientation

public void setCurrentNodeAndOrientation(Node _nCurrent,
                                         int _iOrientation)
Sets the current Node with its orientation


Hemisson
Tjerk Kostelijk & Anne Schuth
<-- BACK TO CLASSES