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;
|
}
|
}
|
}
|