Class: Program

Program(applications, policies, scenarios, isCompatible)

new Program(applications, policies, scenarios, isCompatible)

Create a new Program.
Parameters:
Name Type Description
applications Array.<Application> Array of application definitions.
policies Array.<DefinitionalStanza> Array of policy definitions.
scenarios Array.<SimulationScenario> Array of simulation scenarios.
isCompatible boolean Whether program is compatible with UI editing.
Source:

Methods

addApplication(newApplication)

Add a new application.
Parameters:
Name Type Description
newApplication Application Application to add.
Source:

deleteApplication(name)

Delete an application by name.
Parameters:
Name Type Description
name string Name of application to delete.
Source:

deletePolicy(name, filterUnknownopt)

Delete a policy by name.
Parameters:
Name Type Attributes Default Description
name string Name of policy to delete.
filterUnknown boolean <optional>
true Whether to filter unknown policies.
Source:

deleteScenario(name)

Delete a simulation scenario by name.
Parameters:
Name Type Description
name string Name of scenario to delete.
Source:

deleteSubstance(applicationName, substanceName)

Delete a substance from an application.
Parameters:
Name Type Description
applicationName string Name of application containing substance.
substanceName string Name of substance to delete.
Source:

getApplication(name) → {Application|null}

Gets an application by name.
Parameters:
Name Type Description
name string Name of application to find.
Source:
Returns:
The application or null if not found.
Type
Application | null

getApplications() → {Array.<Application>}

Get all applications.
Source:
Returns:
Array of applications.
Type
Array.<Application>

getIsCompatible() → {boolean}

Gets whether program is compatible with UI editing.
Source:
Returns:
True if compatible, false otherwise.
Type
boolean

getPolicies() → {Array.<DefinitionalStanza>}

Get all policies.
Source:
Returns:
Array of policies.
Type
Array.<DefinitionalStanza>

getPolicy(name) → {DefinitionalStanza|null}

Get a policy by name.
Parameters:
Name Type Description
name string Name of policy to find.
Source:
Returns:
The policy or null if not found.
Type
DefinitionalStanza | null

getScenario(name) → {SimulationScenario|null}

Get a simulation scenario by name.
Parameters:
Name Type Description
name string Name of scenario to find.
Source:
Returns:
The scenario or null if not found.
Type
SimulationScenario | null

getScenarioNames() → {Array.<string>}

Get the names of all simulation scenarios. Convenience method to extract just the scenario names without needing to access full SimulationScenario objects. Filters out IncompatibleCommand objects (e.g., from "across X trials" syntax).
Source:
Returns:
Array of scenario names in order they appear.
Type
Array.<string>

getScenarios() → {Array.<SimulationScenario>}

Get all simulation scenarios.
Source:
Returns:
Array of scenarios.
Type
Array.<SimulationScenario>

getSubstances() → {Array.<Substance>}

Get all substances across all applications.
Source:
Returns:
Array of all substances.
Type
Array.<Substance>

insertPolicy(oldName, newPolicy)

Insert or update a policy.
Parameters:
Name Type Description
oldName string Name of policy to replace, or null for new.
newPolicy DefinitionalStanza Policy to insert.
Source:

insertScenario(oldName, scenario)

Insert or update a simulation scenario.
Parameters:
Name Type Description
oldName string Name of scenario to replace, or null for new.
scenario SimulationScenario Scenario to insert.
Source:

insertSubstance(priorApplication, newApplication, priorSubstanceName, substance)

Insert or updates a substance in an application.
Parameters:
Name Type Description
priorApplication string Name of application to remove from or null if no prior.
newApplication string Name of application to insert into.
priorSubstanceName string Name of substance to replace. Pass null for new.
substance Substance The substance to insert.
Source:

renameApplication(oldName, newName)

Rename an application.
Parameters:
Name Type Description
oldName string Current name of application.
newName string New name for application.
Source:

renameSubstanceInApplication(applicationName, oldSubstanceName, newSubstanceName)

Rename a substance within a specific application.
Parameters:
Name Type Description
applicationName string Name of the application containing the substance.
oldSubstanceName string Current name of the substance.
newSubstanceName string New name for the substance.
Source:

toCode(spaces) → {string}

Generates the code representation of the program with the specified indentation.
Parameters:
Name Type Description
spaces number Number of spaces to use for indenting the generated code.
Source:
Returns:
The code representation of the program with specified indentation.
Type
string