Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/IntJsonItems.cs @ 17446

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

#3026:

  • made interfaces for array/matrix JsonItems and for their VMs aswell (IArrayJsonItem, IArrayJsonItemVM, IMatrixJsonItem, IMatrixJsonItemVM), incl. base classes (ArrayJsonItemBase, ArrayValueVM, MatrixJsonItemBase, MatrixValueVM)
  • changed inheritance structure for already existing array/matrix JsonItems -> they inherit now from new base array/matrix base classes
  • added input elements to configure the size of an matrix or array in JsonItemMultiValueControl (incl. VM binding and validation)
  • splitted file JsonItems.cs into separate files for their corresponding types (IntJsonItems.cs, DoubleJsonItems.cs, BoolJsonItems.cs, StringJsonItem.cs, DateTimeJsonItem.cs)
  • changed location of deserialization of json values from JsonTemplateInstantiator into IJsonItem (implemented in JsonItem and set to virtual, overridden in MatrixJsonItemBase and ArrayJsonItemBase)
  • added new CLI argument StringArgument
  • some little UI improvements (location fixes, anchor fixes, ...)
File size: 767 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6
7namespace HeuristicLab.JsonInterface {
8  public class IntJsonItem : JsonItem<int> { }
9  public class IntArrayJsonItem : ArrayJsonItemBase<int> { }
10  public class IntRangeJsonItem : ArrayJsonItemBase<int> {
11    public override bool Resizable { get => false; set { } }
12  }
13  public class IntMatrixJsonItem : MatrixJsonItemBase<int> {
14
15    protected override bool IsInRange() {
16      for (int c = 0; c < Value.Length; ++c) {
17        for (int r = 0; r < Value[c].Length; ++r) {
18          if (Value[c][r] < Range.First() && Range.Last() < Value[c][r])
19            return false;
20        }
21      }
22      return true;
23    }
24  }
25}
Note: See TracBrowser for help on using the repository browser.