|
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.factorymethod.CommandCreator<E,Sequence.State> dk.rode.thesis.factorymethod.SequenceCommandCreator<E> dk.rode.thesis.factorymethod.ReversibleSequenceCommandCreator<E>
E
- The type of values delivered by created commands (and thus sequences).@Participant(value="ConcreteCreator") public class ReversibleSequenceCommandCreator<E>
A reversible sequence command creator extends
the sequence command creator
to allow for the creation of reverse
commands for reversible
sequences.
This creator can create the following commands based on the supplied internal sequence state:
null:
a NullCommand
is returned.
Sequence.State.NORMAL
:
creates a new NextCommand
instance (inherited
functionality).
Sequence.State.RESET
:
creates a new ResetCommand
instance (inherited
functionality).
Sequence.State.RESTART
:
if the sequence is reversible, a new ReverseCommand
instance is created and returned.
LogCommand
is returned (default).
Constructor Summary | |
---|---|
ReversibleSequenceCommandCreator()
No-arg constructor. |
Method Summary | |
---|---|
protected Command<E> |
create(Sequence<E> sequence,
Sequence.State state)
Factory method to create a new command of the
type specified by the token supplied as token . |
protected LogCommand<E> |
createDefault(Sequence<E> sequence)
Factory method to create a new default command in case the normal command creation
failed. |
Methods inherited from class dk.rode.thesis.factorymethod.CommandCreator |
---|
equals, getCommand, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ReversibleSequenceCommandCreator()
Method Detail |
---|
protected Command<E> create(Sequence<E> sequence, Sequence.State state) throws Exception
CommandCreator
command
of the
type specified by the token supplied as token
.
The sequence
set as the receiver is supplied
as sequence
.
create
in class SequenceCommandCreator<E>
sequence
- The sequence; never null.state
- The token identifying the type of command to create;
can be null.
CommandCreator.getCommand(Sequence, Object)
.
Exception
- If the creation fails; if so, a default (or null)
command will be returned by getCommand
.CommandCreator.createDefault(Sequence)
protected LogCommand<E> createDefault(Sequence<E> sequence)
CommandCreator
normal
command creation
failed.
createDefault
in class CommandCreator<E,Sequence.State>
sequence
- The sequence; never null.
LogCommand
instance; never null
|
Gunni Rode / rode.dk | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |