Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/StringValueTransformer.cs @ 17263

Last change on this file since 17263 was 17263, checked in by dpiringe, 5 years ago

#3026:

  • added first prototype for:
    • creating templates
    • initialize a optimizer out of a template
  • first attempts to create the option to extend the template generation and initialisation (with Transformers -> json To IItem, IItem to json) without serializing/deserializing the whole IItem
File size: 826 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 ParameterTest {
10  public class StringValueTransformer : BaseTransformer {
11    public override IItem FromData(ParameterData obj, Type targetType) =>
12      //item.Cast<StringValue>().Value = CastValue<string>(obj.Default);
13      new StringValue() { Value = CastValue<string>(obj.Default) };
14
15    public override void SetValue(IItem item, ParameterData data) =>
16      item.Cast<StringValue>().Value = CastValue<string>(data.Default);
17
18    public override ParameterData ToData(IItem value) {
19      ParameterData data = base.ToData(value);
20      data.Default = value.Cast<StringValue>().Value;
21      return data;
22    }
23
24  }
25}
Note: See TracBrowser for help on using the repository browser.