Package com.csse3200.game.persistence
Class Savefile
java.lang.Object
com.csse3200.game.persistence.Savefile
Represents a savefile in the game.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Creates a unique name for a new savefile.static Savefile
fromString
(String savefileString) Creates a Savefile object from a string representation.getDate()
Get the date of the savefile.Get the date of the savefile to be displayed.Get the name of the savefile to be displayed.getName()
Get the name of the savefile.int
getSlot()
Get the slot number of the savefile.toString()
Converts the Savefile object to a string representation.
-
Constructor Details
-
Savefile
Creates a Savefile object with the given name, date, and slot.- Parameters:
name
- the name of the savefiledate
- the date of the savefileslot
- the slot of the savefile
-
-
Method Details
-
fromString
Creates a Savefile object from a string representation.- Parameters:
savefileString
- the string representation of the savefile- Returns:
- the Savefile object, or null if the string is invalid
-
toString
Converts the Savefile object to a string representation. -
getName
Get the name of the savefile.- Returns:
- the name of the savefile.
-
getDate
Get the date of the savefile.- Returns:
- the date of the savefile.
-
getSlot
public int getSlot()Get the slot number of the savefile.- Returns:
- the slot number of the savefile.
-
getDisplayName
Get the name of the savefile to be displayed.- Returns:
- the name of the savefile.
-
getDisplayDate
Get the date of the savefile to be displayed.- Returns:
- the date of the savefile.
-
createName
Creates a unique name for a new savefile.- Returns:
- a unique name for the savefile.
-