Changeset 3639
- Timestamp:
- 05/05/10 15:47:26 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Operators/3.3/ResultsCollector.cs
r3637 r3639 22 22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 24 25 using HeuristicLab.Operators; 25 26 using HeuristicLab.Parameters; … … 36 37 get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; } 37 38 } 39 public ValueParameter<BoolValue> CopyValueParameter { 40 get { return (ValueParameter<BoolValue>)Parameters["CopyValue"]; } 41 } 42 43 public BoolValue CopyValue { 44 get { return CopyValueParameter.Value; } 45 set { CopyValueParameter.Value = value; } 46 } 38 47 39 48 public ResultsCollector() 40 49 : base() { 41 50 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the collected values should be stored.")); 51 Parameters.Add(new ValueParameter<BoolValue>("CopyValue", "True if the collected result value should be copied, otherwise false.", new BoolValue(true))); 42 52 } 43 53 44 54 public override IOperation Apply() { 55 bool copy = CopyValueParameter.Value.Value; 45 56 ResultCollection results = ResultsParameter.ActualValue; 46 57 IResult result; … … 50 61 results.TryGetValue(param.Name, out result); 51 62 if (result != null) 52 result.Value = (IItem)value.Clone();63 result.Value = copy ? (IItem)value.Clone() : value; 53 64 else 54 results.Add(new Result(param.Name, param.Description, (IItem)value.Clone()));65 results.Add(new Result(param.Name, param.Description, copy ? (IItem)value.Clone() : value)); 55 66 } 56 67 }
Note: See TracChangeset
for help on using the changeset viewer.