Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/HeuristicLab.Clients.OKB/3.3/RunCreation/EmptyAlgorithm.cs @ 17180

Last change on this file since 17180 was 17180, checked in by swagner, 5 years ago

#2875: Removed years in copyrights

File size: 3.3 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using HeuristicLab.Common;
24using HeuristicLab.Core;
25using HeuristicLab.Optimization;
26using HEAL.Attic;
27using HeuristicLab.PluginInfrastructure;
28
29namespace HeuristicLab.Clients.OKB.RunCreation {
30  [Item("Empty Algorithm", "A dummy algorithm which serves as a placeholder and cannot be executed.")]
31  [StorableType("C98C8322-5A78-4518-A94D-FA20F12AB8D3")]
32  [NonDiscoverableType]
33  public sealed class EmptyAlgorithm : HeuristicLab.Optimization.Algorithm {
34    private string exceptionMessage;
35
36    public override bool CanChangeName {
37      get { return false; }
38    }
39    public override bool CanChangeDescription {
40      get { return false; }
41    }
42
43    private ResultCollection results;
44    public override Optimization.ResultCollection Results {
45      get { return results; }
46    }
47
48    #region Persistence Properties
49    [Storable(Name = "ExceptionMessage")]
50    private string ExceptionMessage {
51      get { return exceptionMessage; }
52      set { exceptionMessage = value; }
53    }
54    #endregion
55
56    [StorableConstructor]
57    private EmptyAlgorithm(StorableConstructorFlag _) : base(_) {
58      this.results = new ResultCollection();
59    }
60    private EmptyAlgorithm(EmptyAlgorithm original, Cloner cloner)
61      : base(original, cloner) {
62      this.exceptionMessage = original.exceptionMessage;
63      this.results = new ResultCollection();
64    }
65    public EmptyAlgorithm()
66      : base() {
67      results = new ResultCollection();
68    }
69    public EmptyAlgorithm(string exceptionMessage)
70      : this() {
71      this.exceptionMessage = exceptionMessage;
72    }
73
74    public override IDeepCloneable Clone(Cloner cloner) {
75      return new EmptyAlgorithm(this, cloner);
76    }
77
78    public override void Prepare() {
79      throw new InvalidOperationException(string.IsNullOrEmpty(exceptionMessage) ? "Cannot prepare an EmptyAlgorithm." : exceptionMessage);
80    }
81    public override void Start() {
82      throw new InvalidOperationException(string.IsNullOrEmpty(exceptionMessage) ? "Cannot start an EmptyAlgorithm." : exceptionMessage);
83    }
84    public override void Pause() {
85      throw new InvalidOperationException(string.IsNullOrEmpty(exceptionMessage) ? "Cannot pause an EmptyAlgorithm." : exceptionMessage);
86    }
87    public override void Stop() {
88      throw new InvalidOperationException(string.IsNullOrEmpty(exceptionMessage) ? "Cannot stop an EmptyAlgorithm." : exceptionMessage);
89    }
90  }
91}
Note: See TracBrowser for help on using the repository browser.