|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object vanetsim.scenario.KnownPenalties
public class KnownPenalties
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!
Constructor Summary | |
---|---|
KnownPenalties(Vehicle vehicle)
Constructor. |
Method Summary | |
---|---|
void |
checkValidUntil()
Check for outdated entries and remove them. |
void |
clear()
Clears everything from this data structure. |
int[] |
getDirections()
Gets an array with the directions corresponding to the getStreets()-function. |
int[] |
getPenalties()
Gets an array with the penalties corresponding to the getStreets()-function. |
int |
getSize()
Gets the amount of known penalties stored. |
Street[] |
getStreets()
Gets all streets with known penalties. |
void |
updatePenalty(Street street,
int direction,
int penalty,
int validUntil)
Updates or adds a penalty. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KnownPenalties(Vehicle vehicle)
vehicle
- the vehicle this data structure belongs to.Method Detail |
---|
public void updatePenalty(Street street, int direction, int penalty, int validUntil)
street
- the streetdirection
- the direction. 1
means from endNode to startNode, 0
means
both directions and -1
means from startNode to endNodepenalty
- the penalty in cmvalidUntil
- how long this entry will be valid. Measured in millseconds from simulation startpublic void checkValidUntil()
public Street[] getStreets()
public int[] getDirections()
1
in the array means from endNode to startNode, 0
means
both directions and -1
means from startNode to endNode
public int[] getPenalties()
public int getSize()
public void clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |