Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/18/10 11:07:45 (13 years ago)
Author:
cneumuel
Message:

#1215 worked on metaoptimization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encodings/ParameterConfiguration.cs

    r4830 r4832  
    4646    }
    4747
    48     public virtual IParameter Parameter {
    49       get {
    50         return parentConfiguration.GetChildParameter(this.parameterName);
    51       }
     48    //public virtual IParameter Parameter {
     49    //  get {
     50    //    return parentConfiguration.GetChildParameter(this.parameterName);
     51    //  }
     52    //}
     53
     54
     55    protected Type parameterType;
     56    public Type ParameterType {
     57      get { return this.parameterType; }
     58    }
     59
     60    protected Type valueType;
     61    public Type ValueType {
     62      get { return this.valueType; }
    5263    }
    5364
     
    6677    }
    6778
    68     public ParameterConfiguration(ParameterConfiguration parentConfiguration, string parameterName, IItem value) {
     79    // store parameter reference only for name/description/image/...
     80    private IValueParameter parameter;
     81
     82    public ParameterConfiguration(ParameterConfiguration parentConfiguration, string parameterName, IValueParameter valueParameter) {
    6983      this.parentConfiguration = parentConfiguration;
    7084      this.ParameterName = parameterName;
    71       this.Value = value;
     85      this.Value = valueParameter.Value;
     86      this.parameterType = valueParameter.GetType();
     87      this.valueType = valueParameter.DataType;
     88
     89      this.parameter = valueParameter;
    7290    }
    7391
     
    102120    #region INamedItem Properties
    103121    public virtual string Name {
    104       get { return Parameter.Name; }
     122      get { return ParameterName; }
    105123      set { throw new NotSupportedException(); }
    106124    }
    107125    public virtual string Description {
    108       get { return Parameter.Description; }
     126      get { return parameter.Description; }
    109127      set { throw new NotSupportedException(); }
    110128    }
     
    116134    }
    117135    public virtual string ItemDescription {
    118       get { return Parameter.ItemDescription; }
     136      get { return parameter.Description; }
    119137    }
    120138    public virtual System.Drawing.Image ItemImage {
    121       get { return Parameter.ItemImage; }
     139      get { return parameter.ItemImage; }
    122140    }
    123141    public virtual string ItemName {
    124       get { return Parameter.ItemName; }
     142      get { return parameter.ItemName; }
    125143    }
    126144    public virtual Version ItemVersion {
    127       get { return Parameter.ItemVersion; }
     145      get { return parameter.ItemVersion; }
    128146    }
    129147    #endregion
     
    192210
    193211        if (typeof(IntValue).IsAssignableFrom(parameter.DataType)) {
    194           return new IntValueParameterConfiguration(parentConfiguration, parameter.Name, valueParameter.Value);
     212          return new IntValueParameterConfiguration(parentConfiguration, parameter.Name, valueParameter);
    195213        } else if (typeof(IParameterizedItem).IsAssignableFrom(parameter.DataType)) {
    196           return new ParameterConfiguration(parentConfiguration, parameter.Name, valueParameter.Value);
     214          return new ParameterConfiguration(parentConfiguration, parameter.Name, valueParameter);
    197215        } else {
    198216          // todo
    199           return new IntValueParameterConfiguration(parentConfiguration, parameter.Name, valueParameter.Value);
     217          return new IntValueParameterConfiguration(parentConfiguration, parameter.Name, valueParameter);
    200218        }
    201219      }
Note: See TracChangeset for help on using the changeset viewer.