java.lang.Object
za.co.wethinkcode.robots.server.persistence.SavedWorld

public class SavedWorld extends Object
Represents an immutable snapshot of a Robot World that can be persisted.

The snapshot contains the complete world configuration, typed world objects, and robot state. Client connections are intentionally excluded.

  • Constructor Details

    • SavedWorld

      public SavedWorld(String name, WorldDimensions dimensions, WorldRules rules, List<SavedWorldObject> objects, List<SavedRobot> robots)
      Creates a fully configured snapshot of a world.
      Parameters:
      name - the logical name used to save and restore the world
      dimensions - the world's dimensions and visibility
      rules - the world's timing and combat rules
      objects - the typed world objects; null is treated as an empty list
      robots - the robot snapshots; null is treated as an empty list
      Throws:
      IllegalArgumentException - if the name is blank
    • SavedWorld

      public SavedWorld(String name, int width, int height, int visibility, List<Position> obstacles)
      Creates a snapshot of a world that only tracks obstacles, using default timing and combat rules.
      Parameters:
      name - the logical name used to save and restore the world
      width - the width of the world
      height - the height of the world
      visibility - the world's visibility distance
      obstacles - the obstacle positions in the world; null is treated as an empty list
      Throws:
      IllegalArgumentException - if the name is blank, either dimension is not positive, or visibility is negative
  • Method Details

    • getName

      public String getName()
    • getWidth

      public int getWidth()
    • getHeight

      public int getHeight()
    • getVisibility

      public int getVisibility()
    • getRepairTime

      public int getRepairTime()
    • getReloadTime

      public int getReloadTime()
    • getMineTime

      public int getMineTime()
    • getMaxShields

      public int getMaxShields()
    • getMaxShots

      public int getMaxShots()
    • getObjects

      public List<SavedWorldObject> getObjects()
    • getRobots

      public List<SavedRobot> getRobots()
    • getObstacles

      public List<Position> getObstacles()
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object