Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17420 for branches


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
Files:
2 added
22 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/HeuristicLab.JsonInterface.OptimizerIntegration.csproj

    r17417 r17420  
    9797    <Compile Include="ViewModels\ArrayValueVM.cs" />
    9898    <Compile Include="ViewModels\JsonItemVMBase.cs" />
     99    <Compile Include="ViewModels\RangedValueBaseVM.cs" />
    99100    <Compile Include="ViewModels\RangeVM.cs" />
    100101    <Compile Include="ViewModels\SingleValueVM.cs" />
     
    197198    <EmbeddedResource Include="Views\ExportJsonDialog.resx">
    198199      <DependentUpon>ExportJsonDialog.cs</DependentUpon>
     200    </EmbeddedResource>
     201    <EmbeddedResource Include="Views\JsonItemArrayValueControl.resx">
     202      <DependentUpon>JsonItemArrayValueControl.cs</DependentUpon>
    199203    </EmbeddedResource>
    200204    <EmbeddedResource Include="Views\JsonItemBoolControl.resx">
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/ArrayValueVM.cs

    r17417 r17420  
    11using System;
    22using System.Collections.Generic;
     3using System.ComponentModel;
    34using System.Linq;
    45using System.Text;
     
    67
    78namespace HeuristicLab.JsonInterface.OptimizerIntegration {
    8   public class ArrayValueVM : JsonItemVMBase {
     9
     10  public class DoubleArrayValueVM : ArrayValueVM<double> {
    911    public override Type JsonItemType => typeof(DoubleArrayJsonItem);
    10     public override JsonItemBaseControl GetControl() => new JsonItemArrayValueControl(this);
     12
     13    protected override double MinTypeValue => double.MinValue;
     14
     15    protected override double MaxTypeValue => double.MaxValue;
     16
     17    public override JsonItemBaseControl GetControl() => new JsonItemDoubleArrayValueControl(this);
     18
     19    protected override void OnItemChanged() {
     20      IList<IndexedArrayValueVM> list = new List<IndexedArrayValueVM>();
     21      var arr = ((DoubleArrayJsonItem)Item).Value;
     22      for(int i = 0; i < arr.Length; ++i) {
     23        list.Add(new IndexedArrayValueVM(arr, i));
     24      }
     25      Value = list.ToArray();
     26    }
     27  }
     28
     29  public class IntArrayValueVM : ArrayValueVM<int> {
     30    public override Type JsonItemType => typeof(IntArrayJsonItem);
     31
     32    protected override int MinTypeValue => int.MinValue;
     33
     34    protected override int MaxTypeValue => int.MaxValue;
     35
     36    public override JsonItemBaseControl GetControl() => new JsonItemIntArrayValueControl(this);
     37
     38    protected override void OnItemChanged() {
     39      IList<IndexedArrayValueVM> list = new List<IndexedArrayValueVM>();
     40      var arr = ((IntArrayJsonItem)Item).Value;
     41      for (int i = 0; i < arr.Length; ++i) {
     42        list.Add(new IndexedArrayValueVM(arr, i));
     43      }
     44      Value = list.ToArray();
     45    }
     46  }
     47
     48  public abstract class ArrayValueVM<T> : RangedValueBaseVM<T> {
     49
     50    public class IndexedArrayValueVM : INotifyPropertyChanged {
     51      private T[] arr;
     52      private int index;
     53
     54      public IndexedArrayValueVM(T[] arr, int index) {
     55        this.arr = arr;
     56        this.index = index;
     57      }
     58
     59      public T Value {
     60        get => arr[index];
     61        set {
     62          arr[index] = value;
     63          PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Value)));
     64        }
     65      }
     66
     67      public event PropertyChangedEventHandler PropertyChanged;
     68    }
     69
     70    public ArrayValueVM() {
     71      base.ItemChanged += OnItemChanged;
     72    }
     73
     74    protected abstract void OnItemChanged();
     75
     76    IndexedArrayValueVM[] vms;
     77    public IndexedArrayValueVM[] Value {
     78      get => vms;
     79      set {
     80        vms = value;
     81        OnPropertyChange(this, nameof(Value));
     82      }
     83    }
    1184  }
    1285}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/JsonItemVMBase.cs

    r17412 r17420  
    99  public class JsonItemVMBase : INotifyPropertyChanged {
    1010    public event PropertyChangedEventHandler PropertyChanged;
    11     public IJsonItem Item { get; set; }
     11    public event Action ItemChanged;
     12
     13    private IJsonItem item;
     14    public IJsonItem Item {
     15      get => item;
     16      set {
     17        item = value;
     18        ItemChanged?.Invoke();
     19      }
     20    }
    1221
    1322    protected void OnPropertyChange(object sender, string propertyName) {
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/RangeVM.cs

    r17412 r17420  
    99
    1010  public class IntRangeVM : RangeVM<int> {
    11     public override Type JsonItemType => typeof(IntArrayJsonItem);
    12   }
     11    public override Type JsonItemType => typeof(IntRangeJsonItem);
    1312
    14   public class DoubleRangeVM : RangeVM<double> {
    15     public override Type JsonItemType => typeof(DoubleArrayJsonItem);
     13    protected override int MinTypeValue => int.MinValue;
     14
     15    protected override int MaxTypeValue => int.MaxValue;
     16
    1617    public override JsonItemBaseControl GetControl() =>
    1718      new JsonItemRangeControl(this);
    1819  }
    1920
    20   public abstract class RangeVM<T> : JsonItemVMBase {
     21  public class DoubleRangeVM : RangeVM<double> {
     22    public override Type JsonItemType => typeof(DoubleRangeJsonItem);
     23
     24    protected override double MinTypeValue => double.MinValue;
     25
     26    protected override double MaxTypeValue => double.MaxValue;
     27
     28    public override JsonItemBaseControl GetControl() =>
     29      new JsonItemRangeControl(this);
     30  }
     31
     32  public abstract class RangeVM<T> : RangedValueBaseVM<T> {
    2133
    2234    public T MinValue {
     
    3648    }
    3749
    38     public T MinRange {
    39       get => Cast(Item.Range.First());
    40       set {
    41         SetRange(value, Item.Range.Last());
    42         OnPropertyChange(this, nameof(MinRange));
    43       }
    44     }
    45 
    46     public T MaxRange {
    47       get => Cast(Item.Range.Last());
    48       set {
    49         SetRange(Item.Range.First(), value);
    50         OnPropertyChange(this, nameof(MaxRange));
    51       }
    52     }
    53 
    54     private T Cast(object obj) => (T)Convert.ChangeType(obj, typeof(T));
    55 
    5650    private void SetValue(object min, object max) =>
    5751      Item.Value = new object[] { min, max };
    58 
    59     private void SetRange(object min, object max) =>
    60       Item.Range = new object[] { min, max };
    6152  }
    6253}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/SingleValueVM.cs

    r17412 r17420  
    3838  }
    3939
    40   public abstract class SingleValueVM<T> : JsonItemVMBase {
     40  public abstract class SingleValueVM<T> : RangedValueBaseVM<T> {
    4141   
    4242    public T Value {
     
    4747      }
    4848    }
    49 
    50     public T MinRange {
    51       get => Cast(Item.Range.First());
    52       set {
    53         SetRange(value, Item.Range.Last());
    54         OnPropertyChange(this, nameof(MinRange));
    55       }
    56     }
    57 
    58     public T MaxRange {
    59       get => Cast(Item.Range.Last());
    60       set {
    61         SetRange(Item.Range.First(), value);
    62         OnPropertyChange(this, nameof(MaxRange));
    63       }
    64     }
    65 
    66     private bool enableMinRange = false;
    67     public bool EnableMinRange {
    68       get => enableMinRange;
    69       set {
    70         enableMinRange = value;
    71         if (!enableMinRange)
    72           MinRange = MinTypeValue;
    73         OnPropertyChange(this, nameof(EnableMinRange));
    74       }
    75     }
    76 
    77     private bool enableMaxRange = false;
    78     public bool EnableMaxRange {
    79       get => enableMaxRange;
    80       set {
    81         enableMaxRange = value;
    82         if (!enableMaxRange)
    83           MaxRange = MaxTypeValue;
    84         OnPropertyChange(this, nameof(EnableMaxRange));
    85       }
    86     }
    87 
    88     private T Cast(object obj) => (T)Convert.ChangeType(obj, typeof(T));
    89 
    90     private void SetRange(object min, object max) {
    91       object[] range = new object[] { min, max };
    92       Item.Range = range;
    93     }
    94 
    95     protected abstract T MinTypeValue { get; }
    96     protected abstract T MaxTypeValue { get; }
    9749  }
    9850}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemArrayValueControl.Designer.cs

    r17417 r17420  
    2424    /// </summary>
    2525    private void InitializeComponent() {
    26       components = new System.ComponentModel.Container();
     26      this.dataGridView = new System.Windows.Forms.DataGridView();
     27      this.numericRangeControl1 = new HeuristicLab.JsonInterface.OptimizerIntegration.NumericRangeControl();
     28      ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
     29      this.SuspendLayout();
     30      //
     31      // dataGridView
     32      //
     33      this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     34            | System.Windows.Forms.AnchorStyles.Left)
     35            | System.Windows.Forms.AnchorStyles.Right)));
     36      this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
     37      this.dataGridView.Location = new System.Drawing.Point(9, 75);
     38      this.dataGridView.Name = "dataGridView";
     39      this.dataGridView.Size = new System.Drawing.Size(487, 171);
     40      this.dataGridView.TabIndex = 13;
     41      //
     42      // numericRangeControl1
     43      //
     44      this.numericRangeControl1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
     45            | System.Windows.Forms.AnchorStyles.Right)));
     46      this.numericRangeControl1.Location = new System.Drawing.Point(9, 252);
     47      this.numericRangeControl1.Name = "numericRangeControl1";
     48      this.numericRangeControl1.Size = new System.Drawing.Size(487, 128);
     49      this.numericRangeControl1.TabIndex = 14;
     50      //
     51      // JsonItemArrayValueControl
     52      //
     53      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    2754      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     55      this.Controls.Add(this.numericRangeControl1);
     56      this.Controls.Add(this.dataGridView);
     57      this.Name = "JsonItemArrayValueControl";
     58      this.Size = new System.Drawing.Size(502, 386);
     59      this.Controls.SetChildIndex(this.dataGridView, 0);
     60      this.Controls.SetChildIndex(this.numericRangeControl1, 0);
     61      ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
     62      this.ResumeLayout(false);
     63      this.PerformLayout();
     64
    2865    }
    2966
    3067    #endregion
     68
     69    private System.Windows.Forms.DataGridView dataGridView;
     70    private NumericRangeControl numericRangeControl1;
    3171  }
    3272}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemArrayValueControl.cs

    r17417 r17420  
    1010
    1111namespace HeuristicLab.JsonInterface.OptimizerIntegration {
    12   public partial class JsonItemArrayValueControl : JsonItemBaseControl {
    13     public JsonItemArrayValueControl(JsonItemVMBase vm) : base(vm) {
     12 
     13  public class JsonItemIntArrayValueControl : JsonItemArrayValueControl {
     14    public JsonItemIntArrayValueControl(IntArrayValueVM vm) : base(vm, vm.Value) { }
     15  }
     16
     17  public class JsonItemDoubleArrayValueControl : JsonItemArrayValueControl {
     18    public JsonItemDoubleArrayValueControl(DoubleArrayValueVM vm) : base(vm, vm.Value) { }
     19  }
     20 
     21  public abstract partial class JsonItemArrayValueControl : JsonItemBaseControl {
     22    protected NumericRangeControl NumericRangeControl { get; set; }
     23
     24    public JsonItemArrayValueControl(JsonItemVMBase vm, object dataSource) : base(vm) {
    1425      InitializeComponent();
     26      dataGridView.DataSource = dataSource;
     27      NumericRangeControl = numericRangeControl1;
     28
     29      NumericRangeControl.TBMinRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM.MinRange));
     30      NumericRangeControl.TBMaxRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM.MaxRange));
     31      NumericRangeControl.EnableMinRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM.EnableMinRange),
     32        false, DataSourceUpdateMode.OnPropertyChanged);
     33      NumericRangeControl.EnableMaxRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM.EnableMaxRange),
     34        false, DataSourceUpdateMode.OnPropertyChanged);
    1535    }
    1636  }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemRangeControl.cs

    r17410 r17420  
    1414
    1515    public JsonItemRangeControl(DoubleRangeVM vm) : base(vm) {
     16      InitializeComponent();
     17      /*
     18      this.isDouble = isDouble;
     19      textBoxValueFrom.Text = ((Array)VM.Item.Value).GetValue(0).ToString();
     20      textBoxValueTo.Text = ((Array)VM.Item.Value).GetValue(1).ToString();
     21      textBoxValueFrom.Text = VM.Item.Range.First().ToString();
     22      textBoxValueTo.Text = VM.Item.Range.Last().ToString();
     23      */
     24    }
     25    public JsonItemRangeControl(IntRangeVM vm) : base(vm) {
    1626      InitializeComponent();
    1727      /*
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemValueControl.cs

    r17417 r17420  
    1616    #region Overriden Properties
    1717    protected override string ValuePropertyId => nameof(IntValueVM.Value);
    18     protected override string MinRangePropertyId => nameof(IntValueVM.MinRange);
    19     protected override string MaxRangePropertyId => nameof(IntValueVM.MaxRange);
    20     protected override string EnableMinRangePropertyId => nameof(IntValueVM.EnableMinRange);
    21     protected override string EnableMaxRangePropertyId => nameof(IntValueVM.EnableMaxRange);
    2218    #endregion
    2319
     
    3228    #region Overriden Properties
    3329    protected override string ValuePropertyId => nameof(DoubleValueVM.Value);
    34     protected override string MinRangePropertyId => nameof(DoubleValueVM.MinRange);
    35     protected override string MaxRangePropertyId => nameof(DoubleValueVM.MaxRange);
    36     protected override string EnableMinRangePropertyId => nameof(DoubleValueVM.EnableMinRange);
    37     protected override string EnableMaxRangePropertyId => nameof(DoubleValueVM.EnableMaxRange);
    3830    #endregion
    3931
     
    5244    #region Abstract Properties
    5345    protected abstract string ValuePropertyId { get; }
    54     protected abstract string MinRangePropertyId { get; }
    55     protected abstract string MaxRangePropertyId { get; }
    56     protected abstract string EnableMinRangePropertyId { get; }
    57     protected abstract string EnableMaxRangePropertyId { get; }
    5846    #endregion
    5947
     
    6654    protected void Init() {
    6755      TBValue.DataBindings.Add("Text", base.VM, ValuePropertyId);
    68       NumericRangeControl.TBMinRange.DataBindings.Add("Text", VM, MinRangePropertyId);
    69       NumericRangeControl.TBMaxRange.DataBindings.Add("Text", VM, MaxRangePropertyId);
    70       NumericRangeControl.EnableMinRange.DataBindings.Add("Checked", VM, EnableMinRangePropertyId,
     56      NumericRangeControl.TBMinRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM.MinRange));
     57      NumericRangeControl.TBMaxRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM.MaxRange));
     58      NumericRangeControl.EnableMinRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM.EnableMinRange),
    7159        false, DataSourceUpdateMode.OnPropertyChanged);
    72       NumericRangeControl.EnableMaxRange.DataBindings.Add("Checked", VM, EnableMaxRangePropertyId,
     60      NumericRangeControl.EnableMaxRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM.EnableMaxRange),
    7361        false, DataSourceUpdateMode.OnPropertyChanged);
    7462    }
  • 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.