Added reset method

This commit is contained in:
7u83 2017-10-10 11:06:03 +02:00
parent afe26c0f9c
commit 90acb02a90
2 changed files with 11 additions and 2 deletions

View File

@ -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=

View File

@ -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
* *