/// <summary> /// Проверяет 2 условия и возвращает значение, если они истинны или не определены, иначе возвращает отстутствующее значение /// </summary> /// <param name="arg">0: значение; 1:условие1; 2:условие2</param> public static object DoubleConditionsValue(object arg) { return(Utils.Calc(arg, 3, 1, data => { var value = (ITimedObject)data[0]; if (value == null || value.IsEmpty) // unknown value { return value; } var cond1 = (ITimedObject)data[1]; if (cond1 != null && !cond1.IsEmpty) { var cond2 = (ITimedObject)data[2]; if (cond2 != null && !cond2.IsEmpty) { if (Utils.CnvToDbl(cond1, 1d) == 0d && Utils.CnvToDbl(cond2, 1d) == 0d) { return null; // both conditions are zero, result undefined } else // is active { var res = TimedDouble.ValueInRange(value, cond1); res = TimedDouble.ValueInRange(res, cond2); return res; } } } // interpret unknown conditions as true and return value return value; })); }
///<exclude/> public bool Equals(TimedDouble other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return other._Tm.Equals(_Tm) && other._Data.Equals(_Data); }