ningshuxia
2022-12-01 ad494f13d2ddf31f142cf7fb908b3a6e90395a1a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace IStation.Model
{
    /// <summary>
    /// 比较映射
    /// </summary>
    public class CompareMappingMatrix : JsonList<CompareMappingMatrix>
    {
        /// <summary>
        /// 
        /// </summary>
        public CompareMappingMatrix() { }
 
        /// <summary>
        /// 
        /// </summary>
        public CompareMappingMatrix(eCompareType compareType, double key, double value)
        {
            this.CompareType = compareType;
            this.Key = key;
            this.Value = value;
        }
 
        /// <summary>
        /// 
        /// </summary>
        public CompareMappingMatrix(CompareMappingMatrix rhs)
        {
            this.CompareType = rhs.CompareType;
            this.Key = rhs.Key;
            this.Value = rhs.Value;
        }
 
 
        /// <summary>
        /// 比较类型
        /// </summary>
        public eCompareType CompareType { get; set; }
 
        /// <summary>
        /// 键
        /// </summary>
        public double Key { get; set; }
 
        /// <summary>
        /// 值
        /// </summary>
        public double Value { get; set; }
 
        /// <summary>
        /// 是否满足条件
        /// </summary>
        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;
        }
    }
}