dk.rode.thesis.memento
Class MemorizableEnglishAlphabetSequence
java.lang.Object
dk.rode.thesis.meta.model.AbstractSequence<E>
dk.rode.thesis.meta.model.ArraySequence<String>
dk.rode.thesis.meta.model.EnglishAlphabetSequence
dk.rode.thesis.memento.MemorizableEnglishAlphabetSequence
- All Implemented Interfaces:
- MemorizableSequence<String>, Sequence<String>, Copyable<Sequence<String>>, StrictCopyable<Sequence<String>>, Stringable<Sequence<String>>
@Participant(value="Originator")
public class MemorizableEnglishAlphabetSequence
- extends EnglishAlphabetSequence
- implements MemorizableSequence<String>
A memorizable alphabet sequence for letters in the
English alphabet, i.e. a
though z
, lower-cased,
that can save and restore its internal state in form of
mementos
.
Implementation notes:
The mementos created are regular SequenceMemento
instances,
not GuardedSequenceMemento
instances as in the
RangeSequence
class.
- Author:
- Gunni Rode / rode.dk
MemorizableEnglishAlphabetSequence
public MemorizableEnglishAlphabetSequence()
- No-arg constructor.
MemorizableEnglishAlphabetSequence
public MemorizableEnglishAlphabetSequence(EnglishAlphabetSequence sequence)
- Copy constructor.
This sequence starts at the current index of sequence
.
- Parameters:
sequence
- The sequence to copy; cannot be null.
- Throws:
NullPointerException
- If sequence
is null.
copy
public MemorizableEnglishAlphabetSequence copy()
- Description copied from interface:
Sequence
- Returns a copy of this sequence that will start at the
same sequence index as this sequence.
- Specified by:
copy
in interface Sequence<String>
- Specified by:
copy
in interface Copyable<Sequence<String>>
- Overrides:
copy
in class EnglishAlphabetSequence
- Returns:
- A copy of this sequence; never null.
getMemorizableState
public SequenceMemento<String> getMemorizableState()
- Description copied from interface:
MemorizableSequence
- Returns a sequence memento representing the current state
of this sequence.
- Specified by:
getMemorizableState
in interface MemorizableSequence<String>
- Returns:
- The memento; never null.
setMemorizableState
public void setMemorizableState(SequenceMemento<String> memento)
throws MemorizableException
- Description copied from interface:
MemorizableSequence
- Updates this sequence to the state supplied as
memento
.
- Specified by:
setMemorizableState
in interface MemorizableSequence<String>
- Parameters:
memento
- The memento supplying the state; cannot be null.
- Throws:
MemorizableException
- If the update fails, e.g. illegal
memento state for this sequence, or illegal memento type.
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.