|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvanetsim.scenario.KnownRSUsList
public class KnownRSUsList
A list of all known Road-Side-Units which was discovered through beacons. In contrast to the KnownPenalties-
class, an own class is used for storing the information about the RSUs. Although this means slightly
more overhead, it should not be a big case and allows better extensibility.
A simple hash algorithm based on the RSU ID is used to get better performance. The hash determines the
corresponding linked list(beginnings of linked lists are found in head_
). Known RSUs with the
same hash are connected together through their next_
and previous_
values (see
KnownRSU-class).
Constructor Summary | |
---|---|
KnownRSUsList()
Empty constructor. |
Method Summary | |
---|---|
void |
checkOutdatedRSUs()
Checks if a RSU is too old so that it can be removed. |
void |
clear()
Clears everything from this data structure. |
RSU |
findNearestRSU(int rsuX,
int rsuY,
int destX,
int destY,
int maxDistance)
Finds the nearest known RSU to a destination. |
KnownRSU[] |
getFirstKnownRSU()
Gets an hashed array with known RSUs (array length depends on the HASH_SIZE). |
int |
getSize()
Gets the amount of known RSUs stored. |
static void |
setTimePassed(int time)
Sets the time passed since simulation start. |
void |
updateRSU(RSU rsu,
long ID,
int x,
int y,
boolean isEncrypted)
Update a RSU or add it if it doesn't exist yet. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KnownRSUsList()
Method Detail |
---|
public void updateRSU(RSU rsu, long ID, int x, int y, boolean isEncrypted)
rsu
- a reference to the RSUID
- the ID of the RSUx
- the x coordinatey
- the y coordinateisEncrypted
- if Beacon was encryptedpublic void checkOutdatedRSUs()
public RSU findNearestRSU(int rsuX, int rsuY, int destX, int destY, int maxDistance)
rsuX
- the x coordinate of the calling RSUrsuY
- the y coordinate of the calling RSUdestX
- the x coordinate of the destinationdestY
- the y coordinate of the destinationmaxDistance
- the maximum distance the nearest RSU max have from the calling RSU
null
if the calling RSU is the nearestpublic KnownRSU[] getFirstKnownRSU()
getNext()
until you get to a null
element on all
elements of this array
public int getSize()
public static void setTimePassed(int time)
time
- the new time in millisecondspublic void clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |