edu.cmu.sphinx.util
Class IDGenerator

java.lang.Object
  extended byedu.cmu.sphinx.util.IDGenerator

public class IDGenerator
extends java.lang.Object

An ID generator that gives out positive integer IDs and checks for overflow.


Field Summary
static int NON_ID
          Indicates a non-ID value, which is -1.
 
Constructor Summary
IDGenerator()
           
 
Method Summary
 int getNextID()
          Returns the next valid ID, checks for integer overflow.
 void reset()
          Resets the ID to zero.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NON_ID

public static final int NON_ID
Indicates a non-ID value, which is -1.

See Also:
Constant Field Values
Constructor Detail

IDGenerator

public IDGenerator()
Method Detail

getNextID

public int getNextID()
Returns the next valid ID, checks for integer overflow.

Returns:
the next valid ID, goes back to zero if overflow

reset

public void reset()
Resets the ID to zero.