Ejemplo n.º 1
0
        internal static DetectionResult DeserializeDetectionResult(JsonElement element)
        {
            Guid resultId = default;
            DetectionResultSummary       summary = default;
            IReadOnlyList <AnomalyState> results = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("resultId"))
                {
                    resultId = property.Value.GetGuid();
                    continue;
                }
                if (property.NameEquals("summary"))
                {
                    summary = DetectionResultSummary.DeserializeDetectionResultSummary(property.Value);
                    continue;
                }
                if (property.NameEquals("results"))
                {
                    List <AnomalyState> array = new List <AnomalyState>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(AnomalyState.DeserializeAnomalyState(item));
                    }
                    results = array;
                    continue;
                }
            }
            return(new DetectionResult(resultId, summary, results));
        }
Ejemplo n.º 2
0
        internal DetectionResult(Guid resultId, DetectionResultSummary summary, IEnumerable <AnomalyState> results)
        {
            if (summary == null)
            {
                throw new ArgumentNullException(nameof(summary));
            }
            if (results == null)
            {
                throw new ArgumentNullException(nameof(results));
            }

            ResultId = resultId;
            Summary  = summary;
            Results  = results.ToList();
        }
        public static DetectionResult DetectionResult(Guid resultId = default, DetectionResultSummary summary = null, IEnumerable <AnomalyState> results = null)
        {
            results ??= new List <AnomalyState>();

            return(new DetectionResult(resultId, summary, results?.ToList()));
        }
Ejemplo n.º 4
0
 internal DetectionResult(Guid resultId, DetectionResultSummary summary, IReadOnlyList <AnomalyState> results)
 {
     ResultId = resultId;
     Summary  = summary;
     Results  = results;
 }