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

Constructor.

Parameters
vehiclethe vehicle this data structure belongs to.

Member Function Documentation

void vanetsim.scenario.KnownPenalties.checkValidUntil ( )
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!

void vanetsim.scenario.KnownPenalties.clear ( )
inline

Clears everything from this data structure.

int [] vanetsim.scenario.KnownPenalties.getDirections ( )
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

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

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

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

Gets the amount of known penalties stored.

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

Gets all streets with known penalties.

Returns
an array with all streets
synchronized void vanetsim.scenario.KnownPenalties.updatePenalty ( Street  street,
int  direction,
int  penalty,
int  validUntil 
)
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.

Parameters
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: