Interface Stateful
- All Known Implementing Classes:
BackCommand,FireCommand,ForwardCommand,MineCommand,ReloadCommand,RepairCommand,TurnCommand
public interface Stateful
Commands that implement the stateful interface manipulate the state of the world and the robots in it
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidpurgeCheck(World world, String robotName) default StatusVerify if a command is able to be executed given the current state of the robot.static StatusverifyInternal(World world, com.google.gson.JsonObject obj) static StatusverifyInternal(World world, String robotName) Static internal method that allows this to be called statically if needed
-
Method Details
-
verify
default Status verify(World world, String robotName) throws RobotCannotActException, PurgedRobotException, NoSuchRobotException Verify if a command is able to be executed given the current state of the robot. THIS METHOD INDUCES THE SIDE EFFECT OF CHANGING THEStatusOF THE ROBOT, updating it'sStatusif needed.- Parameters:
world- the world that this command is being verified against.- Returns:
- the status of the robot executing the command.
- Throws:
RobotCannotActExceptionPurgedRobotExceptionNoSuchRobotException
-
verifyInternal
static Status verifyInternal(World world, String robotName) throws RobotCannotActException, PurgedRobotException, NoSuchRobotException Static internal method that allows this to be called statically if needed- Parameters:
world- the world that this command is being verified against.- Returns:
- the status of the robot executing the command.
- Throws:
RobotCannotActExceptionPurgedRobotExceptionNoSuchRobotException
-
purgeCheck
- Throws:
PurgedRobotException
-
verifyInternal
static Status verifyInternal(World world, com.google.gson.JsonObject obj) throws RobotCannotActException, PurgedRobotException, NoSuchRobotException
-