diff --git a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/service/ThermostatService.java b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/service/ThermostatService.java index 54ae868..20d7e32 100644 --- a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/service/ThermostatService.java +++ b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/service/ThermostatService.java @@ -1,7 +1,5 @@ package ch.usi.inf.sa4.sanmarinoes.smarthut.service; -import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Sensor; -import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Sensor.SensorType; import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Thermostat; import ch.usi.inf.sa4.sanmarinoes.smarthut.models.ThermostatRepository; import ch.usi.inf.sa4.sanmarinoes.smarthut.socket.SensorSocketEndpoint; @@ -40,19 +38,10 @@ public class ThermostatService { double x; Random ran = new Random(); - ; - if (thermostat.getTypical() == null) { - BigDecimal typical = Sensor.TYPICAL_VALUES.get(SensorType.TEMPERATURE); - - x = (ran.nextInt(typical.intValue()) + thermostat.getErr().intValue()) * 0.975 + 1; - - } else { - x = - (ran.nextInt(thermostat.getTypical().intValue()) - + thermostat.getErr().intValue()) - * 0.975 - + 1; - } + x = + (ran.nextInt(thermostat.getTypical().intValue()) + thermostat.getErr().intValue()) + * 0.975 + + 1; updateValueForThermostat(thermostat, new BigDecimal(x)); }