Package pp.battleship.model.dto
Klasse ShipMapDTO
java.lang.Object
pp.battleship.model.dto.ShipMapDTO
A class representing data transfer objects of ship maps for JSON serialization and deserialization.
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungShipMapDTO(ShipMap map) Constructs a ShipMapDTO object from a ShipMap object. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungbooleanfits(GameDetails details) Checks if the current ship map fits the game details provided.getShips()Returns the ships stored in this DTO.static ShipMapDTOLoads a ShipMapDTO from a file containing JSON data.voidSaves the current ShipMapDTO to a file in JSON format.
-
Konstruktordetails
-
ShipMapDTO
Constructs a ShipMapDTO object from a ShipMap object.- Parameter:
map- the ShipMap object to be converted
-
-
Methodendetails
-
fits
Checks if the current ship map fits the game details provided.- Parameter:
details- the game details to be matched against- Gibt zurück:
- true if the ship map fits the game details, false otherwise
-
getShips
Returns the ships stored in this DTO.- Gibt zurück:
- the ships stored in this DTO
-
saveTo
Saves the current ShipMapDTO to a file in JSON format.- Parameter:
file- the file to which the ShipMapDTO will be saved- Löst aus:
IOException- if an I/O error occurs
-
loadFrom
Loads a ShipMapDTO from a file containing JSON data.- Parameter:
file- the file from which the ShipMapDTO will be loaded- Gibt zurück:
- the loaded ShipMapDTO object
- Löst aus:
IOException- if an I/O error occurs or if the JSON is invalid
-