Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/20/10 20:04:08 (15 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • worked on parameterized items
Location:
trunk/sources/HeuristicLab.Optimization/3.3
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj

    r2834 r2845  
    5151  <ItemGroup>
    5252    <None Include="HeuristicLabOptimizationPlugin.cs.frame" />
     53    <Compile Include="IAlgorithm.cs" />
    5354    <Compile Include="HeuristicLabOptimizationPlugin.cs" />
    5455    <Compile Include="IProblem.cs" />
     
    6869      <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project>
    6970      <Name>HeuristicLab.Common.Resources-3.2</Name>
     71    </ProjectReference>
     72    <ProjectReference Include="..\..\HeuristicLab.Common\3.2\HeuristicLab.Common-3.2.csproj">
     73      <Project>{1FC004FC-59AF-4249-B1B6-FF25873A20E4}</Project>
     74      <Name>HeuristicLab.Common-3.2</Name>
    7075    </ProjectReference>
    7176    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
  • trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLabOptimizationPlugin.cs.frame

    r2834 r2845  
    2929  [PluginFile("HeuristicLab.Optimization-3.3.dll", PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.Collections", "3.3")]
     31  [PluginDependency("HeuristicLab.Common", "3.2")]
    3132  [PluginDependency("HeuristicLab.Common.Resources", "3.2")]
    3233  [PluginDependency("HeuristicLab.Core", "3.3")]
  • trunk/sources/HeuristicLab.Optimization/3.3/IProblem.cs

    r2834 r2845  
    2626  /// Interface to represent a problem.
    2727  /// </summary>
    28   public interface IProblem : INamedItem, IParameterizedItem { }
     28  public interface IProblem : IParameterizedNamedItem { }
    2929}
  • trunk/sources/HeuristicLab.Optimization/3.3/Problem.cs

    r2834 r2845  
    2121
    2222using System.Drawing;
    23 using HeuristicLab.Collections;
    2423using HeuristicLab.Core;
    25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2624
    2725namespace HeuristicLab.Optimization {
     
    3028  /// </summary>
    3129  [Item("Problem", "Base class for problems.")]
    32   public abstract class Problem : NamedItem, IProblem {
     30  public abstract class Problem : ParameterizedNamedItem, IProblem {
    3331    public override Image ItemImage {
    3432      get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Type; }
    3533    }
    3634
    37     private ParameterCollection parameters;
    38     [Storable]
    39     protected ParameterCollection Parameters {
    40       get { return parameters;}
    41       private set {
    42         if (parameters != null) parameters.Changed -= new ChangedEventHandler(Parameters_Changed);
    43         parameters = value;
    44         readOnlyParameters = null;
    45         if (parameters != null) parameters.Changed += new ChangedEventHandler(Parameters_Changed);
    46       }
    47     }
    48     private ReadOnlyObservableKeyedCollection<string, IParameter> readOnlyParameters;
    49     IObservableKeyedCollection<string, IParameter> IParameterizedItem.Parameters {
    50       get {
    51         if (readOnlyParameters == null) readOnlyParameters = parameters.AsReadOnly();
    52         return readOnlyParameters;
    53       }
    54     }
    55 
    56     protected Problem() {
    57       Name = ItemName;
    58       Parameters = new ParameterCollection();
    59       readOnlyParameters = null;
    60     }
    61 
    62     public override IDeepCloneable Clone(Cloner cloner) {
    63       Problem clone = (Problem)base.Clone(cloner);
    64       clone.Parameters = (ParameterCollection)cloner.Clone(parameters);
    65       return clone;
    66     }
    67 
    68     private void Parameters_Changed(object sender, ChangedEventArgs e) {
    69       OnChanged(e);
    70     }
     35    protected Problem() : base() { }
     36    protected Problem(string name) : base(name) { }
     37    protected Problem(string name, ParameterCollection parameters) : base(name, parameters) { }
     38    protected Problem(string name, string description) : base(name, description) { }
     39    protected Problem(string name, string description, ParameterCollection parameters) : base(name, description, parameters) { }
    7140  }
    7241}
Note: See TracChangeset for help on using the changeset viewer.