|
Evaluating Software Design Patterns — the "Gang of Four" patterns implemented in Java 6 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.rode.thesis.meta.model.AbstractSequence<Long> dk.rode.thesis.meta.model.LongSequence
public class LongSequence
A long sequence represents an unbounded long value that
is increased with each call to next()
.
A long sequence is unbounded
, but
unique
and consistent
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface dk.rode.thesis.meta.model.Sequence |
---|
Sequence.State |
Field Summary | |
---|---|
private long |
sequence
The current sequence number. |
private long |
start
Start number of this sequence. |
Fields inherited from class dk.rode.thesis.meta.model.AbstractSequence |
---|
state |
Constructor Summary | |
---|---|
LongSequence()
No-arg constructor. |
|
LongSequence(long start)
Constructor. |
|
LongSequence(LongSequence sequence)
Copy constructor. |
Method Summary | |
---|---|
boolean |
bounded()
Returns false. |
boolean |
consistent()
Returns true. |
LongSequence |
copy()
Returns a copy of this sequence that will start at the same sequence index as this sequence. |
Long |
current()
Returns the current element from this sequence. |
Long |
next()
Returns the next element from this sequence. |
void |
reset()
Resets this sequence to start over if it is consistent. |
boolean |
unique()
Returns true. |
Methods inherited from class dk.rode.thesis.meta.model.AbstractSequence |
---|
getStringablePolicy, state, toString, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface dk.rode.thesis.meta.model.Sequence |
---|
state |
Methods inherited from interface dk.rode.thesis.strategy.Stringable |
---|
getStringablePolicy, toString |
Field Detail |
---|
private long sequence
private final long start
Constructor Detail |
---|
public LongSequence()
public LongSequence(long start)
start
- The start value of this sequence.public LongSequence(LongSequence sequence)
sequence
- The sequence to copy; cannot be null.
NullPointerException
- If sequence
is null.Method Detail |
---|
public boolean bounded()
bounded
in interface Sequence<Long>
Sequence.unique()
public boolean consistent()
consistent
in interface Sequence<Long>
public LongSequence copy()
Sequence
copy
in interface Sequence<Long>
copy
in interface Copyable<Sequence<Long>>
public Long current()
Sequence
This method can be invoked even if Sequence.next()
has not been invoked yet, thus delivering the initial
value of this sequence.
current
in interface Sequence<Long>
public Long next()
Sequence
next
in interface Sequence<Long>
Sequence.current()
,
Sequence.state()
public void reset()
Sequence
If this sequence is consistent
, the
sequence will restart.
reset
in interface Sequence<Long>
reset
in class AbstractSequence<Long>
public boolean unique()
unique
in interface Sequence<Long>
Sequence.consistent()
|
Gunni Rode / rode.dk | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |