VANET Simulator
 All Classes Functions Variables
Public Member Functions | List of all members
vanetsim.scenario.KnownPenalties Class Reference

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 ()

Detailed Description

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 & Destructor Documentation

vanetsim.scenario.KnownPenalties.KnownPenalties ( Vehicle  vehicle)


vehiclethe vehicle this data structure belongs to.

Member Function Documentation

void vanetsim.scenario.KnownPenalties.checkValidUntil ( )

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!

void vanetsim.scenario.KnownPenalties.clear ( )

Clears everything from this data structure.

int [] vanetsim.scenario.KnownPenalties.getDirections ( )

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

an array with all directions
int [] vanetsim.scenario.KnownPenalties.getPenalties ( )

Gets an array with the penalties corresponding to the getStreets()-function. Measured in cm.

an array with all penalties
int vanetsim.scenario.KnownPenalties.getSize ( )

Gets the amount of known penalties stored.

the size
Street [] vanetsim.scenario.KnownPenalties.getStreets ( )

Gets all streets with known penalties.

an array with all streets
synchronized void vanetsim.scenario.KnownPenalties.updatePenalty ( Street  street,
int  direction,
int  penalty,
int  validUntil 

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.

streetthe street
directionthe direction. 1 means from endNode to startNode, 0 means both directions and -1 means from startNode to endNode
penaltythe penalty in cm
validUntilhow long this entry will be valid. Measured in millseconds from simulation start

The documentation for this class was generated from the following file: