Class LaunchCommand
java.lang.Object
za.co.wethinkcode.robots.server.commands.Command
za.co.wethinkcode.robots.server.commands.external.ExternalCommand
za.co.wethinkcode.robots.server.commands.external.LaunchCommand
Standard Launch command. extends
Command-
Constructor Summary
ConstructorsConstructorDescriptionLaunchCommand(com.google.gson.JsonObject json, ClientID id) Overload command constructorLaunchCommand(String robotName, String kindString, int maxShields, int shotDistance) Legacy constructor of the Launch CommandLaunchCommand(String robotName, RobotKind kind) Standard Constructor of the launch command -
Method Summary
Modifier and TypeMethodDescriptioncom.google.gson.JsonObjectModern a modern OO implementation of the execute methodexecuteToString(World world) Each command must implement this method It does the work and returns a resultReturn which client command this command implementsgetUsage()Get the way this command is supposed to be used.Methods inherited from class za.co.wethinkcode.robots.server.commands.external.ExternalCommand
getArgsMethods inherited from class za.co.wethinkcode.robots.server.commands.Command
findRobot, getRobotName
-
Constructor Details
-
LaunchCommand
Legacy constructor of the Launch Command- Parameters:
robotName- The Name of the robot being launchedkindString- theof the robot being launchedmaxShields- the maximum number of shields this robot has.Implicitly linked to
RobotKindshotDistance- the maximum distance of a shot from this robot.Implicitly linked to
RobotKind
-
LaunchCommand
Standard Constructor of the launch command- Parameters:
robotName- the name of the robot being launchedkind- theRobotKindof the robot being launched
-
LaunchCommand
public LaunchCommand(com.google.gson.JsonObject json, ClientID id) throws ClassCastException, UnsupportedOperationException, IllegalStateException Overload command constructor- Parameters:
json- the Json version of the input- Throws:
ClassCastExceptionUnsupportedOperationExceptionIllegalStateException
-
-
Method Details
-
executeToString
Description copied from class:CommandEach command must implement this method It does the work and returns a result- Specified by:
executeToStringin classCommand
-
execute
Modern a modern OO implementation of the execute method -
getCommandName
Return which client command this command implements- Specified by:
getCommandNamein classExternalCommand- Returns:
- the command this child is
-
getUsage
Get the way this command is supposed to be used.- Specified by:
getUsagein classExternalCommand- Returns:
- the string representation of the usage of this command.
-