Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14100


Ignore:
Timestamp:
07/18/16 16:39:09 (8 years ago)
Author:
abeham
Message:

#2281: Fixed description of result parameter not appearing in result (thx to mkommend)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization/3.3/Results/ResultParameter.cs

    r14071 r14100  
    3333  public sealed class ResultParameter<T> : LookupParameter<T>, IResultParameter<T> where T : class, IItem {
    3434    public override Image ItemImage { get { return VSImageLibrary.Exception; } }
     35    public override bool CanChangeDescription { get { return true; } }
    3536
    3637    [Storable]
     
    7172    }
    7273    public ResultParameter() : this("Anonymous", string.Empty, "Results") { }
    73     public ResultParameter(string name) : this(name, string.Empty, "Results") { }
    7474    public ResultParameter(string name, string description) : this(name, description, "Results") { }
     75
    7576    public ResultParameter(string name, string description, string resultCollectionName)
    7677      : base(name, description, string.Empty) {
    7778      if (string.IsNullOrEmpty(resultCollectionName)) throw new ArgumentException("resultCollectionName");
    7879      this.resultCollectionName = resultCollectionName;
     80      Hidden = false;
    7981    }
    8082    public ResultParameter(string name, string description, string resultCollectionName, T defaultValue)
     
    8486      this.resultCollectionName = resultCollectionName;
    8587      this.defaultValue = defaultValue;
     88      Hidden = false;
    8689    }
    8790
     
    102105      if (!results.TryGetValue(ActualName, out result)) {
    103106        if (DefaultValue == null) throw new InvalidOperationException("ResultParameter (" + ActualName + "): Result not found and no default value specified.");
    104         result = new Result(ActualName, (T)DefaultValue.Clone());
     107        result = ItemDescription == Description ? new Result(ActualName, (T)DefaultValue.Clone()) : new Result(ActualName, Description, (T)DefaultValue.Clone());
    105108        results.Add(result);
    106109      }
     
    127130      IResult result;
    128131      if (!results.TryGetValue(ActualName, out result)) {
    129         result = new Result(ActualName, value);
     132        result = ItemDescription == Description ? new Result(ActualName, value) : new Result(ActualName, Description, value);
    130133        results.Add(result);
    131134      } else result.Value = value;
Note: See TracChangeset for help on using the changeset viewer.