Public Member Functions | |
KnownPenalties (Vehicle vehicle) | |
synchronized void | updatePenalty (Street street, int direction, int penalty, int validUntil) |
void | checkValidUntil () |
Street[] | getStreets () |
int[] | getDirections () |
int[] | getPenalties () |
int | getSize () |
void | clear () |
Stores all known penalties for streets. The streets are stored together with their direction and a penalty in cm. Arrays are directly used here (in contrast to the KnownVehiclesList) as this allows easier and faster usage in the routing algorithm. Extensibility is not a major concern here.
Note for developers: You need to make sure, that all used arrays always have the same size!
|
inline |
Constructor.
vehicle | the vehicle this data structure belongs to. |
|
inline |
Check for outdated entries and remove them. Note that this function is not synchronized! You need to make sure that no other thread uses any function on this object at the same time!
|
inline |
Clears everything from this data structure.
|
inline |
Gets an array with the directions corresponding to the getStreets()-function. 1
in the array means from endNode to startNode, 0
means both directions and -1
means from startNode to endNode
|
inline |
Gets an array with the penalties corresponding to the getStreets()-function. Measured in cm.
|
inline |
Gets the amount of known penalties stored.
|
inline |
Gets all streets with known penalties.
|
inline |
Updates or adds a penalty. If a penalty already existed, the values for penalty and validUntil are overwritten! If the penalty is new or differs from the last one, a new route calculation is initiated.
street | the street |
direction | the direction. 1 means from endNode to startNode, 0 means both directions and -1 means from startNode to endNode |
penalty | the penalty in cm |
validUntil | how long this entry will be valid. Measured in millseconds from simulation start |