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:
1.4 KB
|
Rev | Line | |
---|
[17263] | 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 Newtonsoft.Json;
|
---|
| 8 |
|
---|
| 9 | namespace ParameterTest {
|
---|
| 10 | public class JCObject {
|
---|
| 11 | public string Name { get; set; }
|
---|
| 12 | public IList<ParameterData> Parameters { get; set; }
|
---|
| 13 | public IList<ParameterData> FreeParameters { get; set; }
|
---|
| 14 | public IList<ParameterData> StaticParameters { get; set; }
|
---|
| 15 |
|
---|
| 16 | public override string ToString() {
|
---|
| 17 | StringBuilder sb = new StringBuilder();
|
---|
| 18 | sb.Append($"{Name}: [");
|
---|
| 19 | foreach(var x in StaticParameters) {
|
---|
| 20 | sb.Append(x.ToString());
|
---|
| 21 | }
|
---|
| 22 | sb.Append($"\n]");
|
---|
| 23 | return sb.ToString();
|
---|
| 24 | }
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | public class ParameterData {
|
---|
| 28 | public string Name { get; set; }
|
---|
| 29 | [JsonIgnore]
|
---|
| 30 | public string Type { get; set; }
|
---|
| 31 | public object Default { get; set; }
|
---|
| 32 | //[JsonIgnore]
|
---|
| 33 | public string Path { get; set; }
|
---|
| 34 | public IList<object> Range { get; set; }
|
---|
| 35 | public IList<ParameterData> Parameters { get; set; }
|
---|
| 36 | public IList<ParameterData> Operators { get; set; }
|
---|
| 37 |
|
---|
| 38 | public override string ToString() {
|
---|
| 39 | StringBuilder sb = new StringBuilder();
|
---|
| 40 | sb.Append($"\n{Name}, {Default}, Range[");
|
---|
| 41 | if(Range != null) {
|
---|
| 42 | foreach (var x in Range) {
|
---|
| 43 | sb.Append(x.ToString() + ", ");
|
---|
| 44 | }
|
---|
| 45 | }
|
---|
| 46 | sb.Append($"],");
|
---|
| 47 | return sb.ToString();
|
---|
| 48 | }
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.