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=true
|
||||||
annotation.processing.enabled.in.editor=false
|
annotation.processing.enabled.in.editor=false
|
||||||
annotation.processing.processors.list=
|
annotation.processing.processors.list=
|
||||||
|
@ -33,6 +33,7 @@ package sesim;
|
|||||||
public class IDGenerator {
|
public class IDGenerator {
|
||||||
|
|
||||||
private long next_id;
|
private long next_id;
|
||||||
|
private long start_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the ID generator
|
* Initialize the ID generator
|
||||||
@ -40,7 +41,8 @@ public class IDGenerator {
|
|||||||
* @param start ID value to start with
|
* @param start ID value to start with
|
||||||
*/
|
*/
|
||||||
public IDGenerator(long start) {
|
public IDGenerator(long start) {
|
||||||
next_id = start;
|
start_id=start;
|
||||||
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,6 +52,13 @@ public class IDGenerator {
|
|||||||
this(0);
|
this(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the ID generator
|
||||||
|
*/
|
||||||
|
public final void reset(){
|
||||||
|
next_id = start_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the next ID
|
* Get the next ID
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user