|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.mbari.siam.core.SequenceNumber
public class SequenceNumber
SequenceNumber is an implementation of the SequenceGenerator interface used for generating packet sequence numbers. The packet sequence numbers should start at zero within a log file and increase by one each time a packet is logged; also, they should persist across power cycles. Thus, if a log file exists, when a power cycle occurs, the packet numbers should pick up where they left off in the log. The user is responsible for determining the initial values. IMPORTANT NOTES: This implementation assumes that sequence numbers will not be less than zero (uses only 0-Long.MAX_VALUE), and therefore doesn't suffer from overflow problems. This class will give incorrect results if you use it in a way that exceeds the range of a long.
| Constructor Summary | |
|---|---|
SequenceNumber(long least,
long greatest,
long start)
Constructor for creating and (explicitly) initializing a SequenceNumber |
|
| Method Summary | |
|---|---|
long |
getGreatest()
Get maximum value in sequence |
long |
getLeast()
Get minimum value in sequence |
long |
getNext()
Get next number in sequence |
void |
initialize(long least,
long greatest,
long current)
Set sequence range |
static void |
main(java.lang.String[] args)
Eine Kleine test code |
long |
peek(long offset,
boolean wrap)
Look at nth number in sequence (relative to the current number) without actually changing anything. |
void |
reset()
Restart sequence from minimum value |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SequenceNumber(long least,
long greatest,
long start)
throws RangeException
RangeException| Method Detail |
|---|
public long getNext()
getNext in interface SequenceGeneratorpublic long getLeast()
getLeast in interface SequenceGeneratorpublic long getGreatest()
getGreatest in interface SequenceGenerator
public void initialize(long least,
long greatest,
long current)
throws RangeException
initialize in interface SequenceGeneratorRangeExceptionpublic void reset()
reset in interface SequenceGenerator
public long peek(long offset,
boolean wrap)
peek in interface SequenceGeneratorpublic static void main(java.lang.String[] args)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||