Changeset 17473 for branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/JsonItem.cs
- Timestamp:
- 03/10/20 17:17:37 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/JsonItem.cs
r17471 r17473 11 11 /// Main data class for json interface. 12 12 /// </summary> 13 public class JsonItem : IJsonItem {13 public abstract class JsonItem : IJsonItem { 14 14 15 15 public class JsonItemValidator : IJsonItemValidator { … … 25 25 } 26 26 27 // TODO: return ValidationResult ? 27 28 private bool ValidateHelper(JsonItem item, ref IList<IJsonItem> faultyItems) { 28 29 int hash = item.GetHashCode(); … … 30 31 return r; 31 32 32 bool res = true; 33 if (item.Value != null && item.Range != null) 34 res = item.IsInRange(); 33 bool res = item.Validate(); 35 34 if (!res) faultyItems.Add(item); 36 35 Cache.Add(hash, res); 37 if(item.Children != null) 36 if(item.Children != null) { 38 37 foreach (var child in item.Children) 39 res = res && ValidateHelper(child as JsonItem, ref faultyItems); 38 if (!ValidateHelper(child as JsonItem, ref faultyItems)) 39 res = false && res; 40 } 40 41 return res; 41 42 } … … 62 63 } 63 64 64 public virtual object Value { get; set; }65 //public virtual object Value { get; set; } 65 66 66 public virtual IEnumerable<object> Range { get; set; }67 //public virtual IEnumerable<object> Range { get; set; } 67 68 68 69 // TODO jsonIgnore dataType? … … 105 106 106 107 public virtual void SetFromJObject(JObject jObject) { 107 Value = jObject[nameof(IJsonItem.Value)]?.ToObject<object>();108 Range = jObject[nameof(IJsonItem.Range)]?.ToObject<object[]>();108 //Value = jObject[nameof(IJsonItem.Value)]?.ToObject<object>(); 109 //Range = jObject[nameof(IJsonItem.Range)]?.ToObject<object[]>(); 109 110 } 110 111 #endregion … … 114 115 * TODO protected abstract bool Validate(); 115 116 */ 116 117 protected abstract bool Validate(); 118 /* 117 119 protected virtual bool IsInRange() { 118 120 bool b1 = true, b2 = true; … … 156 158 (((T)max).CompareTo(value) == 1 || ((T)max).CompareTo(value) == 0); 157 159 } 160 */ 158 161 #endregion 159 162 }
Note: See TracChangeset
for help on using the changeset viewer.