Class SavedWorld
java.lang.Object
za.co.wethinkcode.robots.server.persistence.SavedWorld
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 Summary
ConstructorsConstructorDescriptionSavedWorld(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.SavedWorld(String name, WorldDimensions dimensions, WorldRules rules, List<SavedWorldObject> objects, List<SavedRobot> robots) Creates a fully configured snapshot of a world. -
Method Summary
-
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 worlddimensions- the world's dimensions and visibilityrules- the world's timing and combat rulesobjects- the typed world objects;nullis treated as an empty listrobots- the robot snapshots;nullis treated as an empty list- Throws:
IllegalArgumentException- if the name is blank
-
SavedWorld
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 worldwidth- the width of the worldheight- the height of the worldvisibility- the world's visibility distanceobstacles- the obstacle positions in the world;nullis treated as an empty list- Throws:
IllegalArgumentException- if the name is blank, either dimension is not positive, or visibility is negative
-
-
Method Details
-
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
-
getRobots
-
getObstacles
-
equals
-
hashCode
public int hashCode()
-