Changeset 7706


Ignore:
Timestamp:
04/04/12 17:21:22 (10 years ago)
Author:
abeham
Message:

#1695: fixed bug in parameter collection

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/3.3/ParameterizedNamedItem.cs

    r7579 r7706  
    8585    public virtual void CollectParameterValues(IDictionary<string, IItem> values) {
    8686      foreach (IValueParameter param in parameters.OfType<IValueParameter>()) {
    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           }
     87        var children = GetCollectedValues(param);
     88        foreach (var c in children) {
     89          if (String.IsNullOrEmpty(c.Key))
     90            values.Add(param.Name, c.Value);
     91          else values.Add(param.Name + "." + c.Key, c.Value);
    9492        }
    9593      }
    9694    }
    9795
    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;
     96    protected virtual IEnumerable<KeyValuePair<string, IItem>> GetCollectedValues(IValueParameter param) {
     97      if (param.Value == null) yield break;
     98      if (param.GetsCollected) yield return new KeyValuePair<string, IItem>(String.Empty, param.Value);
     99      var parameterizedItem = param.Value as IParameterizedItem;
    102100      if (parameterizedItem != null) {
    103101        var children = new Dictionary<string, IItem>();
  • trunk/sources/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs

    r7579 r7706  
    240240    }
    241241
    242     protected override IEnumerable<KeyValuePair<string, IItem>> GetCollectedValues(IItem value) {
    243       var children = base.GetCollectedValues(value);
     242    protected override IEnumerable<KeyValuePair<string, IItem>> GetCollectedValues(IValueParameter param) {
     243      var children = base.GetCollectedValues(param);
    244244      foreach (var child in children) {
    245245        if (child.Value is IOperator)
  • trunk/sources/HeuristicLab.Optimization/3.3/Problems/Problem.cs

    r7579 r7706  
    9898    #endregion
    9999
    100     protected override IEnumerable<KeyValuePair<string, IItem>> GetCollectedValues(IItem value) {
    101       var children = base.GetCollectedValues(value);
     100    protected override IEnumerable<KeyValuePair<string, IItem>> GetCollectedValues(IValueParameter param) {
     101      var children = base.GetCollectedValues(param);
    102102      foreach (var child in children) {
    103103        if (child.Value is IOperator)
Note: See TracChangeset for help on using the changeset viewer.