1.1 --- a/Hardware/Sensor.cs Thu Aug 12 20:53:27 2010 +0000
1.2 +++ b/Hardware/Sensor.cs Sun Aug 15 14:46:58 2010 +0000
1.3 @@ -51,9 +51,9 @@
1.4 private SensorType sensorType;
1.5 private IHardware hardware;
1.6 private ReadOnlyArray<IParameter> parameters;
1.7 - private float? value;
1.8 - private float? min;
1.9 - private float? max;
1.10 + private float? currentValue;
1.11 + private float? minValue;
1.12 + private float? maxValue;
1.13 private Queue<SensorValue> values =
1.14 new Queue<SensorValue>(MAX_MINUTES * 15);
1.15 private ISettings settings;
1.16 @@ -114,7 +114,7 @@
1.17 return name;
1.18 }
1.19 set {
1.20 - if (value != "")
1.21 + if (!string.IsNullOrEmpty(value))
1.22 name = value;
1.23 else
1.24 name = defaultName;
1.25 @@ -136,7 +136,7 @@
1.26
1.27 public float? Value {
1.28 get {
1.29 - return value;
1.30 + return currentValue;
1.31 }
1.32 set {
1.33 while (values.Count > 0 &&
1.34 @@ -153,23 +153,23 @@
1.35 }
1.36 }
1.37
1.38 - this.value = value;
1.39 - if (min > value || !min.HasValue)
1.40 - min = value;
1.41 - if (max < value || !max.HasValue)
1.42 - max = value;
1.43 + this.currentValue = value;
1.44 + if (minValue > value || !minValue.HasValue)
1.45 + minValue = value;
1.46 + if (maxValue < value || !maxValue.HasValue)
1.47 + maxValue = value;
1.48 }
1.49 }
1.50
1.51 - public float? Min { get { return min; } }
1.52 - public float? Max { get { return max; } }
1.53 + public float? Min { get { return minValue; } }
1.54 + public float? Max { get { return maxValue; } }
1.55
1.56 public void ResetMin() {
1.57 - min = null;
1.58 + minValue = null;
1.59 }
1.60
1.61 public void ResetMax() {
1.62 - max = null;
1.63 + maxValue = null;
1.64 }
1.65
1.66 public IEnumerable<SensorValue> Values {
1.67 @@ -177,8 +177,9 @@
1.68 }
1.69
1.70 public void Accept(IVisitor visitor) {
1.71 - if (visitor != null)
1.72 - visitor.VisitSensor(this);
1.73 + if (visitor == null)
1.74 + throw new ArgumentNullException("visitor");
1.75 + visitor.VisitSensor(this);
1.76 }
1.77
1.78 public void Traverse(IVisitor visitor) {