Changeset 9308
- Timestamp:
- 03/12/13 12:20:25 (12 years ago)
- Location:
- branches/ImprovingStringConvertibleMatrix
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ImprovingStringConvertibleMatrix/HeuristicLab.Data.Views/3.3/StringConvertibleArrayView.cs
r7984 r9308 23 23 using System.ComponentModel; 24 24 using System.Drawing; 25 using System.Linq; 25 26 using System.Text; 26 27 using System.Windows.Forms; 27 using HeuristicLab.Common;28 28 using HeuristicLab.MainForm; 29 29 using HeuristicLab.MainForm.WindowsForms; … … 53 53 54 54 protected override void DeregisterContentEvents() { 55 Content. ItemChanged -= new EventHandler<EventArgs<int>>(Content_ItemChanged);55 Content.ColumnNamesChanged -= new EventHandler(Content_ColumnNamesChanged); 56 56 Content.Reset -= new EventHandler(Content_Reset); 57 Content.ItemsChanged -= new EventHandler<ArrayValuesChangedEventArgs>(Content_ItemsChanged); 57 58 base.DeregisterContentEvents(); 58 59 } … … 60 61 protected override void RegisterContentEvents() { 61 62 base.RegisterContentEvents(); 62 Content.Item Changed += new EventHandler<EventArgs<int>>(Content_ItemChanged);63 Content.ItemsChanged += new EventHandler<ArrayValuesChangedEventArgs>(Content_ItemsChanged); 63 64 Content.Reset += new EventHandler(Content_Reset); 65 Content.ColumnNamesChanged -= new EventHandler(Content_ColumnNamesChanged); 64 66 } 65 67 … … 94 96 dataGridView.Rows[i].Cells[0].Value = Content.GetValue(i); 95 97 } 98 96 99 dataGridView.Columns[0].Width = dataGridView.Columns[0].GetPreferredWidth(DataGridViewAutoSizeColumnMode.AllCells, true); 97 100 } 101 UpdateRowHeaders(); 102 dataGridView.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders); 98 103 dataGridView.Enabled = true; 99 104 } 100 105 101 private void Content_ItemChanged(object sender, EventArgs<int> e) { 106 protected virtual void UpdateRowHeaders() { 107 for (int i = 0; i < dataGridView.RowCount; i++) { 108 if (i < Content.ColumnNames.Count()) 109 dataGridView.Rows[i].HeaderCell.Value = Content.ColumnNames.ElementAt(i); 110 else 111 dataGridView.Rows[i].HeaderCell.Value = "Column " + (i + 1); 112 } 113 } 114 115 private void Content_ItemsChanged(object sender, ArrayValuesChangedEventArgs e) { 102 116 if (InvokeRequired) 103 Invoke(new EventHandler< EventArgs<int>>(Content_ItemChanged), sender, e);117 Invoke(new EventHandler<ArrayValuesChangedEventArgs>(Content_ItemsChanged), sender, e); 104 118 else { 105 dataGridView.Rows[e.Value].Cells[0].Value = Content.GetValue(e.Value); 106 Size size = dataGridView.Rows[e.Value].Cells[0].PreferredSize; 107 dataGridView.Columns[0].Width = Math.Max(dataGridView.Columns[0].Width, size.Width); 108 } 119 foreach (var index in e.Value) { 120 dataGridView.Rows[index].Cells[0].Value = Content.GetValue(index); 121 Size size = dataGridView.Rows[index].Cells[0].PreferredSize; 122 dataGridView.Columns[0].Width = Math.Max(dataGridView.Columns[0].Width, size.Width); 123 } 124 } 125 } 126 private void Content_ColumnNamesChanged(object sender, EventArgs e) { 127 if (InvokeRequired) 128 Invoke(new EventHandler(Content_ColumnNamesChanged), sender, e); 129 else 130 UpdateRowHeaders(); 109 131 } 110 132 private void Content_Reset(object sender, EventArgs e) { -
branches/ImprovingStringConvertibleMatrix/HeuristicLab.Data/3.3/BoolArray.cs
r7259 r9308 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 22 25 using System.Text; 23 26 using HeuristicLab.Common; … … 28 31 [Item("BoolArray", "Represents an array of boolean values.")] 29 32 [StorableClass] 30 public class BoolArray : ValueTypeArray<bool> , IStringConvertibleArray{33 public class BoolArray : ValueTypeArray<bool> { 31 34 [StorableConstructor] 32 35 protected BoolArray(bool deserializing) : base(deserializing) { } … … 42 45 } 43 46 44 protected virtualbool Validate(string value, out string errorMessage) {47 protected override bool Validate(string value, out string errorMessage) { 45 48 bool val; 46 49 bool valid = bool.TryParse(value, out val); … … 55 58 return valid; 56 59 } 57 protected virtualstring GetValue(int index) {60 protected override string GetValue(int index) { 58 61 return this[index].ToString(); 59 62 } 60 protected virtual bool SetValue(string value, int index) { 63 protected override bool SetValue(string value, int index) { 64 if (ReadOnly) throw new NotSupportedException("Item cannot be set. ValueTypeArray is read-only."); 61 65 bool val; 62 66 if (bool.TryParse(value, out val)) { … … 68 72 } 69 73 70 #region IStringConvertibleArray Members 71 int IStringConvertibleArray.Length { 72 get { return Length; } 73 set { Length = value; } 74 protected override bool SetValues(IEnumerable<ArrayValue<string>> arrayValues) { 75 if (ReadOnly) throw new NotSupportedException("Item cannot be set. ValueTypeArray is read-only."); 76 bool parsed; 77 if (!arrayValues.All(v => bool.TryParse(v.Value, out parsed))) return false; 78 List<int> positions = new List<int>(); 79 foreach (var v in arrayValues) { 80 parsed = bool.Parse(v.Value); 81 if (array[v.Index] != parsed) { 82 array[v.Index] = parsed; 83 positions.Add(v.Index); 84 } 85 } 86 OnItemsChanged(positions); 87 return true; 74 88 } 75 bool IStringConvertibleArray.Validate(string value, out string errorMessage) {76 return Validate(value, out errorMessage);77 }78 string IStringConvertibleArray.GetValue(int index) {79 return GetValue(index);80 }81 bool IStringConvertibleArray.SetValue(string value, int index) {82 return SetValue(value, index);83 }84 #endregion85 89 } 86 90 } -
branches/ImprovingStringConvertibleMatrix/HeuristicLab.Data/3.3/BoolMatrix.cs
r9306 r9308 66 66 } 67 67 protected override bool SetValue(string value, int rowIndex, int columnIndex) { 68 if (ReadOnly) throw new NotSupportedException("Item cannot be set. BoolMatrix is read-only."); 68 69 bool val; 69 70 if (bool.TryParse(value, out val)) { … … 86 87 } 87 88 } 89 OnItemsChanged(positions); 88 90 return true; 89 91 } -
branches/ImprovingStringConvertibleMatrix/HeuristicLab.Data/3.3/DoubleArray.cs
r7259 r9308 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 22 25 using System.Text; 23 26 using HeuristicLab.Common; … … 28 31 [Item("DoubleArray", "Represents an array of double values.")] 29 32 [StorableClass] 30 public class DoubleArray : ValueTypeArray<double> , IStringConvertibleArray{33 public class DoubleArray : ValueTypeArray<double> { 31 34 [StorableConstructor] 32 35 protected DoubleArray(bool deserializing) : base(deserializing) { } … … 42 45 } 43 46 44 protected virtualbool Validate(string value, out string errorMessage) {47 protected override bool Validate(string value, out string errorMessage) { 45 48 double val; 46 49 bool valid = double.TryParse(value, out val); … … 55 58 return valid; 56 59 } 57 protected virtualstring GetValue(int index) {60 protected override string GetValue(int index) { 58 61 return this[index].ToString(); 59 62 } 60 protected virtual bool SetValue(string value, int index) { 63 protected override bool SetValue(string value, int index) { 64 if (ReadOnly) throw new NotSupportedException("Item cannot be set. ValueTypeArray is read-only."); 61 65 double val; 62 66 if (double.TryParse(value, out val)) { … … 68 72 } 69 73 70 #region IStringConvertibleArray Members 71 int IStringConvertibleArray.Length { 72 get { return Length; } 73 set { Length = value; } 74 protected override bool SetValues(IEnumerable<ArrayValue<string>> arrayValues) { 75 if (ReadOnly) throw new NotSupportedException("Item cannot be set. ValueTypeArray is read-only."); 76 double parsed; 77 if (!arrayValues.All(v => double.TryParse(v.Value, out parsed))) return false; 78 List<int> positions = new List<int>(); 79 foreach (var v in arrayValues) { 80 parsed = double.Parse(v.Value); 81 if (array[v.Index] != parsed) { 82 array[v.Index] = parsed; 83 positions.Add(v.Index); 84 } 85 } 86 OnItemsChanged(positions); 87 return true; 74 88 } 75 bool IStringConvertibleArray.Validate(string value, out string errorMessage) {76 return Validate(value, out errorMessage);77 }78 string IStringConvertibleArray.GetValue(int index) {79 return GetValue(index);80 }81 bool IStringConvertibleArray.SetValue(string value, int index) {82 return SetValue(value, index);83 }84 #endregion85 89 } 86 90 } -
branches/ImprovingStringConvertibleMatrix/HeuristicLab.Data/3.3/DoubleMatrix.cs
r9306 r9308 66 66 } 67 67 protected override bool SetValue(string value, int rowIndex, int columnIndex) { 68 if (ReadOnly) throw new NotSupportedException("Item cannot be set. DoubleMatrix is read-only."); 68 69 double val; 69 70 if (double.TryParse(value, out val)) { … … 76 77 protected override bool SetValues(IEnumerable<MatrixValue<string>> matrixValues) { 77 78 if (ReadOnly) throw new NotSupportedException("Item cannot be set. DoubleMatrix is read-only."); 78 79 79 double parsed; 80 80 if (!matrixValues.All(v => double.TryParse(v.Value, out parsed))) return false; … … 87 87 } 88 88 } 89 OnItemsChanged(positions); 89 90 return true; 90 91 } -
branches/ImprovingStringConvertibleMatrix/HeuristicLab.Data/3.3/IntArray.cs
r7259 r9308 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 22 25 using System.Text; 23 26 using HeuristicLab.Common; … … 28 31 [Item("IntArray", "Represents an array of integer values.")] 29 32 [StorableClass] 30 public class IntArray : ValueTypeArray<int> , IStringConvertibleArray{33 public class IntArray : ValueTypeArray<int> { 31 34 [StorableConstructor] 32 35 protected IntArray(bool deserializing) : base(deserializing) { } … … 42 45 } 43 46 44 protected virtualbool Validate(string value, out string errorMessage) {47 protected override bool Validate(string value, out string errorMessage) { 45 48 int val; 46 49 bool valid = int.TryParse(value, out val); … … 55 58 return valid; 56 59 } 57 protected virtualstring GetValue(int index) {60 protected override string GetValue(int index) { 58 61 return this[index].ToString(); 59 62 } 60 protected virtual bool SetValue(string value, int index) { 63 protected override bool SetValue(string value, int index) { 64 if (ReadOnly) throw new NotSupportedException("Item cannot be set. ValueTypeArray is read-only."); 61 65 int val; 62 66 if (int.TryParse(value, out val)) { … … 67 71 } 68 72 } 69 70 #region IStringConvertibleArray Members 71 int IStringConvertibleArray.Length { 72 get { return Length; } 73 set { Length = value; } 73 protected override bool SetValues(IEnumerable<ArrayValue<string>> arrayValues) { 74 if (ReadOnly) throw new NotSupportedException("Item cannot be set. ValueTypeArray is read-only."); 75 int parsed; 76 if (!arrayValues.All(v => int.TryParse(v.Value, out parsed))) return false; 77 List<int> positions = new List<int>(); 78 foreach (var v in arrayValues) { 79 parsed = int.Parse(v.Value); 80 if (array[v.Index] != parsed) { 81 array[v.Index] = parsed; 82 positions.Add(v.Index); 83 } 84 } 85 OnItemsChanged(positions); 86 return true; 74 87 } 75 bool IStringConvertibleArray.Validate(string value, out string errorMessage) {76 return Validate(value, out errorMessage);77 }78 string IStringConvertibleArray.GetValue(int index) {79 return GetValue(index);80 }81 bool IStringConvertibleArray.SetValue(string value, int index) {82 return SetValue(value, index);83 }84 #endregion85 88 } 86 89 } -
branches/ImprovingStringConvertibleMatrix/HeuristicLab.Data/3.3/IntMatrix.cs
r9306 r9308 66 66 } 67 67 protected override bool SetValue(string value, int rowIndex, int columnIndex) { 68 if (ReadOnly) throw new NotSupportedException("Item cannot be set. IntMatrix is read-only."); 68 69 int val; 69 70 if (int.TryParse(value, out val)) { … … 86 87 } 87 88 } 89 OnItemsChanged(positions); 88 90 return true; 89 91 } -
branches/ImprovingStringConvertibleMatrix/HeuristicLab.Data/3.3/Interfaces/IStringConvertibleArray.cs
r7259 r9308 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using HeuristicLab.Common; 24 25 … … 26 27 public interface IStringConvertibleArray : IContent { 27 28 int Length { get; set; } 29 IEnumerable<string> ColumnNames { get; set; } 28 30 29 31 bool ReadOnly { get; } … … 32 34 string GetValue(int index); 33 35 bool SetValue(string value, int index); 36 bool SetValue(ArrayValue<string> arrayValue); 37 bool SetValues(IEnumerable<ArrayValue<string>> arrayValues); 34 38 35 event EventHandler<EventArgs<int>> ItemChanged; 39 event EventHandler ColumnNamesChanged; 40 event EventHandler<ArrayValuesChangedEventArgs> ItemsChanged; 36 41 event EventHandler Reset; 37 42 } 43 public class ArrayValuesChangedEventArgs : EventArgs<IEnumerable<int>> { 44 public ArrayValuesChangedEventArgs(IEnumerable<int> indices) : base(indices) { } 45 } 46 public struct ArrayValue<T> { 47 public int Index { get; private set; } 48 public T Value { get; private set; } 49 50 public ArrayValue(int index, T value) 51 : this() { 52 Index = index; 53 Value = value; 54 } 55 } 38 56 } -
branches/ImprovingStringConvertibleMatrix/HeuristicLab.Data/3.3/StringArray.cs
r7259 r9308 41 41 protected string[] array; 42 42 43 [Storable] 44 protected List<string> columnNames; 45 public virtual IEnumerable<string> ColumnNames { 46 get { return this.columnNames; } 47 set { 48 if (ReadOnly) throw new NotSupportedException("ColumnNames cannot be set. ValueTypeArray is read-only."); 49 if (value == null || value.Count() == 0) 50 columnNames = new List<string>(); 51 else if (value.Count() != Length) 52 throw new ArgumentException("A column name must be specified for each column."); 53 else 54 columnNames = new List<string>(value); 55 OnColumnNamesChanged(); 56 } 57 } 58 43 59 public virtual int Length { 44 60 get { return array.Length; } … … 47 63 if (value != Length) { 48 64 Array.Resize<string>(ref array, value); 65 while (columnNames.Count > value) 66 columnNames.RemoveAt(columnNames.Count - 1); 67 while (columnNames.Count < value) 68 columnNames.Add("Column " + columnNames.Count); 69 OnColumnNamesChanged(); 49 70 OnReset(); 50 71 } … … 58 79 if ((value != null) || (array[index] != string.Empty)) { 59 80 array[index] = value != null ? value : string.Empty; 60 OnItem Changed(index);81 OnItemsChanged(new List<int>(1) { index }); 61 82 } 62 83 } … … 68 89 public virtual bool ReadOnly { 69 90 get { return readOnly; } 91 } 92 93 [StorableHook(HookType.AfterDeserialization)] 94 private void AfterDeserialization() { 95 if (columnNames == null) { 96 columnNames = new List<string>(array.Length); 97 while (columnNames.Count < array.Length) 98 columnNames.Add("Column " + columnNames.Count); 99 } 70 100 } 71 101 … … 75 105 : base(original, cloner) { 76 106 this.array = (string[])original.array.Clone(); 107 this.columnNames = new List<string>(original.columnNames); 77 108 this.readOnly = original.readOnly; 78 109 } 79 110 public StringArray() { 80 111 array = new string[0]; 112 columnNames = new List<string>(); 81 113 readOnly = false; 82 114 } … … 85 117 for (int i = 0; i < array.Length; i++) 86 118 array[i] = string.Empty; 119 columnNames = new List<string>(); 87 120 readOnly = false; 88 121 } … … 92 125 for (int i = 0; i < array.Length; i++) 93 126 array[i] = elements[i] == null ? string.Empty : elements[i]; 127 columnNames = new List<string>(); 94 128 readOnly = false; 95 129 } … … 138 172 } 139 173 protected virtual bool SetValue(string value, int index) { 174 if (ReadOnly) throw new NotSupportedException("Item cannot be set. StringArray is read-only."); 140 175 if (value != null) { 141 176 this[index] = value; … … 145 180 } 146 181 } 147 148 public event EventHandler<EventArgs<int>> ItemChanged; 149 protected virtual void OnItemChanged(int index) { 150 if (ItemChanged != null) 151 ItemChanged(this, new EventArgs<int>(index)); 182 public virtual bool SetValues(IEnumerable<ArrayValue<string>> arrayValues) { 183 if (ReadOnly) throw new NotSupportedException("Item cannot be set. StringArray is read-only."); 184 if (!arrayValues.All(v => v.Value != null)) return false; 185 List<int> positions = new List<int>(); 186 foreach (var v in arrayValues) { 187 if (array[v.Index] != v.Value) { 188 array[v.Index] = v.Value; 189 positions.Add(v.Index); 190 } 191 } 192 OnItemsChanged(positions); 193 return true; 194 } 195 196 public event EventHandler ColumnNamesChanged; 197 protected virtual void OnColumnNamesChanged() { 198 EventHandler handler = ColumnNamesChanged; 199 if (handler != null) 200 handler(this, EventArgs.Empty); 201 } 202 public event EventHandler<ArrayValuesChangedEventArgs> ItemsChanged; 203 protected virtual void OnItemsChanged(IEnumerable<int> indices) { 204 if (ItemsChanged != null) 205 ItemsChanged(this, new ArrayValuesChangedEventArgs(indices)); 152 206 OnToStringChanged(); 153 207 } … … 173 227 return SetValue(value, index); 174 228 } 229 bool IStringConvertibleArray.SetValue(ArrayValue<string> arrayValue) { 230 return SetValue(arrayValue.Value, arrayValue.Index); 231 } 232 bool IStringConvertibleArray.SetValues(IEnumerable<ArrayValue<string>> arrayValues) { 233 return SetValues(arrayValues); 234 } 175 235 #endregion 176 236 } -
branches/ImprovingStringConvertibleMatrix/HeuristicLab.Data/3.3/StringMatrix.cs
r9306 r9308 243 243 } 244 244 protected virtual bool SetValue(string value, int rowIndex, int columnIndex) { 245 if (ReadOnly) throw new NotSupportedException("Item cannot be set. StringMatrix is read-only."); 245 246 if (value != null) { 246 247 this[rowIndex, columnIndex] = value; -
branches/ImprovingStringConvertibleMatrix/HeuristicLab.Data/3.3/ValueTypeArray.cs
r8587 r9308 33 33 [Item("ValueTypeArray", "An abstract base class for representing arrays of value types.")] 34 34 [StorableClass] 35 public abstract class ValueTypeArray<T> : Item, IEnumerable<T> where T : struct {35 public abstract class ValueTypeArray<T> : Item, IEnumerable<T>, IStringConvertibleArray where T : struct { 36 36 public static new Image StaticItemImage { 37 37 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; } … … 40 40 [Storable] 41 41 protected T[] array; 42 43 [Storable] 44 protected List<string> columnNames; 45 public virtual IEnumerable<string> ColumnNames { 46 get { return this.columnNames; } 47 set { 48 if (ReadOnly) throw new NotSupportedException("ColumnNames cannot be set. ValueTypeArray is read-only."); 49 if (value == null || value.Count() == 0) 50 columnNames = new List<string>(); 51 else if (value.Count() != Length) 52 throw new ArgumentException("A column name must be specified for each column."); 53 else 54 columnNames = new List<string>(value); 55 OnColumnNamesChanged(); 56 } 57 } 42 58 43 59 public virtual int Length { … … 49 65 if (value != Length) { 50 66 Array.Resize<T>(ref array, value); 67 while (columnNames.Count > value) 68 columnNames.RemoveAt(columnNames.Count - 1); 69 while (columnNames.Count < value) 70 columnNames.Add("Column " + columnNames.Count); 71 OnColumnNamesChanged(); 51 72 OnReset(); 52 73 } … … 60 81 if (!value.Equals(array[index])) { 61 82 array[index] = value; 62 OnItem Changed(index);83 OnItemsChanged(new List<int>(1) { index }); 63 84 } 64 85 } 86 } 87 88 public virtual void SetValues(IEnumerable<ArrayValue<T>> arrayValues) { 89 if (ReadOnly) throw new NotSupportedException("Item cannot be set. ValueTypeMatrix is read-only."); 90 List<int> positions = new List<int>(); 91 foreach (var arrayValue in arrayValues) { 92 if (!arrayValue.Value.Equals(array[arrayValue.Index])) { 93 array[arrayValue.Index] = arrayValue.Value; 94 positions.Add(arrayValue.Index); 95 } 96 } 97 OnItemsChanged(positions); 65 98 } 66 99 … … 69 102 public virtual bool ReadOnly { 70 103 get { return readOnly; } 104 } 105 106 [StorableHook(HookType.AfterDeserialization)] 107 private void AfterDeserialization() { 108 if (columnNames == null) { 109 columnNames = new List<string>(array.Length); 110 while (columnNames.Count < array.Length) 111 columnNames.Add("Column " + columnNames.Count); 112 } 71 113 } 72 114 … … 76 118 : base(original, cloner) { 77 119 this.array = (T[])original.array.Clone(); 120 this.columnNames = new List<string>(original.columnNames); 78 121 this.readOnly = original.readOnly; 79 122 } 80 123 protected ValueTypeArray() { 81 124 array = new T[0]; 125 columnNames = new List<string>(); 82 126 readOnly = false; 83 127 } 84 128 protected ValueTypeArray(int length) { 85 129 array = new T[length]; 130 columnNames = new List<string>(length); 86 131 readOnly = false; 87 132 } … … 89 134 if (elements == null) throw new ArgumentNullException(); 90 135 array = (T[])elements.Clone(); 136 columnNames = new List<string>(elements.Length); 91 137 readOnly = false; 92 138 } … … 118 164 } 119 165 120 public event EventHandler<EventArgs<int>> ItemChanged; 121 protected virtual void OnItemChanged(int index) { 122 if (ItemChanged != null) 123 ItemChanged(this, new EventArgs<int>(index)); 166 public event EventHandler ColumnNamesChanged; 167 protected virtual void OnColumnNamesChanged() { 168 EventHandler handler = ColumnNamesChanged; 169 if (handler != null) 170 handler(this, EventArgs.Empty); 171 } 172 public event EventHandler<ArrayValuesChangedEventArgs> ItemsChanged; 173 protected virtual void OnItemsChanged(IEnumerable<int> indices) { 174 if (ItemsChanged != null) 175 ItemsChanged(this, new ArrayValuesChangedEventArgs(indices)); 124 176 OnToStringChanged(); 125 177 } … … 130 182 OnToStringChanged(); 131 183 } 184 185 protected abstract bool Validate(string value, out string errorMessage); 186 protected abstract string GetValue(int index); 187 protected abstract bool SetValue(string value, int index); 188 protected abstract bool SetValues(IEnumerable<ArrayValue<string>> arrayValues); 189 190 #region IStringConvertibleArray Members 191 int IStringConvertibleArray.Length { 192 get { return Length; } 193 set { Length = value; } 194 } 195 bool IStringConvertibleArray.Validate(string value, out string errorMessage) { 196 return Validate(value, out errorMessage); 197 } 198 string IStringConvertibleArray.GetValue(int index) { 199 return GetValue(index); 200 } 201 bool IStringConvertibleArray.SetValue(string value, int index) { 202 return SetValue(value, index); 203 } 204 bool IStringConvertibleArray.SetValue(ArrayValue<string> arrayValue) { 205 return SetValue(arrayValue.Value, arrayValue.Index); 206 } 207 bool IStringConvertibleArray.SetValues(IEnumerable<ArrayValue<string>> arrayValues) { 208 return SetValues(arrayValues); 209 } 210 #endregion 132 211 } 133 212 } -
branches/ImprovingStringConvertibleMatrix/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionSolution.cs
r9306 r9308 204 204 205 205 private void RegisterBestKnownRealVectorEvents() { 206 BestKnownRealVector.Item Changed += new EventHandler<EventArgs<int>>(BestKnownRealVector_ItemChanged);206 BestKnownRealVector.ItemsChanged += new EventHandler<ArrayValuesChangedEventArgs>(BestKnownRealVector_ItemChanged); 207 207 BestKnownRealVector.Reset += new EventHandler(BestKnownRealVector_Reset); 208 208 } 209 209 private void DeregisterBestKnownRealVectorEvents() { 210 BestKnownRealVector.Item Changed -= new EventHandler<EventArgs<int>>(BestKnownRealVector_ItemChanged);210 BestKnownRealVector.ItemsChanged -= new EventHandler<ArrayValuesChangedEventArgs>(BestKnownRealVector_ItemChanged); 211 211 BestKnownRealVector.Reset -= new EventHandler(BestKnownRealVector_Reset); 212 212 } 213 213 private void RegisterBestRealVectorEvents() { 214 BestRealVector.Item Changed += new EventHandler<EventArgs<int>>(BestRealVector_ItemChanged);214 BestRealVector.ItemsChanged += new EventHandler<ArrayValuesChangedEventArgs>(BestRealVector_ItemChanged); 215 215 BestRealVector.Reset += new EventHandler(BestRealVector_Reset); 216 216 } 217 217 private void DeregisterBestRealVectorEvents() { 218 BestRealVector.Item Changed -= new EventHandler<EventArgs<int>>(BestRealVector_ItemChanged);218 BestRealVector.ItemsChanged -= new EventHandler<ArrayValuesChangedEventArgs>(BestRealVector_ItemChanged); 219 219 BestRealVector.Reset -= new EventHandler(BestRealVector_Reset); 220 220 } … … 244 244 } 245 245 246 private void BestKnownRealVector_ItemChanged(object sender, EventArgs<int>e) {246 private void BestKnownRealVector_ItemChanged(object sender, ArrayValuesChangedEventArgs e) { 247 247 OnBestKnownRealVectorChanged(); 248 248 } … … 250 250 OnBestKnownRealVectorChanged(); 251 251 } 252 private void BestRealVector_ItemChanged(object sender, EventArgs<int>e) {252 private void BestRealVector_ItemChanged(object sender, ArrayValuesChangedEventArgs e) { 253 253 OnBestRealVectorChanged(); 254 254 } -
branches/ImprovingStringConvertibleMatrix/HeuristicLab.Problems.TravelingSalesman/3.3/PathTSPTour.cs
r9306 r9308 152 152 } 153 153 private void RegisterPermutationEvents() { 154 Permutation.Item Changed += new EventHandler<EventArgs<int>>(Permutation_ItemChanged);154 Permutation.ItemsChanged += new EventHandler<ArrayValuesChangedEventArgs>(Permutation_ItemChanged); 155 155 Permutation.Reset += new EventHandler(Permutation_Reset); 156 156 } 157 157 private void DeregisterPermutationEvents() { 158 Permutation.Item Changed -= new EventHandler<EventArgs<int>>(Permutation_ItemChanged);158 Permutation.ItemsChanged -= new EventHandler<ArrayValuesChangedEventArgs>(Permutation_ItemChanged); 159 159 Permutation.Reset -= new EventHandler(Permutation_Reset); 160 160 } … … 172 172 OnCoordinatesChanged(); 173 173 } 174 private void Permutation_ItemChanged(object sender, EventArgs<int>e) {174 private void Permutation_ItemChanged(object sender, ArrayValuesChangedEventArgs e) { 175 175 OnPermutationChanged(); 176 176 } -
branches/ImprovingStringConvertibleMatrix/HeuristicLab.Problems.VehicleRouting/3.3/VehicleRoutingProblem.cs
r9306 r9308 297 297 } 298 298 void DemandParameter_ValueChanged(object sender, EventArgs e) { 299 Demand.Item Changed += new EventHandler<EventArgs<int>>(Demand_ItemChanged);299 Demand.ItemsChanged += new EventHandler<ArrayValuesChangedEventArgs>(Demand_ItemChanged); 300 300 Demand.Reset += new EventHandler(Demand_Reset); 301 301 BestKnownSolution = null; … … 304 304 BestKnownSolution = null; 305 305 } 306 void Demand_ItemChanged(object sender, EventArgs<int>e) {306 void Demand_ItemChanged(object sender, ArrayValuesChangedEventArgs e) { 307 307 BestKnownSolution = null; 308 308 } 309 309 void DueTimeParameter_ValueChanged(object sender, EventArgs e) { 310 DueTime.Item Changed += new EventHandler<EventArgs<int>>(DueTime_ItemChanged);310 DueTime.ItemsChanged += new EventHandler<ArrayValuesChangedEventArgs>(DueTime_ItemChanged); 311 311 DueTime.Reset += new EventHandler(DueTime_Reset); 312 312 BestKnownSolution = null; … … 315 315 BestKnownSolution = null; 316 316 } 317 void DueTime_ItemChanged(object sender, EventArgs<int>e) {317 void DueTime_ItemChanged(object sender, ArrayValuesChangedEventArgs e) { 318 318 BestKnownSolution = null; 319 319 } 320 320 void ReadyTimeParameter_ValueChanged(object sender, EventArgs e) { 321 ReadyTime.Item Changed += new EventHandler<EventArgs<int>>(ReadyTime_ItemChanged);321 ReadyTime.ItemsChanged += new EventHandler<ArrayValuesChangedEventArgs>(ReadyTime_ItemChanged); 322 322 ReadyTime.Reset += new EventHandler(ReadyTime_Reset); 323 323 BestKnownSolution = null; … … 326 326 BestKnownSolution = null; 327 327 } 328 void ReadyTime_ItemChanged(object sender, EventArgs<int>e) {328 void ReadyTime_ItemChanged(object sender, ArrayValuesChangedEventArgs e) { 329 329 BestKnownSolution = null; 330 330 } 331 331 void ServiceTimeParameter_ValueChanged(object sender, EventArgs e) { 332 ServiceTime.Item Changed += new EventHandler<EventArgs<int>>(ServiceTime_ItemChanged);332 ServiceTime.ItemsChanged += new EventHandler<ArrayValuesChangedEventArgs>(ServiceTime_ItemChanged); 333 333 ServiceTime.Reset += new EventHandler(ServiceTime_Reset); 334 334 BestKnownSolution = null; … … 337 337 BestKnownSolution = null; 338 338 } 339 void ServiceTime_ItemChanged(object sender, EventArgs<int>e) {339 void ServiceTime_ItemChanged(object sender, ArrayValuesChangedEventArgs e) { 340 340 BestKnownSolution = null; 341 341 } … … 392 392 Capacity.ValueChanged += new EventHandler(Capacity_ValueChanged); 393 393 DemandParameter.ValueChanged += new EventHandler(DemandParameter_ValueChanged); 394 Demand.Item Changed += new EventHandler<EventArgs<int>>(Demand_ItemChanged);394 Demand.ItemsChanged += new EventHandler<ArrayValuesChangedEventArgs>(Demand_ItemChanged); 395 395 Demand.Reset += new EventHandler(Demand_Reset); 396 396 DueTimeParameter.ValueChanged += new EventHandler(DueTimeParameter_ValueChanged); 397 DueTime.Item Changed += new EventHandler<EventArgs<int>>(DueTime_ItemChanged);397 DueTime.ItemsChanged += new EventHandler<ArrayValuesChangedEventArgs>(DueTime_ItemChanged); 398 398 DueTime.Reset += new EventHandler(DueTime_Reset); 399 399 ReadyTimeParameter.ValueChanged += new EventHandler(ReadyTimeParameter_ValueChanged); 400 ReadyTime.Item Changed += new EventHandler<EventArgs<int>>(ReadyTime_ItemChanged);400 ReadyTime.ItemsChanged += new EventHandler<ArrayValuesChangedEventArgs>(ReadyTime_ItemChanged); 401 401 ReadyTime.Reset += new EventHandler(ReadyTime_Reset); 402 402 ServiceTimeParameter.ValueChanged += new EventHandler(ServiceTimeParameter_ValueChanged); 403 ServiceTime.Item Changed += new EventHandler<EventArgs<int>>(ServiceTime_ItemChanged);403 ServiceTime.ItemsChanged += new EventHandler<ArrayValuesChangedEventArgs>(ServiceTime_ItemChanged); 404 404 ServiceTime.Reset += new EventHandler(ServiceTime_Reset); 405 405 VehiclesParameter.ValueChanged += new EventHandler(VehiclesParameter_ValueChanged); -
branches/ImprovingStringConvertibleMatrix/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MDCVRP/MDCVRPTW/MDCVRPPDTW/MDCVRPPDTWProblemInstance.cs
r8053 r9308 125 125 #region Event handlers 126 126 void PickupDeliveryLocationParameter_ValueChanged(object sender, EventArgs e) { 127 PickupDeliveryLocationParameter.Value.Item Changed += new EventHandler<EventArgs<int>>(Value_ItemChanged);127 PickupDeliveryLocationParameter.Value.ItemsChanged += new EventHandler<ArrayValuesChangedEventArgs>(Value_ItemChanged); 128 128 EvalBestKnownSolution(); 129 129 } 130 130 131 void Value_ItemChanged(object sender, EventArgs<int>e) {131 void Value_ItemChanged(object sender, ArrayValuesChangedEventArgs e) { 132 132 EvalBestKnownSolution(); 133 133 } -
branches/ImprovingStringConvertibleMatrix/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPPDTW/CVRPPDTWProblemInstance.cs
r8053 r9308 125 125 #region Event handlers 126 126 void PickupDeliveryLocationParameter_ValueChanged(object sender, EventArgs e) { 127 PickupDeliveryLocationParameter.Value.Item Changed += new EventHandler<EventArgs<int>>(Value_ItemChanged);127 PickupDeliveryLocationParameter.Value.ItemsChanged += new EventHandler<ArrayValuesChangedEventArgs>(Value_ItemChanged); 128 128 EvalBestKnownSolution(); 129 129 } 130 130 131 void Value_ItemChanged(object sender, EventArgs<int>e) {131 void Value_ItemChanged(object sender, ArrayValuesChangedEventArgs e) { 132 132 EvalBestKnownSolution(); 133 133 }
Note: See TracChangeset
for help on using the changeset viewer.