Constructor
new SubstanceBuilder(name, isModification)
Create a new SubstanceBuilder.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | Name of the substance. |
isModification |
boolean | Whether this modifies an existing substance. |
- Source:
Methods
addChange(newVal)
Add a change command.
Parameters:
| Name | Type | Description |
|---|---|---|
newVal |
Command | Change command to add. |
- Source:
addCommand(command) → {Command|IncompatibleCommand}
Add a command to the substance being built.
Parameters:
| Name | Type | Description |
|---|---|---|
command |
Command | The command to add. |
- Source:
Returns:
The added command or incompatibility marker.
- Type
- Command | IncompatibleCommand
addEnable(enable)
Add an enable command to this substance.
Parameters:
| Name | Type | Description |
|---|---|---|
enable |
Command | The enable command to add. |
- Source:
addInitialCharge(newVal)
Add an initial charge command.
Parameters:
| Name | Type | Description |
|---|---|---|
newVal |
Command | Initial charge command to add. |
- Source:
addLimit(newVal)
Add a limit command.
Parameters:
| Name | Type | Description |
|---|---|---|
newVal |
LimitCommand | Limit command to add. |
- Source:
addRecharge(newVal)
Add a recharge command.
Parameters:
| Name | Type | Description |
|---|---|---|
newVal |
Command | Recharge command to add. |
- Source:
addRecycle(newVal)
Add a recycle command.
Parameters:
| Name | Type | Description |
|---|---|---|
newVal |
Command | Recycle command to add. |
- Source:
addReplace(newVal)
Add a replace command.
Parameters:
| Name | Type | Description |
|---|---|---|
newVal |
ReplaceCommand | Replace command to add. |
- Source:
addSetVal(newVal)
Add a set value command.
Parameters:
| Name | Type | Description |
|---|---|---|
newVal |
Command | Set value command to add. |
- Source:
build(isCompatibleRaw) → {Substance}
Build a new Substance from the current state.
Parameters:
| Name | Type | Description |
|---|---|---|
isCompatibleRaw |
boolean | Whether substance should be UI-compatible. |
- Source:
Returns:
The constructed substance.
- Type
- Substance
setAssumeMode(mode)
Set the sales assumption mode for this substance.
Parameters:
| Name | Type | Description |
|---|---|---|
mode |
string | null | The assumption mode: "continued", "only recharge", "no", or null. |
- Source:
setEqualsGhg(newVal) → {Command|IncompatibleCommand}
Set the equals command.
Parameters:
| Name | Type | Description |
|---|---|---|
newVal |
Command | Equals command to set. |
- Source:
Returns:
The command or incompatibility marker.
- Type
- Command | IncompatibleCommand
setEqualsKwh(newVal) → {Command|IncompatibleCommand}
Set the energy consumption equals command.
Parameters:
| Name | Type | Description |
|---|---|---|
newVal |
Command | Energy equals command to set. |
- Source:
Returns:
The command or incompatibility marker.
- Type
- Command | IncompatibleCommand
setIsCompatible(isCompatible)
Override the compatibility flag for this substance.
Parameters:
| Name | Type | Description |
|---|---|---|
isCompatible |
boolean | Whether the substance is UI-compatible. |
- Source:
setName(newVal)
Set the name of the substance.
Parameters:
| Name | Type | Description |
|---|---|---|
newVal |
string | New name for the substance. |
- Source:
setRetire(newVal) → {Command|IncompatibleCommand}
Set the retire command.
Parameters:
| Name | Type | Description |
|---|---|---|
newVal |
Command | Retire command to set. |
- Source:
Returns:
The command or incompatibility marker.
- Type
- Command | IncompatibleCommand