Changeset 3447 for trunk/sources/HeuristicLab.Optimization
- Timestamp:
- 04/20/10 17:37:53 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization/3.3/RunCollection.cs
r3441 r3447 35 35 public RunCollection(int capacity) : base(capacity) { Initialize(); } 36 36 public RunCollection(IEnumerable<IRun> collection) : base(collection) { Initialize(); this.OnItemsAdded(collection); } 37 private void Initialize() { 38 parameterNames = new List<string>(); 39 resultNames = new List<string>(); 40 } 37 41 38 42 protected static Type[] viewableDataTypes = new Type[]{typeof(BoolValue), typeof(DoubleValue), typeof(IntValue), … … 82 86 } 83 87 84 private void Initialize() { 85 parameterNames = new List<string>(); 86 resultNames = new List<string>(); 87 } 88 88 89 89 90 private bool AddParameter(string name, IItem value) { … … 122 123 } 123 124 125 public IItem GetValue(int rowIndex, int columnIndex) { 126 IRun run = this.list[rowIndex]; 127 IItem value = null; 128 129 if (columnIndex < parameterNames.Count) { 130 string parameterName = parameterNames[columnIndex]; 131 if (run.Parameters.ContainsKey(parameterName)) 132 value = run.Parameters[parameterName]; 133 } else if (columnIndex < parameterNames.Count + resultNames.Count) { 134 string resultName = resultNames[columnIndex - parameterNames.Count]; 135 if (run.Results.ContainsKey(resultName)) 136 value = run.Results[resultName]; 137 } 138 return value; 139 } 140 124 141 #region IStringConvertibleMatrix Members 125 142 [Storable] … … 127 144 [Storable] 128 145 private List<string> resultNames; 129 public intRows {146 int IStringConvertibleMatrix.Rows { 130 147 get { return this.Count; } 131 set { throw new System.NotImplementedException(); }132 } 133 public intColumns {148 set { throw new NotSupportedException(); } 149 } 150 int IStringConvertibleMatrix.Columns { 134 151 get { return parameterNames.Count + resultNames.Count; } 135 152 set { throw new NotSupportedException(); } 136 153 } 137 public IEnumerable<string>ColumnNames {154 IEnumerable<string> IStringConvertibleMatrix.ColumnNames { 138 155 get { 139 156 List<string> value = new List<string>(parameterNames); … … 143 160 set { throw new NotSupportedException(); } 144 161 } 145 public IEnumerable<string>RowNames {162 IEnumerable<string> IStringConvertibleMatrix.RowNames { 146 163 get { return list.Select(x => x.Name).ToList(); } 147 164 set { throw new NotSupportedException(); } 148 165 } 149 public boolSortableView {166 bool IStringConvertibleMatrix.SortableView { 150 167 get { return true; } 151 168 set { throw new NotSupportedException(); } 152 169 } 153 public bool ReadOnly { 154 get { return false; } 155 } 156 157 public string GetValue(int rowIndex, int columnIndex) { 158 IRun run = this.list[rowIndex]; 159 string value = string.Empty; 160 161 if (columnIndex < parameterNames.Count) { 162 string parameterName = parameterNames[columnIndex]; 163 if (run.Parameters.ContainsKey(parameterName)) { 164 IItem param = run.Parameters[parameterName]; 165 if (param != null) value = param.ToString(); 166 } 167 } else if (columnIndex < parameterNames.Count + resultNames.Count) { 168 string resultName = resultNames[columnIndex - parameterNames.Count]; 169 if (run.Results.ContainsKey(resultName)) { 170 IItem result = run.Results[resultName]; 171 if (result != null) value = result.ToString(); 172 } 173 } 174 return value; 170 bool IStringConvertibleMatrix.ReadOnly { 171 get { return true; } 172 } 173 174 string IStringConvertibleMatrix.GetValue(int rowIndex, int columnIndex) { 175 IItem value = GetValue(rowIndex, columnIndex); 176 if (value == null) 177 return string.Empty; 178 return value.ToString(); 175 179 } 176 180
Note: See TracChangeset
for help on using the changeset viewer.