示例#1
0
        internal static AnomalyInterpretation DeserializeAnomalyInterpretation(JsonElement element)
        {
            Optional <string>             variable           = default;
            Optional <float>              contributionScore  = default;
            Optional <CorrelationChanges> correlationChanges = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("variable"))
                {
                    variable = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("contributionScore"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    contributionScore = property.Value.GetSingle();
                    continue;
                }
                if (property.NameEquals("correlationChanges"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    correlationChanges = CorrelationChanges.DeserializeCorrelationChanges(property.Value);
                    continue;
                }
            }
            return(new AnomalyInterpretation(variable.Value, Optional.ToNullable(contributionScore), correlationChanges.Value));
        }
 public static AnomalyInterpretation AnomalyInterpretation(string variable = null, float?contributionScore = null, CorrelationChanges correlationChanges = null)
 {
     return(new AnomalyInterpretation(variable, contributionScore, correlationChanges));
 }