- java.lang.Object
-
- io.github.interacto.command.CommandImpl
-
- io.github.interacto.command.AnonCommand
-
- All Implemented Interfaces:
Command
public class AnonCommand extends CommandImpl
An anonymous command that takes an anonymous function as a parameter corresponding to the command to execute. The goal of this command is to avoid the creation of a command class for a small cmd.- Author:
- Arnaud Blouin
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.github.interacto.command.Command
Command.CmdStatus, Command.RegistrationPolicy
-
-
Field Summary
-
Fields inherited from class io.github.interacto.command.CommandImpl
status
-
-
Constructor Summary
Constructors Constructor Description AnonCommand(Runnable cmd)Creates the command.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanDo()Checks whether the command can be executed.protected voiddoCmdBody()This method contains the statements to execute the command.-
Methods inherited from class io.github.interacto.command.CommandImpl
cancel, createMemento, doIt, done, flush, getRegistrationPolicy, getStatus, hadEffect, isDone, toString, unregisteredBy
-
-
-
-
Constructor Detail
-
AnonCommand
public AnonCommand(Runnable cmd)
Creates the command.- Parameters:
cmd- The anonymous command to execute.
-
-
Method Detail
-
canDo
public boolean canDo()
Description copied from interface:CommandChecks whether the command can be executed.- Specified by:
canDoin interfaceCommand- Overrides:
canDoin classCommandImpl- Returns:
- True if the command can be executed.
-
doCmdBody
protected void doCmdBody()
Description copied from class:CommandImplThis method contains the statements to execute the command. This method is automatically called by DoIt and must not be called explicitly.- Specified by:
doCmdBodyin classCommandImpl
-
-