Added reset method
This commit is contained in:
parent
afe26c0f9c
commit
90acb02a90
@ -1,4 +1,4 @@
|
||||
#Mon, 09 Oct 2017 22:37:48 +0200
|
||||
#Tue, 10 Oct 2017 11:01:16 +0200
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processors.list=
|
||||
|
@ -33,6 +33,7 @@ package sesim;
|
||||
public class IDGenerator {
|
||||
|
||||
private long next_id;
|
||||
private long start_id;
|
||||
|
||||
/**
|
||||
* Initialize the ID generator
|
||||
@ -40,7 +41,8 @@ public class IDGenerator {
|
||||
* @param start ID value to start with
|
||||
*/
|
||||
public IDGenerator(long start) {
|
||||
next_id = start;
|
||||
start_id=start;
|
||||
reset();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -49,6 +51,13 @@ public class IDGenerator {
|
||||
public IDGenerator() {
|
||||
this(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the ID generator
|
||||
*/
|
||||
public final void reset(){
|
||||
next_id = start_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next ID
|
||||
|
Loading…
Reference in New Issue
Block a user