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