- Timestamp:
- 07/18/14 12:35:00 (10 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources
- Property svn:ignore
-
old new 8 8 FxCopResults.txt 9 9 Google.ProtocolBuffers-0.9.1.dll 10 Google.ProtocolBuffers-2.4.1.473.dll11 10 HeuristicLab 3.3.5.1.ReSharper.user 12 11 HeuristicLab 3.3.6.0.ReSharper.user 13 12 HeuristicLab.4.5.resharper.user 14 13 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development16 14 HeuristicLab.resharper.user 17 15 ProtoGen.exe … … 19 17 _ReSharper.HeuristicLab 20 18 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests22 19 _ReSharper.HeuristicLab.ExtLibs 23 20 bin 24 21 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests 23 Google.ProtocolBuffers-2.4.1.473.dll
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HiveStatistics/sources/HeuristicLab.Data/3.3
- Property svn:mergeinfo deleted
-
branches/HiveStatistics/sources/HeuristicLab.Data/3.3/ValueTypeArray.cs
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 43 43 protected T[] array; 44 44 45 [Storable]46 protected List<string> elementNames;47 public virtual IEnumerable<string> ElementNames {48 get { return this.elementNames; }49 set {50 if (ReadOnly) throw new NotSupportedException("ElementNames cannot be set. ValueTypeArray is read-only.");51 if (value == null || !value.Any())52 elementNames = new List<string>();53 else if (value.Count() > Length)54 throw new ArgumentException("The number of element names must not exceed the array length.");55 else56 elementNames = new List<string>(value);57 OnElementNamesChanged();58 }59 }60 61 45 public virtual int Length { 62 46 get { return array.Length; } … … 67 51 if (value != Length) { 68 52 Array.Resize<T>(ref array, value); 69 while (elementNames.Count > value)70 elementNames.RemoveAt(elementNames.Count - 1);71 OnElementNamesChanged();72 53 OnReset(); 73 54 } … … 92 73 } 93 74 94 [StorableHook(HookType.AfterDeserialization)]95 private void AfterDeserialization() {96 if (elementNames == null) { elementNames = new List<string>(); }97 }98 99 75 [StorableConstructor] 100 76 protected ValueTypeArray(bool deserializing) : base(deserializing) { } … … 103 79 this.array = (T[])original.array.Clone(); 104 80 this.readOnly = original.readOnly; 105 this.elementNames = new List<string>(original.elementNames);106 81 } 107 82 protected ValueTypeArray() { 108 83 array = new T[0]; 109 84 readOnly = false; 110 elementNames = new List<string>();111 85 } 112 86 protected ValueTypeArray(int length) { 113 87 array = new T[length]; 114 88 readOnly = false; 115 elementNames = new List<string>();116 89 } 117 90 protected ValueTypeArray(T[] elements) { … … 119 92 array = (T[])elements.Clone(); 120 93 readOnly = false; 121 elementNames = new List<string>();122 94 } 123 95 … … 153 125 } 154 126 155 public event EventHandler ElementNamesChanged;156 protected virtual void OnElementNamesChanged() {157 EventHandler handler = ElementNamesChanged;158 if (handler != null)159 handler(this, EventArgs.Empty);160 }161 162 127 public event EventHandler<EventArgs<int>> ItemChanged; 163 128 protected virtual void OnItemChanged(int index) {
Note: See TracChangeset
for help on using the changeset viewer.