internal NumericVariable(string kind, TimeSeriesExpression filter, TimeSeriesExpression value, InterpolationOperation interpolation, TimeSeriesExpression aggregation) : base(kind, filter) { Value = value; Interpolation = interpolation; Aggregation = aggregation; Kind = kind ?? "numeric"; }
internal CategoricalVariable(string kind, TimeSeriesExpression filter, TimeSeriesExpression value, InterpolationOperation interpolation, IList <TimeSeriesAggregateCategory> categories, TimeSeriesDefaultCategory defaultCategory) : base(kind, filter) { Value = value; Interpolation = interpolation; Categories = categories; DefaultCategory = defaultCategory; Kind = kind ?? "categorical"; }
internal static NumericVariable DeserializeNumericVariable(JsonElement element) { TimeSeriesExpression value = default; Optional <InterpolationOperation> interpolation = default; TimeSeriesExpression aggregation = default; string kind = default; Optional <TimeSeriesExpression> filter = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value")) { value = TimeSeriesExpression.DeserializeTimeSeriesExpression(property.Value); continue; } if (property.NameEquals("interpolation")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } interpolation = InterpolationOperation.DeserializeInterpolationOperation(property.Value); continue; } if (property.NameEquals("aggregation")) { aggregation = TimeSeriesExpression.DeserializeTimeSeriesExpression(property.Value); continue; } if (property.NameEquals("kind")) { kind = property.Value.GetString(); continue; } if (property.NameEquals("filter")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } filter = TimeSeriesExpression.DeserializeTimeSeriesExpression(property.Value); continue; } } return(new NumericVariable(kind, filter.Value, value, interpolation.Value, aggregation)); }
internal static CategoricalVariable DeserializeCategoricalVariable(JsonElement element) { TimeSeriesExpression value = default; Optional <InterpolationOperation> interpolation = default; Optional <IList <TimeSeriesAggregateCategory> > categories = default; TimeSeriesDefaultCategory defaultCategory = default; string kind = default; Optional <TimeSeriesExpression> filter = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value")) { value = TimeSeriesExpression.DeserializeTimeSeriesExpression(property.Value); continue; } if (property.NameEquals("interpolation")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } interpolation = InterpolationOperation.DeserializeInterpolationOperation(property.Value); continue; } if (property.NameEquals("categories")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <TimeSeriesAggregateCategory> array = new List <TimeSeriesAggregateCategory>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(TimeSeriesAggregateCategory.DeserializeTimeSeriesAggregateCategory(item)); } categories = array; continue; } if (property.NameEquals("defaultCategory")) { defaultCategory = TimeSeriesDefaultCategory.DeserializeTimeSeriesDefaultCategory(property.Value); continue; } if (property.NameEquals("kind")) { kind = property.Value.GetString(); continue; } if (property.NameEquals("filter")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } filter = TimeSeriesExpression.DeserializeTimeSeriesExpression(property.Value); continue; } } return(new CategoricalVariable(kind, filter.Value, value, interpolation.Value, Optional.ToList(categories), defaultCategory)); }