- Timestamp:
- 04/25/18 01:16:06 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2916_IndexedDataTableSerialization/HeuristicLab.Analysis/3.3/DataVisualization/IndexedDataRow.cs
r15583 r15918 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 24 using System.ComponentModel; 25 using System.Linq; 22 26 using HeuristicLab.Collections; 23 27 using HeuristicLab.Common; 24 28 using HeuristicLab.Core; 25 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using System;27 using System.Collections.Generic;28 using System.ComponentModel;29 using System.Linq;30 30 31 31 namespace HeuristicLab.Analysis { … … 58 58 set { visualProperties = value; } 59 59 } 60 [Storable(Name = "values")] 60 // BackwardsCompatibility3.3 61 #region Backwards compatible code, remove with 3.4 62 // tuples are stored inefficiently 63 [Storable(Name = "values", AllowOneWay = true)] 61 64 private IEnumerable<Tuple<T, double>> StorableValues { 62 get { return values; }63 65 set { values = new ObservableList<Tuple<T, double>>(value); } 66 } 67 #endregion 68 private T[] storableX; 69 [Storable(Name = "x")] 70 private T[] StorableX { 71 get { return Values.Select(x => x.Item1).ToArray(); } 72 set { storableX = value; } 73 } 74 private double[] storableY; 75 [Storable(Name = "y")] 76 private double[] StorableY { 77 get { return Values.Select(x => x.Item2).ToArray(); } 78 set { storableY = value; } 64 79 } 65 80 #endregion … … 109 124 VisualProperties.DisplayName = Name; 110 125 } 126 127 [StorableHook(HookType.AfterDeserialization)] 128 private void AfterDeserialization() { 129 if (storableX != null && storableY != null) { 130 values = new ObservableList<Tuple<T, double>>(storableX.Zip(storableY, (x, y) => Tuple.Create(x, y))); 131 storableX = null; 132 storableY = null; 133 } else if (values == null) throw new InvalidOperationException("Deserialization problem with IndexedDataRow."); 134 } 111 135 } 112 136 }
Note: See TracChangeset
for help on using the changeset viewer.