public class SequenceNumber extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_VALUE |
static int |
MAX_VALUE |
static int |
MIN_VALUE |
| Constructor and Description |
|---|
SequenceNumber() |
SequenceNumber(int initialValue) |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertValid(int sequenceNumber) |
int |
next()
Get the next number in this sequence's scheme.
|
int |
peek()
Get the next number in this sequence's scheme without causing it to move
to the next-in-sequence.
|
void |
reset()
Reset the sequence scheme to the beginning of the sequence (min value
which is 1).
|
public static final int MIN_VALUE
public static final int DEFAULT_VALUE
public static final int MAX_VALUE
public SequenceNumber()
public SequenceNumber(int initialValue)
throws InvalidSequenceNumberException
InvalidSequenceNumberExceptionpublic int next()
public int peek()
next() without actually
increasing the sequence. Multiple calls to peek will
return the same number until a call to next() is made.public void reset()
public static void assertValid(int sequenceNumber)
throws InvalidSequenceNumberException
InvalidSequenceNumberExceptionCopyright © 2009-2014 Cloudhopper by Twitter. All Rights Reserved.