Evaluating Software Design Patterns
— the "Gang of Four" patterns implemented in Java 6

dk.rode.thesis.memento
Interface MemorizableSequence<E>

Type Parameters:
E - The type of values delivered by this memorizable sequence.
All Superinterfaces:
Copyable<Sequence<E>>, Sequence<E>, StrictCopyable<Sequence<E>>, Stringable<Sequence<E>>
All Known Implementing Classes:
MemorizableEnglishAlphabetSequence, MemorizableSequenceAbstraction, RangeSequence

@Participant(value="Originator")
public interface MemorizableSequence<E>
extends Sequence<E>

A memorizable sequence can memorise its internal state at a given time and have it restored again later by using mementos.

Author:
Gunni Rode / rode.dk

Nested Class Summary
 
Nested classes/interfaces inherited from interface dk.rode.thesis.meta.model.Sequence
Sequence.State
 
Method Summary
 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 interface dk.rode.thesis.meta.model.Sequence
bounded, consistent, copy, current, next, reset, state, unique
 
Methods inherited from interface dk.rode.thesis.strategy.Stringable
getStringablePolicy, toString
 

Method Detail

getMemorizableState

SequenceMemento<E> getMemorizableState()
Returns a sequence memento representing the current state of this sequence.

Returns:
The memento; never null.

setMemorizableState

void setMemorizableState(SequenceMemento<E> memento)
                         throws MemorizableException
Updates this sequence to the state supplied as memento.

Parameters:
memento - The memento supplying the state; cannot be null.
Throws:
NullPointerException - If memento is null.
MemorizableException - If the update fails, e.g. illegal memento state for this sequence, or illegal memento type.

Gunni Rode / rode.dk

Feel free to use and/or modify the Java 6 source code developed for this thesis AT YOUR OWN RISK, but note that the source code comes WITHOUT ANY — and I do mean WITHOUT ANY — form of warranty WHAT SO EVER!

The original thesis and source code are available at rode.dk/thesis.