Last change
on this file since 18039 was
17843,
checked in by dpiringe, 4 years 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:
960 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 |
|
---|
8 | namespace HeuristicLab.JsonInterface {
|
---|
9 | public class LookupParameterConverter : BaseConverter {
|
---|
10 | public override int Priority => 3;
|
---|
11 |
|
---|
12 | public override bool CanConvertType(Type t) =>
|
---|
13 | t.GetInterfaces().Any(x => x == typeof(ILookupParameter));
|
---|
14 |
|
---|
15 | public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) =>
|
---|
16 | ((ILookupParameter)item).ActualName = ((ILookupJsonItem)data).ActualName as string;
|
---|
17 |
|
---|
18 | public override IJsonItem Extract(IItem value, IJsonItemConverter root) {
|
---|
19 | IParameter parameter = value as IParameter;
|
---|
20 |
|
---|
21 | IJsonItem item = new LookupJsonItem() {
|
---|
22 | Name = parameter.Name,
|
---|
23 | Description = parameter.Description,
|
---|
24 | ActualName = ((ILookupParameter)parameter).ActualName
|
---|
25 | };
|
---|
26 | return item;
|
---|
27 | }
|
---|
28 | }
|
---|
29 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.