Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/RunCreation/OKBRun.cs @ 5639

Last change on this file since 5639 was 5639, checked in by swagner, 13 years ago

Worked on OKB (#1174)

File size: 3.2 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 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 System.Collections.Generic;
24using System.Drawing;
25using HeuristicLab.Common;
26using HeuristicLab.Core;
27using HeuristicLab.Optimization;
28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
29
30namespace HeuristicLab.Clients.OKB {
31  [Item("OKB Run", "The parameters and results of an algorithm run which are stored in the OKB.")]
32  [StorableClass]
33  public sealed class OKBRun : NamedItemWrapper<IRun>, IRun, IStorableContent {
34    public string Filename { get; set; }
35
36    private long runId;
37    public long RunId {
38      get { return runId; }
39    }
40
41    public IAlgorithm Algorithm {
42      get { return WrappedItem.Algorithm; }
43    }
44    public IDictionary<string, IItem> Parameters {
45      get { return WrappedItem.Parameters; }
46    }
47    public IDictionary<string, IItem> Results {
48      get { return WrappedItem.Results; }
49    }
50
51    public Color Color {
52      get { return WrappedItem.Color; }
53      set { WrappedItem.Color = value; }
54    }
55    public bool Visible {
56      get { return WrappedItem.Visible; }
57      set { WrappedItem.Visible = value; }
58    }
59
60    #region Persistence Properties
61    [Storable(Name = "RunId")]
62    private long StorableRunId {
63      get { return runId; }
64      set { runId = value; }
65    }
66    #endregion
67
68    [StorableConstructor]
69    private OKBRun(bool deserializing) : base(deserializing) { }
70    private OKBRun(OKBRun original, Cloner cloner)
71      : base(original, cloner) {
72      runId = original.runId;
73    }
74    public OKBRun(IRun run)
75      : base(run) {
76      runId = -1;
77    }
78
79    public override IDeepCloneable Clone(Cloner cloner) {
80      return new OKBRun(this, cloner);
81    }
82
83    #region Events
84    public event EventHandler Changed;
85    private void OnChanged() {
86      var handler = Changed;
87      if (handler != null) handler(this, EventArgs.Empty);
88    }
89
90    protected override void RegisterWrappedItemEvents() {
91      base.RegisterWrappedItemEvents();
92      WrappedItem.Changed += new EventHandler(WrappedItem_Changed);
93    }
94    protected override void DeregisterWrappedItemEvents() {
95      WrappedItem.Changed -= new EventHandler(WrappedItem_Changed);
96      base.DeregisterWrappedItemEvents();
97    }
98
99    private void WrappedItem_Changed(object sender, EventArgs e) {
100      OnChanged();
101    }
102    #endregion
103  }
104}
Note: See TracBrowser for help on using the repository browser.