Public Member Functions | |
JunctionQueue () | |
synchronized boolean | addVehicle (Vehicle vehicle) |
synchronized boolean | delVehicle (Vehicle vehicle) |
synchronized void | delFirstVehicle () |
synchronized void | cleanUp () |
Vehicle | getFirstVehicle () |
int | size () |
A queue for the vehicles waiting on a junction.
|
inline |
Constructor.
|
inline |
Adds a vehicle to the queue. If it already exists, the lastSeen-time is updated.
vehicle | the vehicle to add |
true
if a vehicle was added, false
if it previously existed in this queue.
|
inline |
Cleans up. This removes vehicles which haven't been seen for a long time and thus prevents from stalls.
|
inline |
Deletes the first vehicle in this queue.
|
inline |
Removes a vehicle from the queue.
vehicle | the vehicles to remove |
true
if a vehicle was found and deleted, else false
|
inline |
Gets the first vehicle in this queue.
|
inline |
Returns the size of this queue.