- Timestamp:
- 02/03/20 17:32:50 (5 years ago)
- Location:
- branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/AlgorithmConverter.cs
r17407 r17420 25 25 IAlgorithm algorithm = value as IAlgorithm; 26 26 foreach (var res in algorithm.Results) { 27 item.AddChild s(new ResultItem() {27 item.AddChildren(new ResultItem() { 28 28 Name = res.Name, 29 29 Value = true, … … 31 31 }); 32 32 } 33 item.AddChild s(root.Extract(algorithm.Problem, root));33 item.AddChildren(root.Extract(algorithm.Problem, root)); 34 34 return item; 35 35 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ConstrainedValueParameterConverter.cs
r17410 r17420 35 35 Range = GetValidValues(parameter).Select(x => x.ToString()) 36 36 }; 37 item.AddChild s(GetParameterizedChilds(parameter));37 item.AddChildren(GetParameterizedChilds(parameter)); 38 38 39 39 return item; -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/MultiCheckedOperatorConverter.cs
r17410 r17420 24 24 dynamic val = value as dynamic; 25 25 foreach (var op in val.Operators) { 26 item.AddChild s(new BoolJsonItem() {26 item.AddChildren(new BoolJsonItem() { 27 27 Name = op.Name, 28 28 Value = val.Operators.ItemChecked(op), -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ParameterizedItemConverter.cs
r17410 r17420 29 29 IJsonItem tmp = root.Extract(param, root); 30 30 if (!(tmp is UnsupportedJsonItem)) 31 item.AddChild s(tmp);31 item.AddChildren(tmp); 32 32 } 33 33 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/RegressionProblemDataConverter.cs
r17407 r17420 27 27 FieldInfo dataInfo = dataset.GetType().GetField("storableData", flags); 28 28 // TODO: aufteilen in trainings und test daten abschnitte 29 item.AddChild s(new JsonItem() {29 item.AddChildren(new JsonItem() { 30 30 Name = "Dataset", 31 31 Value = dataInfo.GetValue(dataset) … … 33 33 34 34 IEnumerable<StringValue> variables = (IEnumerable<StringValue>)val.InputVariables; 35 item.AddChild s(new JsonItem() {35 item.AddChildren(new JsonItem() { 36 36 Name = "TargetVariable", 37 37 Value = (object)targetVariable, … … 40 40 41 41 42 item.AddChild s(new JsonItem() {42 item.AddChildren(new JsonItem() { 43 43 Name = "AllowedInputVariables", 44 44 Value = (object)val.AllowedInputVariables, -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueLookupParameterConverter.cs
r17407 r17420 21 21 IValueLookupParameter param = value as IValueLookupParameter; 22 22 23 IJsonItem item = new JsonItem() { 24 Name = param.Name, 25 ActualName = param.ActualName 26 }; 23 IJsonItem item = new JsonItem() {}; 27 24 28 object actualValue = null;29 IEnumerable<object> actualRange = null;30 25 if (param.Value != null) { 31 26 IJsonItem tmp = root.Extract(param.Value, root); 32 tmp.Parent = item;27 /*tmp.Parent = item; 33 28 actualValue = tmp.Value; 34 29 actualRange = tmp.Range; 30 */ 31 item = tmp; 35 32 } else { 36 actualRange = new object[] { GetMinValue(param.DataType), GetMaxValue(param.DataType) };33 item.Range = new object[] { GetMinValue(param.DataType), GetMaxValue(param.DataType) }; 37 34 } 38 item. Value = actualValue;39 item. Range = actualRange;35 item.Name = param.Name; 36 item.ActualName = param.ActualName; 40 37 return item; 41 38 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueParameterConverter.cs
r17410 r17420 34 34 //JsonItem.Merge(item as JsonItem, tmp as JsonItem); 35 35 } else 36 item.AddChild s(tmp);36 item.AddChildren(tmp); 37 37 } 38 38 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueRangeConverter.cs
r17410 r17420 24 24 public override IJsonItem Extract(IItem value, IJsonItemConverter root) { 25 25 IntRange range = value as IntRange; 26 return new Int ArrayJsonItem() {26 return new IntRangeJsonItem() { 27 27 Name = "[OverridableParamName]", 28 28 Value = new int[] { range.Start, range.End }, … … 45 45 public override IJsonItem Extract(IItem value, IJsonItemConverter root) { 46 46 DoubleRange range = value as DoubleRange; 47 return new Double ArrayJsonItem() {47 return new DoubleRangeJsonItem() { 48 48 Name = "[OverridableParamName]", 49 49 Value = new double[] { range.Start, range.End }, -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueTypeArrayConverter.cs
r17417 r17420 28 28 new IntArrayJsonItem() { 29 29 Name = "[OverridableParamName]", 30 Value = ((IntArray)value).CloneAsArray() 30 Value = ((IntArray)value).CloneAsArray(), 31 Range = new int[] { int.MinValue, int.MaxValue } 31 32 }; 32 33 } … … 50 51 new DoubleArrayJsonItem() { 51 52 Name = "[OverridableParamName]", 52 Value = ((DoubleArray)value).CloneAsArray() 53 Value = ((DoubleArray)value).CloneAsArray(), 54 Range = new double[] { double.MinValue, double.MaxValue } 53 55 }; 54 56 } … … 72 74 new DoubleArrayJsonItem() { 73 75 Name = "[OverridableParamName]", 74 Value = ((PercentArray)value).CloneAsArray() 76 Value = ((PercentArray)value).CloneAsArray(), 77 Range = new double[] { 0.0d, 1.0d } 75 78 }; 76 79 } … … 94 97 new BoolArrayJsonItem() { 95 98 Name = "[OverridableParamName]", 96 Value = ((BoolArray)value).CloneAsArray() 99 Value = ((BoolArray)value).CloneAsArray(), 100 Range = new bool[] { false, true } 97 101 }; 98 102 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueTypeMatrixConverter.cs
r17417 r17420 21 21 new IntMatrixJsonItem() { 22 22 Name = "[OverridableParamName]", 23 Value = Transform((IntMatrix)value) 23 Value = Transform((IntMatrix)value), 24 Range = new int[] { int.MinValue, int.MaxValue } 24 25 }; 25 26 } … … 38 39 new DoubleMatrixJsonItem() { 39 40 Name = "[OverridableParamName]", 40 Value = Transform((DoubleMatrix)value) 41 Value = Transform((DoubleMatrix)value), 42 Range = new double[] { double.MinValue, double.MaxValue } 41 43 }; 42 44 } … … 55 57 new DoubleMatrixJsonItem() { 56 58 Name = "[OverridableParamName]", 57 Value = Transform((PercentMatrix)value) 59 Value = Transform((PercentMatrix)value), 60 Range = new double[] { 0.0d, 1.0d } 58 61 }; 59 62 } … … 72 75 new BoolMatrixJsonItem() { 73 76 Name = "[OverridableParamName]", 74 Value = Transform((BoolMatrix)value) 77 Value = Transform((BoolMatrix)value), 78 Range = new bool[] { false, true } 75 79 }; 76 80 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Interfaces/IJsonItem.cs
r17406 r17420 15 15 16 16 [JsonIgnore] 17 IList<IJsonItem> Children { get; } 17 IList<IJsonItem> Children { get; } //TODO: IEnumerable 18 18 19 19 [JsonIgnore] … … 28 28 IJsonItemValidator GetValidator(); 29 29 30 void AddChild s(params IJsonItem[] childs);30 void AddChildren(params IJsonItem[] childs); 31 31 32 void AddChild s(IEnumerable<IJsonItem> childs);32 void AddChildren(IEnumerable<IJsonItem> childs); 33 33 } 34 34 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/JsonItem.cs
r17410 r17420 2 2 using System.Collections; 3 3 using System.Collections.Generic; 4 using System.IO;5 4 using System.Linq; 6 5 using System.Text; 7 using System.Threading.Tasks;8 using HeuristicLab.Core;9 6 using Newtonsoft.Json; 10 using Newtonsoft.Json.Linq;11 7 12 8 namespace HeuristicLab.JsonInterface { … … 74 70 75 71 public JsonItem(IEnumerable<IJsonItem> childs) { 76 AddChild s(childs);72 AddChildren(childs); 77 73 } 78 74 #endregion … … 94 90 95 91 #region Public Methods 96 public void AddChild s(params IJsonItem[] childs) =>97 AddChild s(childs as IEnumerable<IJsonItem>);92 public void AddChildren(params IJsonItem[] childs) => 93 AddChildren(childs as IEnumerable<IJsonItem>); 98 94 99 public void AddChild s(IEnumerable<IJsonItem> childs) {95 public void AddChildren(IEnumerable<IJsonItem> childs) { 100 96 if (Children == null) 101 97 Children = new List<IJsonItem>(); -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/JsonItems.cs
r17417 r17420 8 8 public class IntJsonItem : JsonItem<int> {} 9 9 public class IntArrayJsonItem: JsonItem<int[], int> { } 10 public class IntRangeJsonItem : JsonItem<int[], int> { } 10 11 public class IntMatrixJsonItem : JsonItem<int[][], int> { } 11 12 12 13 public class DoubleJsonItem: JsonItem<double> {} 13 14 public class DoubleArrayJsonItem: JsonItem<double[], double> { } 15 public class DoubleRangeJsonItem : JsonItem<double[], double> { } 14 16 public class DoubleMatrixJsonItem : JsonItem<double[][], double> { } 15 17
Note: See TracChangeset
for help on using the changeset viewer.