java.lang.Object
com.github.freddyyj.randomtrainsimworld.config.SaveLoco

public class SaveLoco
extends Object
Class for managing savefile. Don't create this object. Use Main.setSaveFilePath(String) or Main.saveAs(String) instead.
  • Constructor Details

  • Method Details

    • hasSavefile

      public boolean hasSavefile()
    • reload

      public void reload() throws FileNotFoundException
      Reload savefile.
      Throws:
      FileNotFoundException
    • setFilePath

      public void setFilePath​(String path)
      Set savefile path.
      Parameters:
      path - file path
    • getRoute

      public ArrayList<String> getRoute()
      Get route list that unselected.
      Returns:
      unselected route list
    • getLocomotive

      public ArrayList<String> getLocomotive​(String route)
      Get locomotive list that unselected.
      Returns:
      unselected locomotive list
    • getWeather

      public ArrayList<String> getWeather()
      Get weather list that unselected.
      Returns:
      unselected weather list
    • addRoute

      public void addRoute​(String route)
      Add route to savefile.

      This route must be unselected.

      Parameters:
      route - unselected route name
    • addLocomotive

      public void addLocomotive​(String route, String loco)
      Add locomotive to route.

      Locomotive must be unselected.

      Parameters:
      route - route of locomotive
      loco - locomotive name
    • addWeather

      public void addWeather​(String weather)
      Add weather to savefile.

      Weather must be unselected.

      Parameters:
      weather - weather name
    • removeRoute

      public void removeRoute​(String route)
      Remove route from savefile.

      Route must be selected.

      Parameters:
      route - route name
    • removeLocomotive

      public void removeLocomotive​(String route, String loco)
      Remove locomotive from route.

      Locomotive must be selected.

      Parameters:
      route - route of locomotive
      loco - locomotive name
    • removeWeather

      public void removeWeather​(String weather)
      Remove weather from savefile.

      Weather must be selected.

      Parameters:
      weather - weather name
    • save

      public void save() throws IOException
      Save savefile.
      Throws:
      IOException
    • save

      public void save​(File file) throws IOException
      Save savefile at specific File.
      Parameters:
      file - savefile file
      Throws:
      IOException
    • isChanged

      public boolean isChanged()