Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/05/10 15:47:26 (15 years ago)
Author:
swagner
Message:

Worked on refactoring of algorithm analysis and tracing (#999)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Operators/3.3/ResultsCollector.cs

    r3637 r3639  
    2222using HeuristicLab.Common;
    2323using HeuristicLab.Core;
     24using HeuristicLab.Data;
    2425using HeuristicLab.Operators;
    2526using HeuristicLab.Parameters;
     
    3637      get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; }
    3738    }
     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    }
    3847
    3948    public ResultsCollector()
    4049      : base() {
    4150      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)));
    4252    }
    4353
    4454    public override IOperation Apply() {
     55      bool copy = CopyValueParameter.Value.Value;
    4556      ResultCollection results = ResultsParameter.ActualValue;
    4657      IResult result;
     
    5061          results.TryGetValue(param.Name, out result);
    5162          if (result != null)
    52             result.Value = (IItem)value.Clone();
     63            result.Value = copy ? (IItem)value.Clone() : value;
    5364          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));
    5566        }
    5667      }
Note: See TracChangeset for help on using the changeset viewer.