Class LightModel
LightModel provides a state machine model for maintaining and modifying the state of a light,
which is intended to be used within the Thing Handler of a lighting binding.
It supports lights with different capabilities, including:
- On/Off only
- On/Off with Brightness
- On/Off with Brightness and Color Temperature
- On/Off with Brightness and Color (HSB, RGB, or CIE XY)
- On/Off with Brightness, Color Temperature, and Color
See also ColorUtil for other color conversions.
To use the model you must initialize the lightCapabilities during initialization as follows:
- ON_OFF: if the light is on-off only.
- BRIGHTNESS: if the light is on-off with brightness.
- BRIGHTNESS_WITH_COLOR_TEMPERATURE: if the light is on-off with color temperature control.
- COLOR: if the light is on-off with brightness and full color control.
- COLOR_WITH_COLOR_TEMPERATURE: if the light is on-off with brightness, full color, and color temperature control.
rgbDataType to the chosen RGB data type RGB, RGBW, RGBCW etc.
And optionally set the following configuration parameters:
- Optionally override
minimumOnBrightnessto a minimum brightness percent in the range [0.1..10.0] percent, to consider as being "ON". The default is 1 percent. - Optionally override
mirekControlWarmestto a 'warmest' white color temperature in the range [mirekControlCoolest..1000.0] Mirek/Mired. The default is 500 Mirek/Mired. - Optionally override
mirekControlCoolestto a 'coolest' white color temperature in the range [100.0..mirekControlWarmest] Mirek/Mired. The default is 153 Mirek/Mired. - Optionally override
stepSizeto a step size for the IncreaseDecreaseType commands in the range [1.0..50.0] percent. The default is 10.0 percent.
The model specifically handles the following "exotic" cases:
- It handles inter relationships between the brightness PercentType state, the 'B' part of the HSBType state, and
the OnOffType state. Where if the brightness goes below the configured
minimumOnBrightnesslevel the on/off state changes from ON to OFF, and the brightness is clamped to 0%. And analogously if the on/off state changes from OFF to ON, the brightness changes from 0% to its last non zero value. - It handles IncreaseDecreaseType commands to change the brightness up or down by the configured
stepSize, and ensures that the brightness is clamped in the range [0%..100%]. - It handles both color temperature PercentType states and QuantityType states (which may be either in Mirek/Mired
or Kelvin). Where color temperature PercentType values are internally converted to Mirek/Mired values on the
percentage scale between the configured
mirekControlCoolestandmirekControlWarmestMirek/Mired values, and vice versa. - When the color temperature changes then the HS values are adapted to match the corresponding color temperature point on the Planckian Locus in the CIE color chart.
- It handles input/output values in RGB format in the range [0..255]. The behavior depends on the
rgbDataTypesetting. IfrgbDataTypeis DEFAULT the RGB values read/write all three parts of the HSBType state. Whereas if it isrgbDataTypeis RGB_NO_BRIGHTNESS the RGB values read/write only the 'HS' parts. NOTE: in the latter case, a 'setRGBx()' call followed by a 'getRGBx()' call do not necessarily return the same values, since the values are normalized to 100%. Nevertheless the ratios between the RGB values do remain unchanged. - If
rgbDataTypeis RGB_W it handles values in RGBW format. The behavior is similar to the RGB case above except that the white channel is derived from the lowest of the RGB values. - If
rgbDataTypeis RGB_C_W it handles values in RGBCW format. The behavior is similar to the RGBW case above except that the white channel is derived from the RGB values by a custom algorithm.
A typical use case is within in a ThingHandler as follows:
public class LightModelHandler extends BaseThingHandler {
// initialize the light model with default capabilities and parameters
private final LightModel model = new LightModel();
@Override
public void initialize() {
// Set up the light state machine capabilities.
model.configSetLightCapabilities(LightCapabilities.COLOR_WITH_COLOR_TEMPERATURE);
// Optionally: set up the light state machine configuration parameters.
// These would typically be read from the thing configuration or read from the remote device.
model.configSetRgbDataType(RgbDataType.RGB_NO_BRIGHTNESS); // RGB data type
model.configSetMinimumOnBrightness(2); // minimum brightness level when on 2%
model.configSetIncreaseDecreaseStep(10); // step size for increase/decrease commands
model.configSetMirekControlCoolest(153); // color temperature control range
model.configSetMirekControlWarmest(500); // color temperature control range
// Optionally: if the light has warm and cool white LEDS then set up their LED color temperatures.
// These would typically be read from the thing configuration or read from the remote device.
model.configSetMirekCoolWhiteLED(153);
model.configSetMirekWarmWhiteLED(500);
// now set the status to UNKNOWN to indicate that we are initialized
updateStatus(ThingStatus.UNKNOWN);
}
@Override
public void handleCommand(ChannelUID channelUID, Command command) {
// update the model state based on a command from OpenHAB
model.handleCommand(command);
// or if it is a color temperature command
model.handleColorTemperatureCommand(command);
sendBindingSpecificCommandToUpdateRemoteLight(
.. model.getOnOff() or
.. model.getBrightness() or
.. model.getColor() or
.. model.getColorTemperature() or
.. model.getColorTemperaturePercent() or
.. model.getRGBx() or
.. model.getXY() or
);
}
// method that sends the updated state data to the remote light
private void sendBindingSpecificCommandToUpdateRemoteLight(..) {
// binding specific code
}
// method that receives data from remote light, and updates the model, and then OH
private void receiveBindingSpecificDataFromRemoteLight(double... receivedData) {
// update the model state based on the data received from the remote
model.setBrightness(receivedData[0]);
model.setRGBx(receivedData[1], receivedData[2], receivedData[3]);
model.setMirek(receivedData[4]);
// update the OH channels with the new state values
updateState(onOffChannelUID, model.getOnOff());
updateState(brightnessChannelUID, model.getBrightness());
updateState(colorChannelUID, model.getColor());
updateState(colorTemperatureChannelUID, model.getColorTemperature());
}
}
DEVELOPER NOTE:
This is a HERMETIC class that represents the complete state of a light. The state consists in the entirety of all the fields within a class instance. In other words, if any one field changes, then the entire state changes. Therefore all public methods MUST be (and indeed are) synchronized to prevent read/write of "half- ready" states.
- Author:
- Andrew Fiddian-Green - Initial contribution
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum for the LED operating modestatic enumEnum for the capabilities of different types of lightsstatic classInternal: a class containing mathematical utility methods that convert between RGB and RGBCW color arrays based on the RGB main values and the RGB sub- component values of the cool and warm white LEDs.static enumEnum for the different types of RGB dataprotected static classInternal: a class that models the RGB LED sub-components of a white LED light. -
Constructor Summary
ConstructorsConstructorDescriptionCreate aLightModelwith default capabilities and parameters as follows:lightCapabilitiesis COLOR_WITH_COLOR_TEMPERATURE (the light supports brightness control, color control, and color temperature control)rgbDataTypeis DEFAULT (the light supports plain RGB)minimumOnBrightnessis 1.0 (the minimum brightness percent to consider as light "ON")mirekControlCoolestis 153 (the 'coolest' white color temperature)mirekControlWarmestis 500 (the 'warmest' white color temperature)stepSizeis 10.0 (the step size for IncreaseDecreaseType commands) coolWhiteLedMirek is 153 Mirek/Mired (the color temperature of the cool white LED) warmWhiteLedMirek is 500 Mirek/Mired (the color temperature of the warm white LED)LightModel(LightModel.LightCapabilities lightCapabilities, LightModel.RgbDataType rgbDataType) Create aLightModelwith the given capabilities.LightModel(LightModel.LightCapabilities lightCapabilities, LightModel.RgbDataType rgbDataType, @Nullable Double minimumOnBrightness, @Nullable Double mirekControlCoolest, @Nullable Double mirekControlWarmest, @Nullable Double stepSize, @Nullable Double coolWhiteLedMirek, @Nullable Double warmWhiteLedMirek) Create aLightModelwith the given capabilities and parameters. -
Method Summary
Modifier and TypeMethodDescriptiondoubleConfiguration: get the step size for IncreaseDecreaseType commands.Configuration: get the light capabilities.doubleConfiguration: get the minimum brightness percent to consider as light "ON".doubleConfiguration: get the coolest color temperature in Mirek/Mired.doubleConfiguration: get the warmest color temperature in Mirek/Mired.doubleConfiguration: get the color temperature of the cool white LED in Mirek/Mired.doubleConfiguration: get the color temperature of the warm white LED in Mirek/Mired.Configuration: get the supported RGB data type.voidconfigSetIncreaseDecreaseStep(double stepSize) Configuration: set the step size for IncreaseDecreaseType commands.voidconfigSetLightCapabilities(LightModel.LightCapabilities lightCapabilities) Configuration: set the light capabilities.voidconfigSetMinimumOnBrightness(double minimumOnBrightness) Configuration: set the minimum brightness percent to consider as light "ON".voidconfigSetMirekControlCoolest(double mirekControlCoolest) Configuration: set the coolest color temperature in Mirek/Mired.voidconfigSetMirekControlWarmest(double mirekControlWarmest) Configuration: set the warmest color temperature in Mirek/Mired.voidconfigSetMirekCoolWhiteLED(double coolLedMirek) Configuration: set the color temperature of the cool white LED, and thus set the weightings of its individual RGB sub- components.voidconfigSetMirekWarmWhiteLED(double warmLedMirek) Configuration: set the color temperature of the warm white LED, and thus set the weightings of its individual RGB sub- components.voidConfiguration: set the supported RGB type.copy()Runtime State: create and return a copy of this LightModel.@Nullable PercentTypeRuntime State: get the brightness or return null if the capability is not supported.@Nullable PercentTypegetBrightness(boolean forceChannelVisible) Runtime State: get the brightness or return null if the capability is not supported.@Nullable HSBTypegetColor()Runtime State: get the color or return null if the capability is not supported.@Nullable QuantityType<?> Runtime State: get the color temperature or return null if the capability is not supported.@Nullable PercentTypeRuntime State: get the color temperature in percent or return null if the capability is not supported or the Mirek/Mired value is not known.getHsb()Runtime State: get the HSBType color.doublegetHue()Runtime State: get the hue in range [0..360].doublegetMirek()Runtime State: get the color temperature in Mirek/Mired, may be NaN if not known.@Nullable OnOffTypegetOnOff()Runtime State: get the on/off state or null if not supported.@Nullable OnOffTypegetOnOff(boolean forceChannelVisible) Runtime State: get the on/off state or null if not supported.double[]getRGBx()Runtime State: get the RGB(C)(W) values as an array of doubles in range [0..255].doubleRuntime State: get the saturation in range [0..100].double[]getXY()Runtime State: get the CIE XY values as an array of doubles in range [0.0..1.0].voidhandleColorTemperatureCommand(Command command) Runtime State: handle a command to change the light's color temperature state.voidhandleCommand(Command command) Runtime State: handle a command to change the light's state.voidsetBrightness(double brightness) Runtime State: update the brightness from the remote light, ensuring it is in the range [0.0..100.0]voidRuntime State: update the color from the remote lightvoidsetHue(double hue) Runtime State: update the hue from the remote light, ensuring it is in the range [0.0..360.0]voidsetLedOperatingMode(LightModel.LedOperatingMode newOperatingMode) Runtime State: Set the current LED operating mode.voidsetMirek(double mirek) Runtime State: update the Mirek/Mired color temperature from the remote light, and update the cached HSB color accordingly.voidsetOnOff(boolean on) Runtime State: update the on/off state from the remote light.voidsetRGBx(double[] rgbxParameter) Runtime State: update the color with RGB(C)(W) fields from the remote light, and update the cached HSB color accordingly.voidsetSaturation(double saturation) Runtime State: update the saturation from the remote light, ensuring it is in the range [0.0..100.0]voidsetXY(double x, double y) Runtime State: update the color with CIE XY fields from the remote light, and update the cached HSB color accordingly.static StateRuntime State: convert a nullable State to a non-null State, usingUnDefType.UNDEF if the input is null.
-
Constructor Details
-
LightModel
public LightModel()Create aLightModelwith default capabilities and parameters as follows:lightCapabilitiesis COLOR_WITH_COLOR_TEMPERATURE (the light supports brightness control, color control, and color temperature control)rgbDataTypeis DEFAULT (the light supports plain RGB)minimumOnBrightnessis 1.0 (the minimum brightness percent to consider as light "ON")mirekControlCoolestis 153 (the 'coolest' white color temperature)mirekControlWarmestis 500 (the 'warmest' white color temperature)stepSizeis 10.0 (the step size for IncreaseDecreaseType commands)- coolWhiteLedMirek is 153 Mirek/Mired (the color temperature of the cool white LED)
- warmWhiteLedMirek is 500 Mirek/Mired (the color temperature of the warm white LED)
-
LightModel
public LightModel(LightModel.LightCapabilities lightCapabilities, LightModel.RgbDataType rgbDataType) Create aLightModelwith the given capabilities. The parameters are set to the default.- Parameters:
lightCapabilities- the capabilities of the lightrgbDataType- the type of RGB data used
-
LightModel
public LightModel(LightModel.LightCapabilities lightCapabilities, LightModel.RgbDataType rgbDataType, @Nullable Double minimumOnBrightness, @Nullable Double mirekControlCoolest, @Nullable Double mirekControlWarmest, @Nullable Double stepSize, @Nullable Double coolWhiteLedMirek, @Nullable Double warmWhiteLedMirek) throws IllegalArgumentException Create aLightModelwith the given capabilities and parameters. The parameters can be null to use the default.- Parameters:
lightCapabilities- the capabilities of the lightrgbDataType- the type of RGB data supportedminimumOnBrightness- the minimum brightness percent to consider as light "ON"mirekControlCoolest- the 'coolest' white color temperature control value in Mirek/MiredmirekControlWarmest- the 'warmest' white color temperature control value in Mirek/MiredstepSize- the step size for IncreaseDecreaseType commandscoolWhiteLedMirek- the color temperature of the cool white LEDwarmWhiteLedMirek- the color temperature of the warm white LED- Throws:
IllegalArgumentException- if any of the parameters are out of range
-
-
Method Details
-
configGetIncreaseDecreaseStep
public double configGetIncreaseDecreaseStep()Configuration: get the step size for IncreaseDecreaseType commands. -
configGetLightCapabilities
Configuration: get the light capabilities. -
configGetMinimumOnBrightness
public double configGetMinimumOnBrightness()Configuration: get the minimum brightness percent to consider as light "ON". -
configGetMirekControlCoolest
public double configGetMirekControlCoolest()Configuration: get the coolest color temperature in Mirek/Mired. -
configGetMirekCoolWhiteLed
public double configGetMirekCoolWhiteLed()Configuration: get the color temperature of the cool white LED in Mirek/Mired.- Returns:
- the color temperature of the cool white LED.
-
configGetMirekControlWarmest
public double configGetMirekControlWarmest()Configuration: get the warmest color temperature in Mirek/Mired. -
configGetMirekWarmWhiteLed
public double configGetMirekWarmWhiteLed()Configuration: get the color temperature of the warm white LED in Mirek/Mired.- Returns:
- the color temperature of the warm white LED.
-
configGetRgbDataType
Configuration: get the supported RGB data type. -
configSetIncreaseDecreaseStep
Configuration: set the step size for IncreaseDecreaseType commands.- Parameters:
stepSize- the step size in percent.- Throws:
IllegalArgumentException- if the stepSize parameter is out of range.
-
configSetLightCapabilities
Configuration: set the light capabilities. -
configSetMinimumOnBrightness
public void configSetMinimumOnBrightness(double minimumOnBrightness) throws IllegalArgumentException Configuration: set the minimum brightness percent to consider as light "ON".- Parameters:
minimumOnBrightness- the minimum brightness percent.- Throws:
IllegalArgumentException- if the minimumBrightness parameter is out of range.
-
configSetMirekControlCoolest
public void configSetMirekControlCoolest(double mirekControlCoolest) throws IllegalArgumentException Configuration: set the coolest color temperature in Mirek/Mired.- Parameters:
mirekControlCoolest- the coolest supported color temperature in Mirek/Mired.- Throws:
IllegalArgumentException- if the mirekControlCoolest parameter is out of range or not less than mirekControlWarmest.
-
configSetMirekControlWarmest
public void configSetMirekControlWarmest(double mirekControlWarmest) throws IllegalArgumentException Configuration: set the warmest color temperature in Mirek/Mired.- Parameters:
mirekControlWarmest- the warmest supported color temperature in Mirek/Mired.- Throws:
IllegalArgumentException- if the mirekControlWarmest parameter is out of range or not greater than mirekControlCoolest.
-
configSetMirekCoolWhiteLED
Configuration: set the color temperature of the cool white LED, and thus set the weightings of its individual RGB sub- components.NOTE: If the light has a single white LED then both the 'configSetMirekCoolWhiteLED()' and the 'configSetMirekControlWarmest()' methods MUST be called with the identical color temperature.
- Parameters:
coolLedMirek- the color temperature in Mirek/Mired of the cool white LED.- Throws:
IllegalArgumentException- if the coolLedMirek parameter is out of range.
-
configSetMirekWarmWhiteLED
public void configSetMirekWarmWhiteLED(double warmLedMirek) Configuration: set the color temperature of the warm white LED, and thus set the weightings of its individual RGB sub- components.NOTE: If the light has a single white LED then both the 'configSetMirekCoolWhiteLED()' and the 'configSetMirekControlWarmest()' methods MUST be called with the identical color temperature.
- Parameters:
warmLedMirek- the color temperature in Mirek/Mired of the warm white LED.
-
configSetRgbDataType
Configuration: set the supported RGB type.- Parameters:
rgbType- the supported RGB type.
-
getBrightness
Runtime State: get the brightness or return null if the capability is not supported.- Returns:
- PercentType, or null if not supported.
-
getBrightness
Runtime State: get the brightness or return null if the capability is not supported.- Parameters:
forceChannelVisible- if true return a non-null value even when color is supported.- Returns:
- PercentType, or null if not supported.
-
getColor
Runtime State: get the color or return null if the capability is not supported.- Returns:
- HSBType, or null if not supported.
-
getColorTemperature
Runtime State: get the color temperature or return null if the capability is not supported. or the Mirek/Mired value is not known.- Returns:
- QuantityType in Kelvin representing the color temperature, or null if not supported or the Mirek/Mired value is not known.
-
getColorTemperaturePercent
Runtime State: get the color temperature in percent or return null if the capability is not supported or the Mirek/Mired value is not known.- Returns:
- PercentType in range [0..100] representing [coolest..warmest], or null if not supported or the Mirek/Mired value is not known.
-
getHue
public double getHue()Runtime State: get the hue in range [0..360].- Returns:
- double representing the hue in range [0..360].
-
getHsb
Runtime State: get the HSBType color.- Returns:
- HSBType representing the color.
-
getMirek
public double getMirek()Runtime State: get the color temperature in Mirek/Mired, may be NaN if not known.- Returns:
- double representing the color temperature in Mirek/Mired.
-
getOnOff
Runtime State: get the on/off state or null if not supported.- Returns:
- OnOffType representing the on/off state or null if not supported.
-
getOnOff
Runtime State: get the on/off state or null if not supported.- Parameters:
forceChannelVisible- if true return a non-null value even if brightness or color are supported.- Returns:
- OnOffType representing the on/off state or null if not supported.
-
getRGBx
Runtime State: get the RGB(C)(W) values as an array of doubles in range [0..255]. Depending on the value ofrgbDataType, the array length is either 3 (RGB), 4 (RGBW), or 5 (RGBCW). The array is in the order [red, green, blue, (cold-)(white), (warm-white)]. Depending on the value, the brightness may or may not be used as follows:- 'RGB_NO_BRIGHTNESS': The return result does not depend on the current brightness. In other words the values
only relate to the 'HS' part of the
HSBTypestate. Note: this means that in this case a round trip of setRGBx() followed by getRGBx() will NOT necessarily contain identical values, although the RGB ratios will certainly be the same. - All other values of
rgbDataType: The return result depends on the current brightness. In other words the values relate to all the 'HSB' parts of theHSBTypestate.
- Returns:
- double[] representing the RGB(C)(W) components in range [0..255.0]
- Throws:
IllegalStateException- if the RGB data type is not compatible with the current LED operating mode.
- 'RGB_NO_BRIGHTNESS': The return result does not depend on the current brightness. In other words the values
only relate to the 'HS' part of the
-
getSaturation
public double getSaturation()Runtime State: get the saturation in range [0..100].- Returns:
- double representing the saturation in range [0..100].
-
getXY
public double[] getXY()Runtime State: get the CIE XY values as an array of doubles in range [0.0..1.0].- Returns:
- double[] representing the XY components in range [0.0..1.0].
-
handleColorTemperatureCommand
Runtime State: handle a command to change the light's color temperature state. Commands may be one of:PercentTypefor color temperature setting.QuantityTypefor color temperature setting.
handleCommand(Command)for processing just-in-case.- Parameters:
command- the command to handle.- Throws:
IllegalArgumentException- if the command type is not supported.
-
handleCommand
Runtime State: handle a command to change the light's state. Commands may be one of:HSBTypefor color settingPercentTypefor brightness settingOnOffTypefor on/off state settingIncreaseDecreaseTypefor brightness up/down settingQuantityTypefor color temperature setting
- Parameters:
command- the command to handle.- Throws:
IllegalArgumentException- if the command type is not supported.
-
setBrightness
Runtime State: update the brightness from the remote light, ensuring it is in the range [0.0..100.0]- Parameters:
brightness- in the range [0..100]- Throws:
IllegalArgumentException- if the value is outside the range [0.0 to 100.0]
-
setColor
Runtime State: update the color from the remote light- Parameters:
color- the HSBType color to set
-
setLedOperatingMode
Runtime State: Set the current LED operating mode. Some brands of light are not able to use the RGB leds and the white led(s) at the same time. So they must be switched between WHITE_ONLY and RGB_ONLY mode. Whereas others lights can use any combination of RGB and White leds at the same time they must be switched COMBINED mode. If the mode is changed at runtime then the color and/or color temperature are updated to be consistent with the new mode, while keeping the brightness the same. If the light does not support color then the mode is forced to WHITE_ONLY. -
setHue
Runtime State: update the hue from the remote light, ensuring it is in the range [0.0..360.0]- Parameters:
hue- in the range [0..360]- Throws:
IllegalArgumentException- if the hue parameter is not in the range 0.0 to 360.0
-
setMirek
Runtime State: update the Mirek/Mired color temperature from the remote light, and update the cached HSB color accordingly. Constrain the Mirek/Mired value to be within the warmest and coolest limits. If the Mirek/Mired value is NaN then the cached color is not updated as we cannot determine what it should be.- Parameters:
mirek- the color temperature in Mirek/Mired or NaN if not known.- Throws:
IllegalArgumentException- if the mirek parameter is not in the range [mirekControlCoolest..mirekControlWarmest]
-
setOnOff
public void setOnOff(boolean on) Runtime State: update the on/off state from the remote light.- Parameters:
on- true for ON, false for OFF
-
setRGBx
Runtime State: update the color with RGB(C)(W) fields from the remote light, and update the cached HSB color accordingly. The array must be in the order [red, green, blue, (cold-)(white), (warm-white)]. If white is present but the light does not support white channel(s) then IllegalArgumentException is thrown. Depending on the value ofrgbDataTypethe brightness may or may not change as follows:- 'RGB_NO_BRIGHTNESS' both [255,0,0] and [127.5,0,0] change the color to RED without a change in brightness.
In other words the values only relate to the 'HS' part of the
HSBTypestate. Note: this means that in this case a round trip of 'setRGBx()' followed by 'getRGBx()' will NOT necessarily contain identical values, although the RGB ratios will certainly be the same. - All other values of
rgbDataType: both [255,0,0] and [127.5,0,0] change the color to RED and the former changes the brightness to 100 percent, whereas the latter changes it to 50 percent. In other words the values relate to all the 'HSB' parts of theHSBTypestate.
- Parameters:
rgbxParameter- an array of double representing RGB or RGBW values in range [0.0..255.0]- Throws:
IllegalArgumentException- if the array length is not 3, 4, or 5 depending on the light's capabilities, or if any of the values are outside the range [0.0 to 255.0]
- 'RGB_NO_BRIGHTNESS' both [255,0,0] and [127.5,0,0] change the color to RED without a change in brightness.
In other words the values only relate to the 'HS' part of the
-
setSaturation
Runtime State: update the saturation from the remote light, ensuring it is in the range [0.0..100.0]- Parameters:
saturation- in the range [0..100]- Throws:
IllegalArgumentException- if the value is outside the range [0.0..100.0]
-
setXY
Runtime State: update the color with CIE XY fields from the remote light, and update the cached HSB color accordingly.- Parameters:
x- the x field in range [0.0..1.0]y- the y field in range [0.0..1.0]- Throws:
IllegalArgumentException- if any of the XY values are out of range [0.0..1.0]
-
toNonNull
Runtime State: convert a nullable State to a non-null State, usingUnDefType.UNDEF if the input is null.State state = xyz.toNonNull(xyz.getColor())is a common usage.- Parameters:
state- the input State, which may be null.- Returns:
- the input State if it is not null, otherwise 'UnDefType.UNDEF'.
-
copy
Runtime State: create and return a copy of this LightModel. The copy has the same configuration and runtime state as this instance.- Returns:
- a copy of this LightModel.
-