|
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.Objectdk.rode.thesis.meta.model.AbstractSequence<E>
dk.rode.thesis.bridge.SequenceAbstraction<E>
dk.rode.thesis.bridge.MemorizableSequenceAbstraction<E>
E - The type of values delivered by this sequence.@Participant(value="RefinedAbstraction") public class MemorizableSequenceAbstraction<E>
A memorizable sequence abstraction refines a sequence
abstraction so it can save and restore
its internal implementation in form of mementos.
Mementos cannot be created or set until a generator has been
set, either at construction time, any time before sequence use via the
SequenceAbstraction.setGenerator(SequenceValueGenerator) method.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface dk.rode.thesis.meta.model.Sequence |
|---|
Sequence.State |
| Field Summary |
|---|
| Fields inherited from class dk.rode.thesis.bridge.SequenceAbstraction |
|---|
current, generator |
| Fields inherited from class dk.rode.thesis.meta.model.AbstractSequence |
|---|
state |
| Constructor Summary | |
|---|---|
MemorizableSequenceAbstraction()
Constructor. |
|
MemorizableSequenceAbstraction(SequenceAbstraction<E> sequence)
Copy constructor. |
|
MemorizableSequenceAbstraction(SequenceValueGenerator<E> generator)
Constructor, which creates this memorizable sequence abstraction to use the value generator
supplied as generator. |
|
| Method Summary | |
|---|---|
MemorizableSequenceAbstraction<E> |
copy()
Returns a copy of this sequence that will start at the same sequence index as this sequence. |
SequenceMemento<E> |
getMemorizableState()
Returns a sequence memento representing the current state of this sequence. |
void |
setMemorizableState(SequenceMemento<E> memento)
Updates this sequence to the state supplied as memento. |
| Methods inherited from class dk.rode.thesis.bridge.SequenceAbstraction |
|---|
bounded, consistent, current, isInitialised, next, reset, setGenerator, state, toString, unique |
| Methods inherited from class dk.rode.thesis.meta.model.AbstractSequence |
|---|
getStringablePolicy, 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 |
|---|
bounded, consistent, current, next, reset, state, unique |
| Methods inherited from interface dk.rode.thesis.strategy.Stringable |
|---|
getStringablePolicy, toString |
| Constructor Detail |
|---|
public MemorizableSequenceAbstraction()
A value generator must explicitly
be set using the SequenceAbstraction.setGenerator(SequenceValueGenerator)
method before this sequence is valid!
public MemorizableSequenceAbstraction(SequenceAbstraction<E> sequence)
If sequence does not have a value generator set, a generator must explicitly
be set for this sequence using the
SequenceAbstraction.setGenerator(SequenceValueGenerator) method before
this sequence is valid!
sequence - The (memorizable) sequence abstraction to copy;
cannot be null.
NullPointerException - If sequence is null.
public MemorizableSequenceAbstraction(@Participant(value="Implementation")
SequenceValueGenerator<E> generator)
generator
supplied as generator.
The SequenceAbstraction.setGenerator(SequenceValueGenerator) must not
be invoked for this sequence.
generator - The generator to use; cannot be null.
NullPointerException - If generator is null.| Method Detail |
|---|
public MemorizableSequenceAbstraction<E> copy()
Sequence
copy in interface Sequence<E>copy in interface Copyable<Sequence<E>>copy in class SequenceAbstraction<E>
public SequenceMemento<E> getMemorizableState()
throws IllegalStateException
MemorizableSequence
getMemorizableState in interface MemorizableSequence<E>IllegalStateException - If a generator has not been set.
public void setMemorizableState(SequenceMemento<E> memento)
throws IllegalStateException,
MemorizableException
MemorizableSequencememento.
setMemorizableState in interface MemorizableSequence<E>memento - The memento supplying the state; cannot be null.
IllegalStateException - If a generator has not been set.
MemorizableException - If the update fails, e.g. illegal
memento state for this sequence, or illegal memento type.
|
Gunni Rode / rode.dk | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||