#region License Information /* HeuristicLab * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System; using System.Collections.Generic; using System.Drawing; using HeuristicLab.Common; using HeuristicLab.Core; using HeuristicLab.Optimization; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; namespace HeuristicLab.Clients.OKB { [Item("OKB Run", "The parameters and results of an algorithm run which are stored in the OKB.")] [StorableClass] public sealed class OKBRun : NamedItemWrapper, IRun, IStorableContent { public string Filename { get; set; } private long runId; public long RunId { get { return runId; } } public IAlgorithm Algorithm { get { return WrappedItem.Algorithm; } } public IDictionary Parameters { get { return WrappedItem.Parameters; } } public IDictionary Results { get { return WrappedItem.Results; } } public Color Color { get { return WrappedItem.Color; } set { WrappedItem.Color = value; } } public bool Visible { get { return WrappedItem.Visible; } set { WrappedItem.Visible = value; } } #region Persistence Properties [Storable(Name = "RunId")] private long StorableRunId { get { return runId; } set { runId = value; } } #endregion [StorableConstructor] private OKBRun(bool deserializing) : base(deserializing) { } private OKBRun(OKBRun original, Cloner cloner) : base(original, cloner) { runId = original.runId; } public OKBRun(IRun run) : base(run) { runId = -1; } public override IDeepCloneable Clone(Cloner cloner) { return new OKBRun(this, cloner); } #region Events public event EventHandler Changed; private void OnChanged() { var handler = Changed; if (handler != null) handler(this, EventArgs.Empty); } protected override void RegisterWrappedItemEvents() { base.RegisterWrappedItemEvents(); WrappedItem.Changed += new EventHandler(WrappedItem_Changed); } protected override void DeregisterWrappedItemEvents() { WrappedItem.Changed -= new EventHandler(WrappedItem_Changed); base.DeregisterWrappedItemEvents(); } private void WrappedItem_Changed(object sender, EventArgs e) { OnChanged(); } #endregion } }