using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IStation.Model { /// /// 比较映射 /// public class CompareMappingMatrix : JsonList { /// /// /// public CompareMappingMatrix() { } /// /// /// public CompareMappingMatrix(eCompareType compareType, double key, double value) { this.CompareType = compareType; this.Key = key; this.Value = value; } /// /// /// public CompareMappingMatrix(CompareMappingMatrix rhs) { this.CompareType = rhs.CompareType; this.Key = rhs.Key; this.Value = rhs.Value; } /// /// 比较类型 /// public eCompareType CompareType { get; set; } /// /// 键 /// public double Key { get; set; } /// /// 值 /// public double Value { get; set; } /// /// 是否满足条件 /// public bool Meet(double value) { switch (this.CompareType) { case eCompareType.Equal: { if (value == this.Key) { return true; } } break; case eCompareType.GreatOrEqual: { if (value >= this.Key) { return true; } } break; case eCompareType.GreatThen: { if (value > this.Key) { return true; } } break; case eCompareType.LessOrEqual: { if (value <= this.Key) { return true; } } break; case eCompareType.LessThen: { if (value < this.Key) { return true; } } break; default: break; } return false; } } }