Changeset 7579
- Timestamp:
- 03/07/12 14:00:45 (13 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core/3.3/ParameterizedNamedItem.cs
r7259 r7579 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; … … 84 85 public virtual void CollectParameterValues(IDictionary<string, IItem> values) { 85 86 foreach (IValueParameter param in parameters.OfType<IValueParameter>()) { 86 if (param.GetsCollected && param.Value != null) values.Add(param.Name, param.Value); 87 if (param.Value is IParameterizedItem) { 88 Dictionary<string, IItem> children = new Dictionary<string, IItem>(); 89 ((IParameterizedItem)param.Value).CollectParameterValues(children); 90 foreach (string key in children.Keys) 91 values.Add(param.Name + "." + key, children[key]); 87 if (param.GetsCollected) { 88 var children = GetCollectedValues(param.Value); 89 foreach (var c in children) { 90 if (String.IsNullOrEmpty(c.Key)) 91 values.Add(param.Name, c.Value); 92 else values.Add(param.Name + "." + c.Key, c.Value); 93 } 92 94 } 95 } 96 } 97 98 protected virtual IEnumerable<KeyValuePair<string, IItem>> GetCollectedValues(IItem value) { 99 if (value == null) yield break; 100 yield return new KeyValuePair<string, IItem>(String.Empty, value); 101 var parameterizedItem = value as IParameterizedItem; 102 if (parameterizedItem != null) { 103 var children = new Dictionary<string, IItem>(); 104 parameterizedItem.CollectParameterValues(children); 105 foreach (var child in children) yield return child; 93 106 } 94 107 } -
trunk/sources/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs
r7467 r7579 240 240 } 241 241 242 protected override IEnumerable<KeyValuePair<string, IItem>> GetCollectedValues(IItem value) { 243 var children = base.GetCollectedValues(value); 244 foreach (var child in children) { 245 if (child.Value is IOperator) 246 yield return new KeyValuePair<string, IItem>(child.Key, new StringValue(((IOperator)child.Value).Name)); 247 else yield return child; 248 } 249 } 250 242 251 #region Events 243 252 public event EventHandler ExecutionStateChanged; -
trunk/sources/HeuristicLab.Optimization/3.3/Problems/Problem.cs
r7431 r7579 26 26 using HeuristicLab.Common; 27 27 using HeuristicLab.Core; 28 using HeuristicLab.Data; 28 29 using HeuristicLab.Parameters; 29 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 97 98 #endregion 98 99 100 protected override IEnumerable<KeyValuePair<string, IItem>> GetCollectedValues(IItem value) { 101 var children = base.GetCollectedValues(value); 102 foreach (var child in children) { 103 if (child.Value is IOperator) 104 yield return new KeyValuePair<string, IItem>(child.Key, new StringValue(((IOperator)child.Value).Name)); 105 else yield return child; 106 } 107 } 108 99 109 #region events 100 110 private void Operators_Changed(object sender, EventArgs e) {
Note: See TracChangeset
for help on using the changeset viewer.