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 | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Threading.Tasks;
|
---|
6 | using HeuristicLab.Core;
|
---|
7 | using HeuristicLab.Data;
|
---|
8 |
|
---|
9 | namespace 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.