|
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.command.SequenceCommand<E> dk.rode.thesis.command.NextCommand<E>
E
- The type of result obtained by executing this command.
The type corresponds to the type of values delivered by
the receiver sequence.@Participant(value="ConcreteCommand") public class NextCommand<E>
A next command command will invoke next()
on its receiving sequence
when it is
executed
.
Next commands are undoable
if the receiving
sequence is a reversible
and/or a
memorizable
sequence!
Field Summary |
---|
Fields inherited from class dk.rode.thesis.command.SequenceCommand |
---|
result, sequence |
Constructor Summary | |
---|---|
NextCommand(Sequence<E> sequence)
Constructor. |
Method Summary | |
---|---|
NextCommand<E> |
copy()
Creates a copy of this command, excluding internal state information required for execution and undo. |
protected List<Command<E>> |
doExecute(boolean saved)
Sets the result of the execution to the next
sequence value. |
boolean |
isUndoable()
Returns true if this command has been executed and the receiving sequence used by this command is either memorizable and/or reversible . |
E |
undo()
Performs undo of this sequence command if possible. |
Methods inherited from class dk.rode.thesis.command.SequenceCommand |
---|
equals, execute, getResult, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public NextCommand(@Participant(value="Receiver") Sequence<E> sequence)
sequence
- The sequence; cannot be null.
NullPointerException
- If sequence
is null.Method Detail |
---|
public NextCommand<E> copy()
Command
protected List<Command<E>> doExecute(boolean saved)
next
sequence value.
doExecute
in class SequenceCommand<E>
saved
- True if the before state was successfully saved before
this method is invoked, false if not.
processor
currently
executing this command. Can be null or empty.SequenceCommand.execute()
public boolean isUndoable()
memorizable
and/or reversible
.
isUndoable
in interface Command<E>
isUndoable
in class SequenceCommand<E>
public E undo() throws CommandException
SequenceCommand
If this command is not undoable
an
exception will be thrown. If this command cannot be undone
otherwise, null will be returned.
The command result value is cleared.
undo
in interface Command<E>
undo
in class SequenceCommand<E>
CommandException
- In case this command is not undoable.
|
Gunni Rode / rode.dk | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |