java.lang.Object
za.co.wethinkcode.robots.server.commands.Command
Direct Known Subclasses:
ExternalCommand

public abstract class Command extends Object
Every command follows this same pattern:
  1. It receives a robot name and arguments
  2. It runs against the world
  3. It returns a result string
  • Constructor Details

  • Method Details

    • getRobotName

      public String getRobotName()
      Get the name of the robot that this command is being executed on
      Returns:
      the name of robot
    • executeToString

      public abstract String executeToString(World world)
      Each command must implement this method It does the work and returns a result
    • execute

      public abstract com.google.gson.JsonObject execute(World world)
      Modern a modern OO implementation of the execute method
    • findRobot

      protected Robot findRobot(World world)
      Helper: look up the robot in the world

      Returns null if the robot doesn't exist