1 | using Newtonsoft.Json.Linq;
|
---|
2 |
|
---|
3 | namespace HeuristicLab.JsonInterface {
|
---|
4 | public class DoubleJsonItem : IntervalRestrictedValueJsonItem<double> {
|
---|
5 | public override JObject GenerateJObject() {
|
---|
6 | var obj = base.GenerateJObject();
|
---|
7 |
|
---|
8 | if (Minimum.CompareTo(double.MinValue) == 0)
|
---|
9 | obj.Property("Minimum").Remove();
|
---|
10 |
|
---|
11 | if (Maximum.CompareTo(double.MaxValue) == 0)
|
---|
12 | obj.Property("Maximum").Remove();
|
---|
13 |
|
---|
14 | return obj;
|
---|
15 | }
|
---|
16 |
|
---|
17 | public override void SetJObject(JObject jObject) {
|
---|
18 | Minimum = double.MinValue;
|
---|
19 | Maximum = double.MaxValue;
|
---|
20 | base.SetJObject(jObject);
|
---|
21 | }
|
---|
22 | }
|
---|
23 | public class DoubleArrayJsonItem : IntervalRestrictedArrayJsonItem<double> {
|
---|
24 | public override JObject GenerateJObject() {
|
---|
25 | var obj = base.GenerateJObject();
|
---|
26 |
|
---|
27 | if (Minimum.CompareTo(double.MinValue) == 0)
|
---|
28 | obj.Property("Minimum").Remove();
|
---|
29 |
|
---|
30 | if (Maximum.CompareTo(double.MaxValue) == 0)
|
---|
31 | obj.Property("Maximum").Remove();
|
---|
32 |
|
---|
33 | return obj;
|
---|
34 | }
|
---|
35 |
|
---|
36 | public override void SetJObject(JObject jObject) {
|
---|
37 | Minimum = double.MinValue;
|
---|
38 | Maximum = double.MaxValue;
|
---|
39 | base.SetJObject(jObject);
|
---|
40 | }
|
---|
41 | }
|
---|
42 | public class DoubleRangeJsonItem : RangedJsonItem<double> {
|
---|
43 | public override JObject GenerateJObject() {
|
---|
44 | var obj = base.GenerateJObject();
|
---|
45 |
|
---|
46 | if (Minimum.CompareTo(double.MinValue) == 0)
|
---|
47 | obj.Property("Minimum").Remove();
|
---|
48 |
|
---|
49 | if (Maximum.CompareTo(double.MaxValue) == 0)
|
---|
50 | obj.Property("Maximum").Remove();
|
---|
51 |
|
---|
52 | return obj;
|
---|
53 | }
|
---|
54 |
|
---|
55 | public override void SetJObject(JObject jObject) {
|
---|
56 | Minimum = double.MinValue;
|
---|
57 | Maximum = double.MaxValue;
|
---|
58 | base.SetJObject(jObject);
|
---|
59 | }
|
---|
60 | }
|
---|
61 | public class DoubleMatrixJsonItem : IntervalRestrictedMatrixJsonItem<double> {
|
---|
62 | public override JObject GenerateJObject() {
|
---|
63 | var obj = base.GenerateJObject();
|
---|
64 |
|
---|
65 | if (Minimum.CompareTo(double.MinValue) == 0)
|
---|
66 | obj.Property("Minimum").Remove();
|
---|
67 |
|
---|
68 | if (Maximum.CompareTo(double.MaxValue) == 0)
|
---|
69 | obj.Property("Maximum").Remove();
|
---|
70 |
|
---|
71 | return obj;
|
---|
72 | }
|
---|
73 |
|
---|
74 | public override void SetJObject(JObject jObject) {
|
---|
75 | Minimum = double.MinValue;
|
---|
76 | Maximum = double.MaxValue;
|
---|
77 | base.SetJObject(jObject);
|
---|
78 | }
|
---|
79 | }
|
---|
80 | }
|
---|