Esempio n. 1
0
        internal SingleBaseline(BaselineSensitivity sensitivity, IEnumerable <double> lowThresholds, IEnumerable <double> highThresholds)
        {
            if (lowThresholds == null)
            {
                throw new ArgumentNullException(nameof(lowThresholds));
            }
            if (highThresholds == null)
            {
                throw new ArgumentNullException(nameof(highThresholds));
            }

            Sensitivity    = sensitivity;
            LowThresholds  = lowThresholds.ToList();
            HighThresholds = highThresholds.ToList();
        }
        internal static SingleBaseline DeserializeSingleBaseline(JsonElement element)
        {
            BaselineSensitivity    sensitivity    = default;
            IReadOnlyList <double> lowThresholds  = default;
            IReadOnlyList <double> highThresholds = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sensitivity"))
                {
                    sensitivity = new BaselineSensitivity(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("lowThresholds"))
                {
                    List <double> array = new List <double>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetDouble());
                    }
                    lowThresholds = array;
                    continue;
                }
                if (property.NameEquals("highThresholds"))
                {
                    List <double> array = new List <double>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetDouble());
                    }
                    highThresholds = array;
                    continue;
                }
            }
            return(new SingleBaseline(sensitivity, lowThresholds, highThresholds));
        }
Esempio n. 3
0
 internal SingleBaseline(BaselineSensitivity sensitivity, IReadOnlyList <double> lowThresholds, IReadOnlyList <double> highThresholds)
 {
     Sensitivity    = sensitivity;
     LowThresholds  = lowThresholds;
     HighThresholds = highThresholds;
 }