Class MutableWorld

java.lang.Object
za.co.wethinkcode.robots.server.worldinfo.MutableWorld

public class MutableWorld extends Object
The Mutable singleton of the world. This cannot be directly updated. NOTE: THIS METHOD IS BEING DEPRECIATED AND REPLACED BY WorldStateIdentity
  • Constructor Details

    • MutableWorld

      public MutableWorld()
  • Method Details

    • updateObjectPosition

      public void updateObjectPosition(WorldObject worldObject, Position position) throws ObjectNonExistantException
      Update the position of a world object that already exists in the world
      Parameters:
      worldObject - WorldObject that is being updated
      position - Where a world object is going to be moved to
      Throws:
      ObjectNonExistantException - exception that is raised when a queried object doesn't exist in the world
    • addObjectToWorld

      public void addObjectToWorld(WorldObject worldObject, Position position) throws OccupiedSpotException
      Void method to add an instance into the World
      Parameters:
      worldObject - any world object
      position - where that worldObject is
      Throws:
      OccupiedSpotException
    • replaceObjectAtPosition

      public void replaceObjectAtPosition(WorldObject worldObject, Position position)
      Destructively add an object at a position
      Parameters:
      worldObject - the world object being added
      position - where the object is being added
    • addClientToWorld

      public void addClientToWorld(Client client)
      Add a new client connection
      Parameters:
      client - a connected ClientObject
    • getWorldState

      public WorldState getWorldState()
      Retrieve a new WorldState from the mutableWorld
      Returns:
    • getWorldStateIdentity

      public WorldStateIdentity getWorldStateIdentity()
      Mostly a utility method to get an identity in two lines. This needs to be depreciated as soon as possible
      Returns:
      WorldStateIdentity