public class ThermostatModel
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CELCIUS
Celcius unit.
|
static java.lang.String |
DEG
HTML representation of a degree.
|
static java.lang.String |
FARENHEIGHT
Farenheight unit.
|
static java.lang.String |
TARGET
The target tag.
|
static java.lang.String |
TEMPERATURE
The temperature tag.
|
static java.lang.String |
UNIT
The unit tag.
|
Constructor and Description |
---|
ThermostatModel()
Instantiates a
ThermostatModel . |
Modifier and Type | Method and Description |
---|---|
void |
addListener(ThermostatListener e)
Append a thermostat listener.
|
ThermostatListener[] |
getListeners()
Gets the listeners.
|
float |
getTargetTemperature()
Gets the target temperature.
|
float |
getTemperature()
Gets the temperature.
|
java.lang.String |
getUnit()
Gets the unit.
|
void |
removeListener(ThermostatListener o)
Removes a ThermostatListener.
|
java.lang.String |
serialize()
Gets a serialize version of the
ThermostatModel . |
void |
setTargetTemperature(float target)
Sets the target and notify the listeners.
|
void |
setTemperature(float temperature)
Sets the temperature and notify the listeners.
|
void |
setUnit(java.lang.String unit)
Sets the unit.
|
java.lang.String |
toString() |
public static final java.lang.String TARGET
public static final java.lang.String TEMPERATURE
public static final java.lang.String UNIT
public static final java.lang.String DEG
public static final java.lang.String CELCIUS
public static final java.lang.String FARENHEIGHT
public ThermostatModel()
ThermostatModel
.public float getTemperature()
public void setTemperature(float temperature)
temperature
- the temperature to set.public float getTargetTemperature()
public void setTargetTemperature(float target)
target
- the target to set.public void addListener(ThermostatListener e)
e
- element to be appended to this listpublic void removeListener(ThermostatListener o)
o
- collection containing elements to be removed from this listpublic ThermostatListener[] getListeners()
public java.lang.String getUnit()
public void setUnit(java.lang.String unit)
unit
- the unit to set.public java.lang.String serialize()
ThermostatModel
.ThermostatModel
in JSON format.public java.lang.String toString()
toString
in class java.lang.Object