Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Hive_Milestone3/sources/HeuristicLab.Logging/3.3/Log.cs @ 2298

Last change on this file since 2298 was 1872, checked in by epitzer, 15 years ago

Upgrade Charting.Data, Logging, Operators.Programmable, OptimizationFrontend, OffspringSelection, SGA, TestFunctions and ThreadParallelEngine to 3.3 (#603)

File size: 3.1 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 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.Text;
25using System.Xml;
26using HeuristicLab.Core;
27using HeuristicLab.Data;
28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
29
30namespace HeuristicLab.Logging {
31  /// <summary>
32  /// Represents a log object where to store a specific value that should be logged.
33  /// </summary>
34  public class Log : ItemBase, IVisualizationItem {
35    [Storable]
36    private ItemList myItems;
37    /// <summary>
38    /// Gets or sets the items of the current instance.
39    /// </summary>
40    public ItemList Items {
41      get { return myItems; }
42      set { myItems = value; }
43    }
44
45
46    /// <summary>
47    /// Initializes a new instance of <see cref="Log"/>.
48    /// </summary>
49    public Log() { }
50    /// <summary>
51    /// Initializes a new instance of <see cref="Log"/> with the given items.
52    /// </summary>
53    /// <param name="items">The list of items with which to initialize the current instance.</param>
54    public Log(ItemList items) {
55      myItems = items;
56    }
57
58    /// <summary>
59    /// Clones the current instance (deep clone).
60    /// </summary>
61    /// <remarks>Deep clone through <see cref="Auxiliary.Clone"/> method of helper class
62    /// <see cref="Auxiliary"/>.</remarks>
63    /// <param name="clonedObjects">Dictionary of all already clone objects. (Needed to avoid cycles.)</param>
64    /// <returns>The cloned object as <see cref="Log"/>.</returns>
65    public override object Clone(IDictionary<Guid, object> clonedObjects) {
66      Log clone = (Log)base.Clone(clonedObjects);
67      clone.myItems = (ItemList)Auxiliary.Clone(Items, clonedObjects);
68      return clone;
69    }
70
71    /// <summary>
72    /// Creates an instance of <see cref="LogView"/> to represent the current instance visually.
73    /// </summary>
74    /// <returns>The created view as <see cref="LogView"/>.</returns>
75    public override IView CreateView() {
76      return new LogView(this);
77    }
78
79    /// <summary>
80    /// Occurs when the items have been changed.
81    /// </summary>
82    public event EventHandler ItemsChanged;
83    /// <summary>
84    /// Fires a new <c>ItemsChanged</c> event.
85    /// </summary>
86    protected virtual void OnItemsChanged() {
87      if (ItemsChanged != null)
88        ItemsChanged(this, new EventArgs());
89    }
90  }
91}
Note: See TracBrowser for help on using the repository browser.