Class Savefile

java.lang.Object
com.csse3200.game.persistence.Savefile

public class Savefile extends Object
Represents a savefile in the game.
  • Constructor Details

    • Savefile

      public Savefile(String name, Long date, int slot)
      Creates a Savefile object with the given name, date, and slot.
      Parameters:
      name - the name of the savefile
      date - the date of the savefile
      slot - the slot of the savefile
  • Method Details

    • fromString

      public static Savefile fromString(String savefileString)
      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

      public String toString()
      Converts the Savefile object to a string representation.
      Overrides:
      toString in class Object
      Returns:
      the string representation of the savefile.
    • getName

      public String getName()
      Get the name of the savefile.
      Returns:
      the name of the savefile.
    • getDate

      public Long 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

      public String getDisplayName()
      Get the name of the savefile to be displayed.
      Returns:
      the name of the savefile.
    • getDisplayDate

      public String getDisplayDate()
      Get the date of the savefile to be displayed.
      Returns:
      the date of the savefile.
    • createName

      public static String createName()
      Creates a unique name for a new savefile.
      Returns:
      a unique name for the savefile.