From 5f12c0c813d7f665ab1409628ce3b511ed93e871 Mon Sep 17 00:00:00 2001 From: omenem Date: Tue, 26 May 2020 12:07:36 +0200 Subject: [PATCH] wip --- .../smarthut/service/ThermostatService.java | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) 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)); }