Added some documentation.

This commit is contained in:
7u83 2017-01-12 11:30:25 +01:00
parent 0373f310a7
commit 8264214ab2
1 changed files with 11 additions and 1 deletions

View File

@ -33,15 +33,25 @@ package sesim;
private final Locker ID_LOCKER = new Locker();
private long next_id;
/**
* Initialize the ID generator
* @param start ID value to start with
*/
public IDGenerator(long start){
next_id=start;
}
/**
* Initialize ID Generator with start ID = 0
*/
public IDGenerator(){
this(0);
}
/**
* Get the next ID
* @return the next generated ID
*/
public long getNext(){
ID_LOCKER.lock();
long id = next_id++;