vanetsim.map
Class JunctionQueue

java.lang.Object
  extended by vanetsim.map.JunctionQueue

public final class JunctionQueue
extends java.lang.Object

A queue for the vehicles waiting on a junction.


Constructor Summary
JunctionQueue()
          Constructor.
 
Method Summary
 boolean addVehicle(Vehicle vehicle)
          Adds a vehicle to the queue.
 void cleanUp()
          Cleans up.
 void delFirstVehicle()
          Deletes the first vehicle in this queue.
 boolean delVehicle(Vehicle vehicle)
          Removes a vehicle from the queue.
 Vehicle getFirstVehicle()
          Gets the first vehicle in this queue.
 int size()
          Returns the size of this queue.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JunctionQueue

public JunctionQueue()
Constructor.

Method Detail

addVehicle

public boolean addVehicle(Vehicle vehicle)
Adds a vehicle to the queue. If it already exists, the lastSeen-time is updated.

Parameters:
vehicle - the vehicle to add
Returns:
true if a vehicle was added, false if it previously existed in this queue.

delVehicle

public boolean delVehicle(Vehicle vehicle)
Removes a vehicle from the queue.

Parameters:
vehicle - the vehicles to remove
Returns:
true if a vehicle was found and deleted, else false

delFirstVehicle

public void delFirstVehicle()
Deletes the first vehicle in this queue.


cleanUp

public void cleanUp()
Cleans up. This removes vehicles which haven't been seen for a long time and thus prevents from stalls.


getFirstVehicle

public Vehicle getFirstVehicle()
Gets the first vehicle in this queue.

Returns:
the first vehicle in this queue

size

public int size()
Returns the size of this queue.

Returns:
size_ the size of this queue