Class CSVManager

java.lang.Object
real_time_traffic_simulation_with_java.tools.CSVManager

public class CSVManager extends Object
Manages CSV log files for the traffic simulation. It creates a new CSV file with a timestamped name upon instantiation (format: YYYY-MM-DD HH_MM_SS).
  • Constructor Details

    • CSVManager

      public CSVManager()
      Manages CSV log files for the traffic simulation. It creates a new CSV file with a timestamped name upon instantiation (format: YYYY-MM-DD HH_MM_SS).
  • Method Details

    • getFilePath

      public String getFilePath()
      Getter to retrieve the file path of the CSV log
    • getTimeStamp

      public String getTimeStamp()
      Getter to retrieve the timestamp used in the CSV file name
    • updateCSV

      public void updateCSV(List<String[]> data)
      Appends new rows of data to the CSV file.
      Parameters:
      data - A list of string arrays representing the data rows to be added.
      Throws:
      IllegalArgumentException - if the length of any data row does not match the number of headers.
    • closeCSV

      public void closeCSV()
      Closes the CSV writer to release file resources. Currently Beta testing