Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/23/21 16:36:44 (3 years ago)
Author:
dpiringe
Message:

#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
Location:
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/ArrayValueVM.cs

    r17828 r17843  
    11using System;
    2 using System.Collections.Generic;
    3 using System.ComponentModel;
    4 using System.Linq;
    5 using System.Text;
    6 using System.Threading.Tasks;
    72using System.Windows.Forms;
    83
     
    1712    public ArrayValueVM() { }
    1813   
    19     public abstract T[] Value { get; set; }
    2014    public bool Resizable {
    2115      get => Item.Resizable;
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/ConcreteRestrictedJsonItemVM.cs

    r17828 r17843  
    1 using System;
    2 using System.Collections.Generic;
     1using System.Collections.Generic;
    32using System.Linq;
    4 using System.Text;
    5 using System.Threading.Tasks;
    63using System.Windows.Forms;
    74
     
    1714    public override UserControl Control {
    1815      get {
    19         var control = new ConcreteItemsRestrictor();
    20         control.Init(Item.ConcreteRestrictedItems);
     16        var control = ConcreteItemsRestrictor.Create(Item.ConcreteRestrictedItems);
    2117        control.OnChecked += AddComboOption;
    2218        control.OnUnchecked += RemoveComboOption;
    2319        return control;
    24       }
    25     }
    26 
    27     public V Value {
    28       get => Item.Value;
    29       set {
    30         Item.Value = value;
    31         OnPropertyChange(this, nameof(Value));
    3220      }
    3321    }
     
    4028
    4129        if (!RangeContainsValue()) {
    42           Value = GetDefaultValue();
     30          Item.Value = GetDefaultValue();
    4331
    4432          //if no elements exists -> deselect item
    4533          if (Range.Count() == 0)
    4634            base.Selected = false;
    47 
    48           OnPropertyChange(this, nameof(Value));
    4935        }
    5036
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/DoubleVMs.cs

    r17828 r17843  
    1 using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
    5 using System.Threading.Tasks;
    6 using System.Windows.Forms;
    7 
    8 namespace HeuristicLab.JsonInterface.OptimizerIntegration {
     1namespace HeuristicLab.JsonInterface.OptimizerIntegration {
    92  public class DoubleRangeVM : RangeVM<double, DoubleRangeJsonItem> {
    103    protected override double MinTypeValue => double.MinValue;
     
    158    protected override double MinTypeValue => double.MinValue;
    169    protected override double MaxTypeValue => double.MaxValue;
    17     public override double[] Value {
    18       get => Item.Value;
    19       set {
    20         Item.Value = value;
    21         OnPropertyChange(this, nameof(Value));
    22       }
    23     }
    2410  }
    2511
    2612  public class DoubleMatrixValueVM : MatrixValueVM<double, DoubleMatrixJsonItem> {
    27     public override double[][] Value {
    28       get => Item.Value;
    29       set {
    30         Item.Value = value;
    31         OnPropertyChange(this, nameof(Value));
    32       }
    33     }
    3413    protected override double MinTypeValue => double.MinValue;
    3514    protected override double MaxTypeValue => double.MaxValue;
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/IntVMs.cs

    r17828 r17843  
    1 using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
    5 using System.Threading.Tasks;
    6 using System.Windows.Forms;
    7 
    8 namespace HeuristicLab.JsonInterface.OptimizerIntegration {
     1namespace HeuristicLab.JsonInterface.OptimizerIntegration {
    92  public class IntArrayValueVM : ArrayValueVM<int, IntArrayJsonItem> {
    103    protected override int MinTypeValue => int.MinValue;
    114    protected override int MaxTypeValue => int.MaxValue;
    12 
    13     public override int[] Value {
    14       get => Item.Value;
    15       set {
    16         Item.Value = value;
    17         OnPropertyChange(this, nameof(Value));
    18       }
    19     }
    205  }
    216
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/JsonItemVMBase.cs

    r17828 r17843  
    11using System;
    2 using System.Collections.Generic;
    32using System.ComponentModel;
    43using System.Drawing;
    5 using System.Linq;
    6 using System.Text;
    7 using System.Threading.Tasks;
    84using System.Windows.Forms;
    95
     
    2117      get => item;
    2218      set {
    23         item?.LoosenPath();
    2419        item = value;
    25         item.FixatePath();
    2620        ItemChanged?.Invoke();
    2721      }
     
    6559    public event Action SelectedChanged;
    6660
    67 
    6861    protected void OnPropertyChange(object sender, string propertyName) {
    6962      // Make a temporary copy of the event to avoid possibility of
     
    7568      tmp?.Invoke(this, new PropertyChangedEventArgs(propertyName));
    7669    }
    77    
    78     #region IDisposable Support
    79     private bool disposedValue = false; // To detect redundant calls
    80 
    81     protected virtual void Dispose(bool disposing) {
    82       if (!disposedValue) {
    83         if (disposing) {
    84           item.LoosenPath();
    85           item = null;
    86         }
    87         disposedValue = true;
    88       }
    89     }
    90 
    91     // This code added to correctly implement the disposable pattern.
    92     public void Dispose() {
    93       // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
    94       Dispose(true);
    95     }
    96     #endregion
    9770  }
    9871}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/LookupJsonItemVM.cs

    r17828 r17843  
    1 using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
    5 using System.Threading.Tasks;
    6 using System.Windows.Forms;
     1using System.Windows.Forms;
    72
    83namespace HeuristicLab.JsonInterface.OptimizerIntegration {
    94  public class LookupJsonItemVM : JsonItemVMBase<LookupJsonItem>, ILookupJsonItemVM {
    105    public override UserControl Control => null;
    11     public string ActualName {
    12       get => Item.ActualName;
    13       set {
    14         Item.ActualName = value;
    15         OnPropertyChange(this, nameof(ActualName));
    16       }
    17     }
    186  }
    197}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/MatrixValueVM.cs

    r17828 r17843  
    11using System;
    22using System.Collections.Generic;
    3 using System.ComponentModel;
    4 using System.Linq;
    5 using System.Text;
    6 using System.Threading.Tasks;
    73using System.Windows.Forms;
    84
     
    1612    public override UserControl Control => CompoundControl.Create(base.Control, MatrixJsonItemControl.Create(this));
    1713
    18     public abstract T[][] Value { get; set; }
    1914    public bool RowsResizable {
    2015      get => Item.RowsResizable;
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/RangeVM.cs

    r17519 r17843  
    11using System;
    2 using System.Collections.Generic;
    3 using System.ComponentModel;
    4 using System.Linq;
    5 using System.Text;
    6 using System.Threading.Tasks;
    7 using System.Windows.Forms;
    8 
    92namespace HeuristicLab.JsonInterface.OptimizerIntegration {
    10 
    113  public abstract class RangeVM<T, JsonItemType> : RangedValueBaseVM<T, JsonItemType>
    124    where T : IComparable
    135    where JsonItemType : class, IRangedJsonItem<T>
    14   {
    15 
    16     public T MinValue {
    17       get => Item.MinValue;
    18       set {
    19         Item.MinValue = value;
    20         OnPropertyChange(this, nameof(MinValue));
    21       }
    22     }
    23 
    24     public T MaxValue {
    25       get => Item.MaxValue;
    26       set {
    27         Item.MaxValue = value;
    28         OnPropertyChange(this, nameof(MaxValue));
    29       }
    30     }
    31   }
     6  { }
    327}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/RangedValueBaseVM.cs

    r17828 r17843  
    11using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
    5 using System.Threading.Tasks;
    62using System.Windows.Forms;
    73
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/ResultItemVM.cs

    r17834 r17843  
    11using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
    5 using System.Threading.Tasks;
    62using System.Windows.Forms;
    73
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/SingleValueVM.cs

    r17828 r17843  
    11using System;
    2 using System.Collections.Generic;
    3 using System.ComponentModel;
    4 using System.Linq;
    5 using System.Text;
    6 using System.Threading.Tasks;
    72using System.Windows.Forms;
    83
     
    105
    116  public class BoolValueVM : JsonItemVMBase<BoolJsonItem> {
    12 
    13     public bool Value {
    14       get => Item.Value;
    15       set {
    16         Item.Value = value;
    17         OnPropertyChange(this, nameof(Value));
    18       }
    19     }
    20    
    217    public override UserControl Control => null;
    228  }
     
    2511    where T : IComparable
    2612    where JsonItemType : class, IIntervalRestrictedJsonItem<T>, IValueJsonItem<T>
    27   {
    28 
    29     public T Value {
    30       get => Item.Value;
    31       set {
    32         Item.Value = value;
    33         OnPropertyChange(this, nameof(Value));
    34       }
    35     }
    36   }
     13  { }
    3714}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/StringValueVM.cs

    r17828 r17843  
    22
    33namespace HeuristicLab.JsonInterface.OptimizerIntegration {
    4 
    54  public class StringValueVM : ConcreteRestrictedJsonItemVM<StringJsonItem, string, string> {
    65    protected override string GetDefaultValue() => Range.FirstOrDefault();
    7 
    8     protected override bool RangeContainsValue() => Range.Contains(Value);
     6    protected override bool RangeContainsValue() => Range.Contains(Item.Value);
    97  }
    108
    119  public class StringArrayVM : ConcreteRestrictedJsonItemVM<StringArrayJsonItem, string, string[]> {
    1210    protected override string[] GetDefaultValue() => Range.ToArray();
    13 
    14     protected override bool RangeContainsValue() => Value.All(x => Range.Any(y => x == y));
     11    protected override bool RangeContainsValue() => Item.Value.All(x => Range.Any(y => x == y));
    1512  }
    1613}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/ValueLookupJsonItemVM.cs

    r17477 r17843  
    11using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
    5 using System.Threading.Tasks;
    62using System.Windows.Forms;
    73
     
    95  public class ValueLookupJsonItemVM : LookupJsonItemVM, IValueLookupJsonItemVM {
    106    public override Type TargetedJsonItemType => typeof(ValueLookupJsonItem);
    11     public override UserControl Control => new ValueLookupJsonItemControl(this);
     7    public override UserControl Control => ValueLookupJsonItemControl.Create(this);
    128    public IJsonItem JsonItemReference => ((IValueLookupJsonItem)Item).ActualValue;
    139
Note: See TracChangeset for help on using the changeset viewer.