Apply code formatting cleanup across monitor projects
- Reindent appsettings.json and the MSBuild project files - Collapse single-statement guard blocks and tidy using and member order - Normalize XML doc indentation and file endings - Reorder BatteryMonitor test-data helpers and move the exclusion tests into their own region - Carry the same formatting through the boiler config, control, entity and test files
This commit is contained in:
@@ -10,7 +10,13 @@ public sealed class HumidityRateCalculator(int windowSize) : IHumidityRateCalcul
|
||||
|
||||
public double? PreviousReading
|
||||
{
|
||||
get { lock (_lock) { return _previousReading; } }
|
||||
get
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
return _previousReading;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RecordReading(double humidity, DateTimeOffset timestamp)
|
||||
@@ -20,10 +26,7 @@ public sealed class HumidityRateCalculator(int windowSize) : IHumidityRateCalcul
|
||||
_readings.Enqueue((humidity, timestamp));
|
||||
_previousReading = humidity;
|
||||
|
||||
while (_readings.Count > windowSize)
|
||||
{
|
||||
_readings.Dequeue();
|
||||
}
|
||||
while (_readings.Count > windowSize) _readings.Dequeue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,19 +34,13 @@ public sealed class HumidityRateCalculator(int windowSize) : IHumidityRateCalcul
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
if (_readings.Count < 2)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
if (_readings.Count < 2) return 0.0;
|
||||
|
||||
var oldest = _readings.Peek();
|
||||
var newest = _readings.Last();
|
||||
var elapsedMinutes = (newest.Timestamp - oldest.Timestamp).TotalMinutes;
|
||||
|
||||
if (elapsedMinutes <= 0)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
if (elapsedMinutes <= 0) return 0.0;
|
||||
|
||||
return (newest.Humidity - oldest.Humidity) / elapsedMinutes;
|
||||
}
|
||||
@@ -57,4 +54,4 @@ public sealed class HumidityRateCalculator(int windowSize) : IHumidityRateCalcul
|
||||
_previousReading = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user