Changeset 11689


Ignore:
Timestamp:
12/16/14 18:35:39 (8 years ago)
Author:
ehopf
Message:

#2278: Added methods to collect result values to the ResultCollection-class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Classification-Extensions/HeuristicLab.Optimization/3.3/ResultCollection.cs

    r11171 r11689  
    4444      get { return HeuristicLab.Common.Resources.VSImageLibrary.Object; }
    4545    }
     46
     47    public void CollectResultValues(IDictionary<string, IItem> values) {
     48      CollectResultsRecursively("", this, values);
     49    }
     50    public void CollectResultValues(IDictionary<string, IItem> values, string resultsRootName) {
     51      CollectResultsRecursively(resultsRootName, this, values);
     52    }
     53
     54    protected void CollectResultsRecursively(string path, ResultCollection results, IDictionary<string, IItem> values) {
     55      foreach (IResult result in results) {
     56        values.Add(path + result.Name, result.Value);
     57        ResultCollection childCollection = result.Value as ResultCollection;
     58        if (childCollection != null) {
     59          CollectResultsRecursively(path + result.Name + ".", childCollection, values);
     60        }
     61      }
     62    }
    4663  }
    4764}
Note: See TracChangeset for help on using the changeset viewer.