vanetsim.routing.A_Star
Class A_Star_Queue

java.lang.Object
  extended by vanetsim.routing.A_Star.A_Star_Queue

public final class A_Star_Queue
extends java.lang.Object

This class is almost the same as java.util.PriorityQueue from Sun OpenJDK 1.7 but is simplified for the specific usage as a high-performance queue for the A_Star_Algo. It also has an added feature to change the value of an element without needing to readd. It only includes the functions needed for this algorithm and thus cannot be used as a multi-purpose container anymore!


Constructor Summary
A_Star_Queue()
          Creates a new A_Star_Queue with 100 elements starting capacity.
 
Method Summary
 void add(A_Star_Node node)
          Inserts the specified element into this priority queue.
 boolean isEmpty()
          Checks if this queue is empty.
 A_Star_Node poll()
          Polls (get and remove) the first element.
 void remove(A_Star_Node node)
          Removes a node from this queue.
 void signalDecreasedF(A_Star_Node node)
          Call this function after you have set a node to a smaller f-value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

A_Star_Queue

public A_Star_Queue()
Creates a new A_Star_Queue with 100 elements starting capacity.

Method Detail

add

public void add(A_Star_Node node)
Inserts the specified element into this priority queue.

Parameters:
node - the node to add

signalDecreasedF

public void signalDecreasedF(A_Star_Node node)
Call this function after you have set a node to a smaller f-value. This saves from first removing and later adding the element.

Parameters:
node - the node which has a smaller f-value

isEmpty

public boolean isEmpty()
Checks if this queue is empty.

Returns:
true if it's empty, else false

poll

public A_Star_Node poll()
Polls (get and remove) the first element.

Returns:
the node

remove

public void remove(A_Star_Node node)
Removes a node from this queue.

Parameters:
node - the node to be removed from this queue, if present