|
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 |
E
- The type of values delivered by this reversible sequence.public interface ReversibleSequence<E>
A reversible sequence allows retrieval of previous
values if and only if such previous values are
ready
for delivery, i.e. have
already been calculated.
By invoking reverse()
on a reversible sequence,
the order to advance is reversed, from "next" to "previous" value,
and back to "next" from "previous" the next time reverse()
is invoked, and so forth.
Reversible sequences are by nature always
bounded
and consistent
.
Examples:
Consistent, bounded, unique, reversible number sequence: [0, 1, 2, 3, 4, 5] current(): 0 next(): 1 next(): 2 next(): 3 current(): 3 next(): 4 next(): 5 next(): 1 next(): 2 reverse(): 2 next(): 1 reset(): 0 next(): 5 next(): 4 next(): 3 next(): 2 reverse(): 2 next(): 3 reset(): 0 next(): 1 reset(): 0 reverse(): 0 next(): 5 ..
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface dk.rode.thesis.meta.model.Sequence |
---|
Sequence.State |
Method Summary | |
---|---|
ReversibleSequence<E> |
copy()
Returns a copy of this reversible sequence that will start at the same sequence index as this sequence in the same direction. |
E |
reverse()
Reverses this reversible sequence, if currently reversible . |
boolean |
reversible()
Returns true if this reversible sequence can be reversed in its current state, false if not. |
Methods inherited from interface dk.rode.thesis.meta.model.Sequence |
---|
bounded, consistent, current, next, reset, state, unique |
Methods inherited from interface dk.rode.thesis.strategy.Stringable |
---|
getStringablePolicy, toString |
Method Detail |
---|
ReversibleSequence<E> copy()
copy
in interface Copyable<Sequence<E>>
copy
in interface Sequence<E>
E reverse()
reversible
.
The current
value is not
affected by this method, and is returned by this method.
IllegalStateException
- If this sequence cannot be
reversed at this point.boolean reversible()
If this method returns true, it is safe to invoke
reverse()
. If it returns false, an illegal
state exception will be thrown by reverse()
.
|
Gunni Rode / rode.dk | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |