Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/GenericJsonItem.cs @ 17410

Last change on this file since 17410 was 17410, checked in by dpiringe, 4 years ago

#3026:

  • deleted JsonItemArrayControl and JsonItemDefaultControl
  • redesigned architecture for JsonItem: now there are different types of JsonItem (IntJsonItem, BoolJsonItem, ...) -> for better type safety and expandability
  • fixed bug in BaseConverter for GetMinValue and GetMaxValue for IntValue, but ignored for other value types (DoubleValue, DateTimeValue, ...) because the redesign of JsonItem-Architecture can make these two methods obsolet soon
  • fixed bug in JsonItemConverter to prevent null pointer exceptions
  • refactored value and range converters -> removed complicated generic ValueTypeValueConverter and ValueRangeConverter and implemented the necessary methods directly in concrete classes (improves readability and removes the need of reflection)
  • redesigned view handling in OptimizerIntegration -> dynamically seaches for JsonItemVMBase implementations, which are connected with a view
    • this enables better scaling with more user controls
  • JsonItemVMBase implements MVVM architecture
File size: 529 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6
7namespace HeuristicLab.JsonInterface {
8
9  public class JsonItem<T> : JsonItem<T,T> { }
10
11  public class JsonItem<V,R> : JsonItem {
12    public new V Value {
13      get => (V)Convert.ChangeType(base.Value, typeof(V));
14      set => base.Value = value;
15    }
16
17    public new IEnumerable<R> Range {
18      get => base.Range.Cast<R>();
19      set => base.Range = value.Cast<object>();
20    }
21  }
22}
Note: See TracBrowser for help on using the repository browser.