public class LightState
extends java.lang.Object
Constructor and Description |
---|
LightState(MilightColor color,
float brightness,
boolean whiteMode,
boolean on)
This constructor creates a new LightState instance which stores the state
of a group of lights.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(LightState state)
This function checks whether two LightStates represent the same state.
|
float |
getBrightness()
This function returns the brightness level between 0 and 1 currently
displayed by the group of lights if they are in white mode.
|
MilightColor |
getColor()
This function returns the color which is currently display by the group
of lights if the lights are in colored mode.
|
boolean |
isOn()
This function returns whether the group of lights is switched on.
|
boolean |
isWhiteMode()
This function returns whether the group of lights is in white mode.
|
void |
restore(Lights lights)
This function restores the state represented by this instance to a group
of lights.
|
java.lang.String |
toString()
This function describes the objet as a string.
|
public LightState(MilightColor color, float brightness, boolean whiteMode, boolean on)
color
- is the color last displayed in colored modebrightness
- is the brightness value last displayed in white mode (between
0 and 1)whiteMode
- is true if the lights are currently in white mode and false if
they are in colored modeon
- is true if the group of lights is switched onjava.lang.IllegalArgumentException
- if the brightness value is not between 0 and 1public MilightColor getColor()
isWhiteMode()
public boolean isWhiteMode()
public float getBrightness()
isWhiteMode()
public boolean isOn()
public boolean equals(LightState state)
state
- the state to compare topublic void restore(Lights lights) throws java.io.IOException
lights
- is the group of lights to be adjustedjava.io.IOException
- if the message could not be sentpublic java.lang.String toString()
toString
in class java.lang.Object