Class AutomataSaver

java.lang.Object
it.univr.wordautomata.backend.AutomataSaver

public class AutomataSaver extends Object
The AutomataSaver class provides methods for saving and reading automata objects to/from files, as well as managing recent files and file dialogs.
  • Method Details

    • save

      public static void save(File file, boolean debug)
      Saves the automata to a file.
      Parameters:
      file - the file to save the automata to
    • read

      public static com.brunomnsilva.smartgraph.graph.DigraphEdgeList<State,Transition> read(File file, boolean debug)
      Reads a DigraphEdgeList from a file.
      Parameters:
      file - the file to read the DigraphEdgeList from
      Returns:
      the DigraphEdgeList read from the file
    • getTmpFolder

      public static File getTmpFolder() throws IOException
      Returns the temporary folder used by the application. If the folder doesn't exist, it creates a new one. Also, if the recent files file doesn't exist, it creates a new one.
      Returns:
      the temporary folder used by the application
      Throws:
      IOException - if an I/O error occurs while creating the folder or file
    • getRecentFiles

      public static List<File> getRecentFiles()
      Retrieves a list of recent files.
      Returns:
      A list of recently accessed files.
    • recordRecentFile

      public static void recordRecentFile(File file)
      Records the given file as a recent file in the application. If the file already exists in the recent files list, it is removed and added to the top. If the number of recent files exceeds the maximum limit, the oldest file is removed.
      Parameters:
      file - the file to be recorded as a recent file
    • clearRecentFiles

      public static void clearRecentFiles()
      Clears the list of recent files. This method deletes the file that stores the list of recent files. If the file does not exist or cannot be deleted, an IOException is thrown.
    • save

      public static void save()
      Saves the currently opened file.
    • read

      public static com.brunomnsilva.smartgraph.graph.DigraphEdgeList<State,Transition> read()
      Reads a DigraphEdgeList from a file.
      Returns:
      the DigraphEdgeList read from the file
    • showOpenDialog

      public static File showOpenDialog()
      Represents a file in the file system.
    • showSaveDialog

      public static File showSaveDialog()
      Represents a file in the file system.