Package jline.io

Class LineModelIO

java.lang.Object
jline.io.LineModelIO

public class LineModelIO extends Object
Provides save/load functionality for LINE queueing network models to/from JSON format.

Supports both Network (queueing network) and LayeredNetwork (layered queueing network) models. The JSON format follows the line-model.schema.json specification.

Usage:

   // Save a Network model
   LineModelIO.save(model, "mymodel.json");

   // Save a LayeredNetwork model
   LineModelIO.save(lqnModel, "mylqn.json");

   // Load any model
   Object model = LineModelIO.load("mymodel.json");
   if (model instanceof Network) { ... }
   if (model instanceof LayeredNetwork) { ... }
 

  • Constructor Details

    • LineModelIO

      public LineModelIO()
  • Method Details

    • toJsonObject

      public static com.google.gson.JsonObject toJsonObject(Network model)
      Builds a JsonObject representation of a Network model.
      Parameters:
      model - the queueing network model to serialize
      Returns:
      the JSON document representing the model
    • save

      public static void save(Network model, String filename) throws IOException
      Saves a Network model to a JSON file.
      Parameters:
      model - the queueing network model to save
      filename - the output file path (should end with .json)
      Throws:
      IOException - if the file cannot be written
    • toJsonObject

      public static com.google.gson.JsonObject toJsonObject(LayeredNetwork model)
      Builds a JsonObject representation of a LayeredNetwork model.
      Parameters:
      model - the layered queueing network model to serialize
      Returns:
      the JSON document representing the model
    • save

      public static void save(LayeredNetwork model, String filename) throws IOException
      Saves a LayeredNetwork model to a JSON file.
      Parameters:
      model - the layered queueing network model to save
      filename - the output file path (should end with .json)
      Throws:
      IOException - if the file cannot be written
    • save

      public static void save(Workflow model, String filename) throws IOException
      Saves a Workflow model to a JSON file.
      Parameters:
      model - the workflow model to save
      filename - the output file path (should end with .json)
      Throws:
      IOException - if the file cannot be written
    • save

      public static void save(Environment env, String filename) throws IOException
      Saves an Environment model to a JSON file.
      Parameters:
      env - the environment model to save
      filename - the output file path (should end with .json)
      Throws:
      IOException - if the file cannot be written
    • load

      public static Object load(String filename) throws IOException
      Loads a model from a JSON file.
      Parameters:
      filename - the input file path
      Returns:
      a Network or LayeredNetwork depending on the model type
      Throws:
      IOException - if the file cannot be read or the format is invalid