Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItems/IntJsonItems.cs @ 18055

Last change on this file since 18055 was 18055, checked in by dpiringe, 13 months ago

#3026

  • added StorableTypeAttribute and StorableConstructorAttribute to all JsonItems
  • added a new JsonItem ListJsonItem + Interfaces IListJsonItem
  • renamed SymRegPythonProcessor to RunCollectionSRSolutionPythonFormatter
  • removed Interface IResultCollectionProcessor -> using the interface IRunCollectionModifier now (has aleady implementations)
  • renamed all related variables/fields/properties with a connection to ResultCollectionProcessor
  • added new implementations for IRunCollectionModifier
File size: 3.0 KB
Line 
1using Newtonsoft.Json.Linq;
2using HEAL.Attic;
3
4namespace HeuristicLab.JsonInterface {
5  [StorableType("4FFDAC9B-34F3-4FDB-ABD1-BB2128CE5A49")]
6  public class IntJsonItem : IntervalRestrictedValueJsonItem<int> {
7    public override JObject GenerateJObject() {
8      var obj = base.GenerateJObject();
9
10      if (Minimum.CompareTo(int.MinValue) == 0)
11        obj.Property("Minimum").Remove();
12
13      if (Maximum.CompareTo(int.MaxValue) == 0)
14        obj.Property("Maximum").Remove();
15
16      return obj;
17    }
18
19    public override void SetJObject(JObject jObject) {
20      Minimum = int.MinValue;
21      Maximum = int.MaxValue;
22      base.SetJObject(jObject);
23    }
24
25    public IntJsonItem() { }
26
27    [StorableConstructor]
28    protected IntJsonItem(StorableConstructorFlag _) : base(_) { }
29  }
30
31  [StorableType("73E22461-6CA0-4BE1-A5FE-9EF7FFD320AD")]
32  public class IntArrayJsonItem : IntervalRestrictedArrayJsonItem<int> {
33    public override JObject GenerateJObject() {
34      var obj = base.GenerateJObject();
35
36      if (Minimum.CompareTo(int.MinValue) == 0)
37        obj.Property("Minimum").Remove();
38
39      if (Maximum.CompareTo(int.MaxValue) == 0)
40        obj.Property("Maximum").Remove();
41
42      return obj;
43    }
44
45    public override void SetJObject(JObject jObject) {
46      Minimum = int.MinValue;
47      Maximum = int.MaxValue;
48      base.SetJObject(jObject);
49    }
50
51    public IntArrayJsonItem() { }
52
53    [StorableConstructor]
54    protected IntArrayJsonItem(StorableConstructorFlag _) : base(_) { }
55  }
56
57  [StorableType("A6FBA509-FC37-4E54-9578-5AFB764CFB89")]
58  public class IntRangeJsonItem : RangedJsonItem<int> {
59    public override JObject GenerateJObject() {
60      var obj = base.GenerateJObject();
61
62      if (Minimum.CompareTo(int.MinValue) == 0)
63        obj.Property("Minimum").Remove();
64
65      if (Maximum.CompareTo(int.MaxValue) == 0)
66        obj.Property("Maximum").Remove();
67
68      return obj;
69    }
70
71    public override void SetJObject(JObject jObject) {
72      Minimum = int.MinValue;
73      Maximum = int.MaxValue;
74      base.SetJObject(jObject);
75    }
76
77    public IntRangeJsonItem() { }
78
79    [StorableConstructor]
80    protected IntRangeJsonItem(StorableConstructorFlag _) : base(_) { }
81  }
82
83  [StorableType("3CFF8D3E-8608-41BA-85A5-42CD4DA45685")]
84  public class IntMatrixJsonItem : IntervalRestrictedMatrixJsonItem<int> {
85    public override JObject GenerateJObject() {
86      var obj = base.GenerateJObject();
87
88      if (Minimum.CompareTo(int.MinValue) == 0)
89        obj.Property("Minimum").Remove();
90
91      if (Maximum.CompareTo(int.MaxValue) == 0)
92        obj.Property("Maximum").Remove();
93
94      return obj;
95    }
96
97    public override void SetJObject(JObject jObject) {
98      Minimum = int.MinValue;
99      Maximum = int.MaxValue;
100      base.SetJObject(jObject);
101    }
102
103    public IntMatrixJsonItem() { }
104
105    [StorableConstructor]
106    protected IntMatrixJsonItem(StorableConstructorFlag _) : base(_) { }
107  }
108}
Note: See TracBrowser for help on using the repository browser.