Package jline.io

Class LDESResultIO

java.lang.Object
jline.io.LDESResultIO

public class LDESResultIO extends Object
Provides save/load functionality for LDES solver results to/from JSON format.

Serializes LDESResult (and base SolverResult) fields to a JSON file that can be parsed by the Python wrapper or other tools without needing JVM access.

Usage:

   // Save result
   LDESResultIO.save(result, sn, "result.json");

   // Load result
   LDESResult result = LDESResultIO.load("result.json");
 

  • Constructor Details

    • LDESResultIO

      public LDESResultIO()
  • Method Details

    • save

      public static void save(LDESResult result, NetworkStruct sn, String filename) throws IOException
      Saves an LDESResult and associated NetworkStruct to a JSON file.
      Parameters:
      result - the LDES solver result
      sn - the network structure (for station/class names)
      filename - the output file path
      Throws:
      IOException - if the file cannot be written
    • save

      public static void save(LDESResult result, NetworkStruct sn, String filename, boolean trajectory) throws IOException
      Saves an LDESResult and associated NetworkStruct to a JSON file.
      Parameters:
      result - the LDES solver result
      sn - the network structure (for station/class names)
      filename - the output file path
      trajectory - if true, include transient trajectory data (QNt, UNt, TNt, t)
      Throws:
      IOException - if the file cannot be written
    • load

      public static LDESResult load(String filename) throws IOException
      Loads an LDESResult from a JSON file.
      Parameters:
      filename - the input file path
      Returns:
      the deserialized LDESResult
      Throws:
      IOException - if the file cannot be read or the format is invalid
    • loadStationNames

      public static List<String> loadStationNames(String filename) throws IOException
      Returns station names from a result JSON file, or null if unavailable.
      Parameters:
      filename - the result JSON file path
      Returns:
      list of station names
      Throws:
      IOException - if the file cannot be read
    • loadClassNames

      public static List<String> loadClassNames(String filename) throws IOException
      Returns class names from a result JSON file, or null if unavailable.
      Parameters:
      filename - the result JSON file path
      Returns:
      list of class names
      Throws:
      IOException - if the file cannot be read