Changeset 17439 for branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItemConverter.cs
- Timestamp:
- 02/17/20 15:13:17 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItemConverter.cs
r17410 r17439 20 20 = new Dictionary<Type, IJsonItemConverter>(); 21 21 22 private IDictionary<int, IJsonItem> Cache { get; set; } 22 private IDictionary<int, IJsonItem> InjectCache { get; set; } 23 = new Dictionary<int, IJsonItem>(); 24 25 private IDictionary<int, IJsonItem> ExtractCache { get; set; } 23 26 = new Dictionary<int, IJsonItem>(); 24 27 … … 52 55 53 56 public void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { 54 if (item != null && !Cache.ContainsKey(item.GetHashCode())) {57 if (item != null && !InjectCache.ContainsKey(item.GetHashCode())) { 55 58 IJsonItemConverter converter = GetConverter(item.GetType()); 56 59 if(converter != null) converter.Inject(item, data, root); 60 InjectCache.Add(item.GetHashCode(), data); 57 61 } 58 62 } … … 60 64 public IJsonItem Extract(IItem item, IJsonItemConverter root) { 61 65 int hash = item.GetHashCode(); 62 if ( Cache.TryGetValue(hash, out IJsonItem val))66 if (ExtractCache.TryGetValue(hash, out IJsonItem val)) 63 67 return val; 64 68 else { … … 66 70 if (converter == null) return new UnsupportedJsonItem(); 67 71 IJsonItem tmp = GetConverter(item.GetType()).Extract(item, root); 68 Cache.Add(hash, tmp);72 ExtractCache.Add(hash, tmp); 69 73 return tmp; 70 74 }
Note: See TracChangeset
for help on using the changeset viewer.