Interface InstructionExecutor<C>
- Type Parameters:
C
- Context—The type of Object which holds information that an implementation needs for actually executing instructions.
- All Known Implementing Classes:
ComplexPanAndZoomInstructionExecutor
,PageSegmentByUUIDInstructionExecutor
,URIInstructionExecutor
public interface InstructionExecutor<C>
Implementations of this interface are able to actually perform that which is described by an
Instruction
. InstructionExecutor
s have the ability to carry out an
Instruction
's aims, applying its key data to given context objects.
At first glance the method signatures resemble those of Command
s. While there are some
similarities, InstructionExecutor
s represent a more general approach that has no
dependencies to Swing or even any GUI concepts.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canExecute
(Instruction instruction, C context) Indicates whether or not this instance is able to execute the givenInstruction
, using the given context object where necessary.void
execute
(Instruction instruction, C context) Perform that which is described by the givenInstruction
.boolean
pertainsTo
(Class<? extends Instruction> clazz) Returns whether or not thisInstructionExecutor
knows how to deal with a given type ofInstruction
.
-
Method Details
-
pertainsTo
Returns whether or not thisInstructionExecutor
knows how to deal with a given type ofInstruction
.- Parameters:
clazz
- the type ofInstruction
for which information is requested- Returns:
true
if thisInstructionExecutor
is able to handleInstruction
s of the given type,false
otherwise.
-
canExecute
Indicates whether or not this instance is able to execute the givenInstruction
, using the given context object where necessary.- Parameters:
instruction
- the instruction in questioncontext
- holds additional, implementation-specific information- Returns:
true
if this instance is able to execute the givenInstruction
using the given context object where necessary;false
otherwise.
-
execute
Perform that which is described by the givenInstruction
.- Parameters:
instruction
- holds the information which specifies what to performcontext
- holds additional, implementation-specific information
-