source: branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/StringValueConverter.cs @ 17843

Last change on this file since 17843 was 17843, checked in by dpiringe, 7 weeks ago

#3026

  • removed property ConvertableType from all converters
  • removed the option to fixate or loosen the path of JsonItems (obsolete)
  • added a abstract formatter SymbolicRegressionSolutionFormatterBase as base formatter for ISymbolicRegressionSolution
  • unified the construction of exporter controls
  • code cleanup
File size: 823 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6using HeuristicLab.Core;
7using HeuristicLab.Data;
8
9namespace HeuristicLab.JsonInterface {
10  public class StringValueConverter : BaseConverter {
11    public override int Priority => 1;
12
13    public override bool CanConvertType(Type t) =>
14      typeof(StringValue).IsAssignableFrom(t);
15
16    public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) =>
17      ((StringValue)item).Value = ((StringJsonItem)data).Value;
18
19    public override IJsonItem Extract(IItem value, IJsonItemConverter root) =>
20      new StringJsonItem() {
21        Name = value.ItemName,
22        Description = value.ItemDescription,
23        Value = ((StringValue)value).Value
24      };
25  }
26}
Note: See TracBrowser for help on using the repository browser.