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 Details

    • pertainsTo

      boolean pertainsTo(Class<? extends Instruction> clazz)
      Returns whether or not this InstructionExecutor knows how to deal with a given type of Instruction.
      Parameters:
      clazz - the type of Instruction for which information is requested
      Returns:
      true if this InstructionExecutor is able to handle Instructions of the given type, false otherwise.
    • canExecute

      boolean canExecute(Instruction instruction, C context)
      Indicates whether or not this instance is able to execute the given Instruction, using the given context object where necessary.
      Parameters:
      instruction - the instruction in question
      context - holds additional, implementation-specific information
      Returns:
      true if this instance is able to execute the given Instruction using the given context object where necessary; false otherwise.
    • execute

      void execute(Instruction instruction, C context)
      Perform that which is described by the given Instruction.
      Parameters:
      instruction - holds the information which specifies what to perform
      context - holds additional, implementation-specific information