|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mega.gasp.bluetooth.miniplatform.IDManager
IDManager provide a management of the temporary IDs: ActorSessionID (ASID). These ID must be unique on the platform. There is a vector of released ASID sort by ASID and a meter to insure unicity. A max is set to limit the size of the IDs to improve the length of the message communications, in this version of the platform the type short is used. The algorithm to generate a new ID: the meter is incremented for a new ID attribution if the vector of released ID is empty, else the first ID of the vector is attributed and removed from the vector. The algorithm to release an ID: the meter is decremented if the ID is the max attributed ID and a purge of the vector is done, else the ID is released in the vector and insert at the right place (growing order).
Field Summary | |
private java.util.Vector |
freeASID
|
private int |
max
|
private int |
maxFreeID
|
Constructor Summary | |
IDManager()
|
Method Summary | |
int |
generateASID()
Generate an unique ActorSession ID. |
private void |
indexID(java.util.Vector releasedIdVector,
int tempID)
Place the ID at his place in the vector, increase order. |
private void |
purgeVector(java.util.Vector releasedIdVector)
Purge the vector with the alogorithm above: -> if the released ID is the max used ID then search in the vector releasedID-1, if it is in remove it, set to max Free ID and replay the algorithm. |
void |
releaseASID(int tempID)
Release an ActorSession ID. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private int max
private int maxFreeID
private java.util.Vector freeASID
Constructor Detail |
public IDManager()
Method Detail |
public int generateASID()
public void releaseASID(int tempID)
tempID
- the ASIDprivate void indexID(java.util.Vector releasedIdVector, int tempID)
releasedIdVector
- the vector of released IDtempID
- the tempID to placeprivate void purgeVector(java.util.Vector releasedIdVector)
releasedIdVector
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |