Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/03/20 17:32:50 (5 years ago)
Author:
dpiringe
Message:

#3026:

  • refactored ranged based VMs -> created new 'base' class for ranged based VMs RangedValueBaseVM
  • renamed AddChilds to AddChildren
  • implemented ArrayValueVM and JsonItemArrayValueControl
  • added ranges for array and matrix values
Location:
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/AlgorithmConverter.cs

    r17407 r17420  
    2525      IAlgorithm algorithm = value as IAlgorithm;
    2626      foreach (var res in algorithm.Results) {
    27         item.AddChilds(new ResultItem() {
     27        item.AddChildren(new ResultItem() {
    2828          Name = res.Name,
    2929          Value = true,
     
    3131        });
    3232      }
    33       item.AddChilds(root.Extract(algorithm.Problem, root));
     33      item.AddChildren(root.Extract(algorithm.Problem, root));
    3434      return item;
    3535    }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ConstrainedValueParameterConverter.cs

    r17410 r17420  
    3535        Range = GetValidValues(parameter).Select(x => x.ToString())
    3636      };
    37       item.AddChilds(GetParameterizedChilds(parameter));
     37      item.AddChildren(GetParameterizedChilds(parameter));
    3838
    3939      return item;
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/MultiCheckedOperatorConverter.cs

    r17410 r17420  
    2424      dynamic val = value as dynamic;
    2525      foreach (var op in val.Operators) {
    26         item.AddChilds(new BoolJsonItem() {
     26        item.AddChildren(new BoolJsonItem() {
    2727          Name = op.Name,
    2828          Value = val.Operators.ItemChecked(op),
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ParameterizedItemConverter.cs

    r17410 r17420  
    2929          IJsonItem tmp = root.Extract(param, root);
    3030          if (!(tmp is UnsupportedJsonItem))
    31             item.AddChilds(tmp);
     31            item.AddChildren(tmp);
    3232        }
    3333      }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/RegressionProblemDataConverter.cs

    r17407 r17420  
    2727      FieldInfo dataInfo = dataset.GetType().GetField("storableData", flags);
    2828      // TODO: aufteilen in trainings und test daten abschnitte
    29       item.AddChilds(new JsonItem() {
     29      item.AddChildren(new JsonItem() {
    3030        Name = "Dataset",
    3131        Value = dataInfo.GetValue(dataset)
     
    3333
    3434      IEnumerable<StringValue> variables = (IEnumerable<StringValue>)val.InputVariables;
    35       item.AddChilds(new JsonItem() {
     35      item.AddChildren(new JsonItem() {
    3636        Name = "TargetVariable",
    3737        Value = (object)targetVariable,
     
    4040
    4141
    42       item.AddChilds(new JsonItem() {
     42      item.AddChildren(new JsonItem() {
    4343        Name = "AllowedInputVariables",
    4444        Value = (object)val.AllowedInputVariables,
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueLookupParameterConverter.cs

    r17407 r17420  
    2121      IValueLookupParameter param = value as IValueLookupParameter;
    2222
    23       IJsonItem item = new JsonItem() {
    24         Name = param.Name,
    25         ActualName = param.ActualName
    26       };
     23      IJsonItem item = new JsonItem() {};
    2724
    28       object actualValue = null;
    29       IEnumerable<object> actualRange = null;
    3025      if (param.Value != null) {
    3126        IJsonItem tmp = root.Extract(param.Value, root);
    32         tmp.Parent = item;
     27        /*tmp.Parent = item;
    3328        actualValue = tmp.Value;
    3429        actualRange = tmp.Range;
     30        */
     31        item = tmp;
    3532      } else {
    36         actualRange = new object[] { GetMinValue(param.DataType), GetMaxValue(param.DataType) };
     33        item.Range = new object[] { GetMinValue(param.DataType), GetMaxValue(param.DataType) };
    3734      }
    38       item.Value = actualValue;
    39       item.Range = actualRange;
     35      item.Name = param.Name;
     36      item.ActualName = param.ActualName;
    4037      return item;
    4138    }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueParameterConverter.cs

    r17410 r17420  
    3434            //JsonItem.Merge(item as JsonItem, tmp as JsonItem);
    3535          } else
    36             item.AddChilds(tmp);
     36            item.AddChildren(tmp);
    3737        }
    3838      }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueRangeConverter.cs

    r17410 r17420  
    2424    public override IJsonItem Extract(IItem value, IJsonItemConverter root) {
    2525      IntRange range = value as IntRange;
    26       return new IntArrayJsonItem() {
     26      return new IntRangeJsonItem() {
    2727        Name = "[OverridableParamName]",
    2828        Value = new int[] { range.Start, range.End },
     
    4545    public override IJsonItem Extract(IItem value, IJsonItemConverter root) {
    4646      DoubleRange range = value as DoubleRange;
    47       return new DoubleArrayJsonItem() {
     47      return new DoubleRangeJsonItem() {
    4848        Name = "[OverridableParamName]",
    4949        Value = new double[] { range.Start, range.End },
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueTypeArrayConverter.cs

    r17417 r17420  
    2828      new IntArrayJsonItem() {
    2929        Name = "[OverridableParamName]",
    30         Value = ((IntArray)value).CloneAsArray()
     30        Value = ((IntArray)value).CloneAsArray(),
     31        Range = new int[] { int.MinValue, int.MaxValue }
    3132      };
    3233  }
     
    5051      new DoubleArrayJsonItem() {
    5152        Name = "[OverridableParamName]",
    52         Value = ((DoubleArray)value).CloneAsArray()
     53        Value = ((DoubleArray)value).CloneAsArray(),
     54        Range = new double[] { double.MinValue, double.MaxValue }
    5355      };
    5456  }
     
    7274      new DoubleArrayJsonItem() {
    7375        Name = "[OverridableParamName]",
    74         Value = ((PercentArray)value).CloneAsArray()
     76        Value = ((PercentArray)value).CloneAsArray(),
     77        Range = new double[] { 0.0d, 1.0d }
    7578      };
    7679  }
     
    9497      new BoolArrayJsonItem() {
    9598        Name = "[OverridableParamName]",
    96         Value = ((BoolArray)value).CloneAsArray()
     99        Value = ((BoolArray)value).CloneAsArray(),
     100        Range = new bool[] { false, true }
    97101      };
    98102  }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueTypeMatrixConverter.cs

    r17417 r17420  
    2121      new IntMatrixJsonItem() {
    2222        Name = "[OverridableParamName]",
    23         Value = Transform((IntMatrix)value)
     23        Value = Transform((IntMatrix)value),
     24        Range = new int[] { int.MinValue, int.MaxValue }
    2425      };
    2526  }
     
    3839      new DoubleMatrixJsonItem() {
    3940        Name = "[OverridableParamName]",
    40         Value = Transform((DoubleMatrix)value)
     41        Value = Transform((DoubleMatrix)value),
     42        Range = new double[] { double.MinValue, double.MaxValue }
    4143      };
    4244  }
     
    5557      new DoubleMatrixJsonItem() {
    5658        Name = "[OverridableParamName]",
    57         Value = Transform((PercentMatrix)value)
     59        Value = Transform((PercentMatrix)value),
     60        Range = new double[] { 0.0d, 1.0d }
    5861      };
    5962  }
     
    7275      new BoolMatrixJsonItem() {
    7376        Name = "[OverridableParamName]",
    74         Value = Transform((BoolMatrix)value)
     77        Value = Transform((BoolMatrix)value),
     78        Range = new bool[] { false, true }
    7579      };
    7680  }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Interfaces/IJsonItem.cs

    r17406 r17420  
    1515
    1616    [JsonIgnore]
    17     IList<IJsonItem> Children { get; }
     17    IList<IJsonItem> Children { get; } //TODO: IEnumerable
    1818
    1919    [JsonIgnore]
     
    2828    IJsonItemValidator GetValidator();
    2929
    30     void AddChilds(params IJsonItem[] childs);
     30    void AddChildren(params IJsonItem[] childs);
    3131
    32     void AddChilds(IEnumerable<IJsonItem> childs);
     32    void AddChildren(IEnumerable<IJsonItem> childs);
    3333  }
    3434}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/JsonItem.cs

    r17410 r17420  
    22using System.Collections;
    33using System.Collections.Generic;
    4 using System.IO;
    54using System.Linq;
    65using System.Text;
    7 using System.Threading.Tasks;
    8 using HeuristicLab.Core;
    96using Newtonsoft.Json;
    10 using Newtonsoft.Json.Linq;
    117
    128namespace HeuristicLab.JsonInterface {
     
    7470
    7571    public JsonItem(IEnumerable<IJsonItem> childs) {
    76       AddChilds(childs);
     72      AddChildren(childs);
    7773    }
    7874    #endregion
     
    9490
    9591    #region Public Methods
    96     public void AddChilds(params IJsonItem[] childs) =>
    97       AddChilds(childs as IEnumerable<IJsonItem>);
     92    public void AddChildren(params IJsonItem[] childs) =>
     93      AddChildren(childs as IEnumerable<IJsonItem>);
    9894
    99     public void AddChilds(IEnumerable<IJsonItem> childs) {
     95    public void AddChildren(IEnumerable<IJsonItem> childs) {
    10096      if (Children == null)
    10197        Children = new List<IJsonItem>();
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/JsonItems.cs

    r17417 r17420  
    88  public class IntJsonItem : JsonItem<int> {}
    99  public class IntArrayJsonItem: JsonItem<int[], int> { }
     10  public class IntRangeJsonItem : JsonItem<int[], int> { }
    1011  public class IntMatrixJsonItem : JsonItem<int[][], int> { }
    1112
    1213  public class DoubleJsonItem: JsonItem<double> {}
    1314  public class DoubleArrayJsonItem: JsonItem<double[], double> { }
     15  public class DoubleRangeJsonItem : JsonItem<double[], double> { }
    1416  public class DoubleMatrixJsonItem : JsonItem<double[][], double> { }
    1517
Note: See TracChangeset for help on using the changeset viewer.