Added some documentation.
This commit is contained in:
parent
0373f310a7
commit
8264214ab2
@ -33,15 +33,25 @@ package sesim;
|
|||||||
private final Locker ID_LOCKER = new Locker();
|
private final Locker ID_LOCKER = new Locker();
|
||||||
private long next_id;
|
private long next_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the ID generator
|
||||||
|
* @param start ID value to start with
|
||||||
|
*/
|
||||||
public IDGenerator(long start){
|
public IDGenerator(long start){
|
||||||
next_id=start;
|
next_id=start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize ID Generator with start ID = 0
|
||||||
|
*/
|
||||||
public IDGenerator(){
|
public IDGenerator(){
|
||||||
this(0);
|
this(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the next ID
|
||||||
|
* @return the next generated ID
|
||||||
|
*/
|
||||||
public long getNext(){
|
public long getNext(){
|
||||||
ID_LOCKER.lock();
|
ID_LOCKER.lock();
|
||||||
long id = next_id++;
|
long id = next_id++;
|
||||||
|
Loading…
Reference in New Issue
Block a user