Ignore:
Timestamp:
07/26/21 17:59:15 (11 months ago)
Author:
dpiringe
Message:

#3026

  • fixed wrong inheritance for RangedJsonItem
  • added VariableRanges automatic injection for RegressionProblemDataConverter
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItems/RangedJsonItem.cs

    r17519 r18031  
    11using System;
    22using System.Collections.Generic;
     3using Newtonsoft.Json.Linq;
    34
    45namespace HeuristicLab.JsonInterface {
    5   public abstract class RangedJsonItem<T> : JsonItem, IRangedJsonItem<T>
     6  public abstract class RangedJsonItem<T> : IntervalRestrictedValueJsonItem<T>, IRangedJsonItem<T>
    67    where T : IComparable {
    78    public T MinValue { get; set; }
    89    public T MaxValue { get; set; }
    9     public T Minimum { get; set; }
    10     public T Maximum { get; set; }
    1110
    1211    protected override ValidationResult Validate() {
     
    1918
    2019    }
    21      
     20
     21    public override void SetJObject(JObject jObject) {
     22      var minValueProp = jObject[nameof(IRangedJsonItem<T>.MinValue)];
     23      if (minValueProp != null) MinValue = minValueProp.ToObject<T>();
     24
     25      var maxValueProp = jObject[nameof(IRangedJsonItem<T>.MaxValue)];
     26      if (maxValueProp != null) MaxValue = maxValueProp.ToObject<T>();
     27
     28      base.SetJObject(jObject);
     29    }
     30
    2231  }
    2332}
Note: See TracChangeset for help on using the changeset viewer.