Watchmaker Framework API
(Version 0.6.2)

org.uncommons.util.id
Class IntSequenceIDSource

java.lang.Object
  extended by org.uncommons.util.id.IntSequenceIDSource
All Implemented Interfaces:
IDSource<Integer>

public final class IntSequenceIDSource
extends Object
implements IDSource<Integer>

Thread-safe source for unique IDs. This particular implementation restricts values to those positive integer values that can be represented by the int data type. Provides sequenced 32-bit IDs.

Author:
Daniel Dyer

Constructor Summary
IntSequenceIDSource()
          Creates a sequence that starts at zero.
IntSequenceIDSource(int firstValue)
           
 
Method Summary
 Integer nextID()
          Implementing classes are responsible for synchronization if concurrent invocations of this method are required.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntSequenceIDSource

public IntSequenceIDSource(int firstValue)
Parameters:
firstValue - The value at which to start the sequence (must be non-negative).

IntSequenceIDSource

public IntSequenceIDSource()
Creates a sequence that starts at zero.

Method Detail

nextID

public Integer nextID()
Implementing classes are responsible for synchronization if concurrent invocations of this method are required.

Specified by:
nextID in interface IDSource<Integer>
Returns:
The next ID.

Watchmaker Framework API
(Version 0.6.2)