Changeset 17394 for branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueLookupParameterConverter.cs
- Timestamp:
- 01/07/20 16:25:39 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueLookupParameterConverter.cs
r17379 r17394 8 8 namespace HeuristicLab.JsonInterface { 9 9 public class ValueLookupParameterConverter : ParameterBaseConverter { 10 public override JsonItem ExtractData(IParameter value) { 11 IValueLookupParameter param = value.Cast<IValueLookupParameter>(); 10 public override int Priority => 4; 11 public override Type ConvertableType => typeof(IValueLookupParameter); 12 13 public override void Populate(IParameter value, JsonItem item, IJsonItemConverter root) { 14 IValueLookupParameter param = value as IValueLookupParameter; 15 16 item.Name = value.Name; 17 item.ActualName = param.ActualName; 18 12 19 object actualValue = null; 13 20 IEnumerable<object> actualRange = null; 14 21 if(param.Value != null) { 15 JsonItem tmp = JsonItemConverter.Extract(param.Value); 22 JsonItem tmp = root.Extract(param.Value, root); 23 tmp.Parent = item; 16 24 actualValue = tmp.Value; 17 25 actualRange = tmp.Range; … … 19 27 actualRange = new object[] { GetMinValue(param.DataType), GetMaxValue(param.DataType) }; 20 28 } 21 22 return new JsonItem() { 23 Name = value.Name, 24 ActualName = param.ActualName, 25 Value = actualValue, 26 Range = actualRange 27 }; 29 item.Value = actualValue; 30 item.Range = actualRange; 28 31 } 29 32 30 public override void InjectData(IParameter parameter, JsonItem data ) {31 IValueLookupParameter param = parameter .Cast<IValueLookupParameter>();33 public override void InjectData(IParameter parameter, JsonItem data, IJsonItemConverter root) { 34 IValueLookupParameter param = parameter as IValueLookupParameter; 32 35 param.ActualName = CastValue<string>(data.ActualName); 33 36 if (param.Value != null) 34 JsonItemConverter.Inject(param.Value, data);37 root.Inject(param.Value, data, root); 35 38 } 36 39 }
Note: See TracChangeset
for help on using the changeset viewer.