/** ** Update min/max temperatures */ private void _updateMinMaxTemperature() { this.minTempC = 9999.0; this.maxTempC = -9999.0; for (Temperature T : this.tempList) { double tempC = T.getTemperatureC(); // temperature guaranteed valid if (tempC < this.minTempC) { this.minTempC = tempC; } if (tempC > this.maxTempC) { this.maxTempC = tempC; } } }
/** ** Adds the specified temperature to this data set */ public boolean addTemperature(Temperature T) { if (Temperature.isValid(T)) { // valid timestamp and temperature this.tempList.add(T); double tempC = T.getTemperatureC(); if (tempC < this.minTempC) { this.minTempC = tempC; } if (tempC > this.maxTempC) { this.maxTempC = tempC; } return true; } else { return false; } }