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. InstructionExecutors 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 Commands. While there are some
similarities, InstructionExecutors represent a more general approach that has no
dependencies to Swing or even any GUI concepts.
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanExecute(Instruction instruction, C context) Indicates whether or not this instance is able to execute the givenInstruction, using the given context object where necessary.voidexecute(Instruction instruction, C context) Perform that which is described by the givenInstruction.booleanpertainsTo(Class<? extends Instruction> clazz) Returns whether or not thisInstructionExecutorknows how to deal with a given type ofInstruction.
-
Method Details
-
pertainsTo
Returns whether or not thisInstructionExecutorknows how to deal with a given type ofInstruction.- Parameters:
clazz- the type ofInstructionfor which information is requested- Returns:
trueif thisInstructionExecutoris able to handleInstructions of the given type,falseotherwise.
-
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:
trueif this instance is able to execute the givenInstructionusing the given context object where necessary;falseotherwise.
-
execute
Perform that which is described by the givenInstruction.- Parameters:
instruction- holds the information which specifies what to performcontext- holds additional, implementation-specific information
-