Class: Application

Application(name, substances, isModification, isCompatible)

Represent an application that contains substances and their properties.

Constructor

new Application(name, substances, isModification, isCompatible)

Create a new Application.
Parameters:
Name Type Description
name string Name of the application.
substances Array.<Substance> Array of substances.
isModification boolean Whether this modifies existing application.
isCompatible boolean Whether application is UI-compatible.
Source:

Methods

deleteSubstance(substanceName)

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

getIsCompatible() → {boolean}

Check if this application is compatible with UI editing.
Source:
Returns:
True if application can be edited in UI.
Type
boolean

getIsModification() → {boolean}

Check if this application modifies an existing one.
Source:
Returns:
True if this modifies an existing application.
Type
boolean

getName() → {string}

Get the name of this application.
Source:
Returns:
The application name.
Type
string

getSubstance(name) → {Substance|null}

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

getSubstances() → {Array.<Substance>}

Get all substances defined in this application.
Source:
Returns:
Array of substances.
Type
Array.<Substance>

insertSubstance(substanceName, newVersion)

Insert or update a substance in this application.
Parameters:
Name Type Description
substanceName string Name of substance to replace, or null for new.
newVersion Substance The substance to insert.
Source:

rename(newName)

Rename this application.
Parameters:
Name Type Description
newName string The new name for the application.
Source:

toCode(spaces) → {string}

Generate the code representation of this application.
Parameters:
Name Type Description
spaces number Number of spaces to use for indentation.
Source:
Returns:
The code representation of the application.
Type
string