Package jline.io
Class LineModelIO
java.lang.Object
jline.io.LineModelIO
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectLoads a model from a JSON file.static voidsave(Environment env, String filename) Saves anEnvironmentmodel to a JSON file.static voidsave(LayeredNetwork model, String filename) Saves aLayeredNetworkmodel to a JSON file.static voidSaves aNetworkmodel to a JSON file.static voidSaves aWorkflowmodel to a JSON file.static com.google.gson.JsonObjecttoJsonObject(LayeredNetwork model) Builds aJsonObjectrepresentation of aLayeredNetworkmodel.static com.google.gson.JsonObjecttoJsonObject(Network model) Builds aJsonObjectrepresentation of aNetworkmodel.
-
Constructor Details
-
LineModelIO
public LineModelIO()
-
-
Method Details
-
toJsonObject
Builds aJsonObjectrepresentation of aNetworkmodel.- Parameters:
model- the queueing network model to serialize- Returns:
- the JSON document representing the model
-
save
Saves aNetworkmodel to a JSON file.- Parameters:
model- the queueing network model to savefilename- the output file path (should end with .json)- Throws:
IOException- if the file cannot be written
-
toJsonObject
Builds aJsonObjectrepresentation of aLayeredNetworkmodel.- Parameters:
model- the layered queueing network model to serialize- Returns:
- the JSON document representing the model
-
save
Saves aLayeredNetworkmodel to a JSON file.- Parameters:
model- the layered queueing network model to savefilename- the output file path (should end with .json)- Throws:
IOException- if the file cannot be written
-
save
Saves aWorkflowmodel to a JSON file.- Parameters:
model- the workflow model to savefilename- the output file path (should end with .json)- Throws:
IOException- if the file cannot be written
-
save
Saves anEnvironmentmodel to a JSON file.- Parameters:
env- the environment model to savefilename- the output file path (should end with .json)- Throws:
IOException- if the file cannot be written
-
load
Loads a model from a JSON file.- Parameters:
filename- the input file path- Returns:
- a
NetworkorLayeredNetworkdepending on the model type - Throws:
IOException- if the file cannot be read or the format is invalid
-