[2] | 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 |
|
---|
| 22 | using System;
|
---|
| 23 | using System.Collections.Generic;
|
---|
| 24 | using System.Text;
|
---|
| 25 | using System.Xml;
|
---|
| 26 | using HeuristicLab.Core;
|
---|
| 27 | using HeuristicLab.Data;
|
---|
[1872] | 28 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
[2] | 29 |
|
---|
| 30 | namespace HeuristicLab.Logging {
|
---|
[1167] | 31 | /// <summary>
|
---|
| 32 | /// Represents a log object where to store a specific value that should be logged.
|
---|
| 33 | /// </summary>
|
---|
[2] | 34 | public class Log : ItemBase, IVisualizationItem {
|
---|
[1872] | 35 | [Storable]
|
---|
[2] | 36 | private ItemList myItems;
|
---|
[1167] | 37 | /// <summary>
|
---|
| 38 | /// Gets or sets the items of the current instance.
|
---|
| 39 | /// </summary>
|
---|
[2] | 40 | public ItemList Items {
|
---|
| 41 | get { return myItems; }
|
---|
| 42 | set { myItems = value; }
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 |
|
---|
[1167] | 46 | /// <summary>
|
---|
| 47 | /// Initializes a new instance of <see cref="Log"/>.
|
---|
| 48 | /// </summary>
|
---|
[2] | 49 | public Log() { }
|
---|
[1167] | 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>
|
---|
[2] | 54 | public Log(ItemList items) {
|
---|
| 55 | myItems = items;
|
---|
| 56 | }
|
---|
| 57 |
|
---|
[1167] | 58 | /// <summary>
|
---|
| 59 | /// Clones the current instance (deep clone).
|
---|
| 60 | /// </summary>
|
---|
[2526] | 61 | /// <remarks>Deep clone through <see cref="cloner.Clone"/> method of helper class
|
---|
[1167] | 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>
|
---|
[2526] | 65 | public override IItem Clone(ICloner cloner) {
|
---|
| 66 | Log clone = (Log)base.Clone(cloner);
|
---|
| 67 | clone.myItems = (ItemList)cloner.Clone(Items);
|
---|
[2] | 68 | return clone;
|
---|
| 69 | }
|
---|
| 70 |
|
---|
[1167] | 71 | /// <summary>
|
---|
| 72 | /// Occurs when the items have been changed.
|
---|
| 73 | /// </summary>
|
---|
[2] | 74 | public event EventHandler ItemsChanged;
|
---|
[1167] | 75 | /// <summary>
|
---|
| 76 | /// Fires a new <c>ItemsChanged</c> event.
|
---|
| 77 | /// </summary>
|
---|
[2] | 78 | protected virtual void OnItemsChanged() {
|
---|
| 79 | if (ItemsChanged != null)
|
---|
| 80 | ItemsChanged(this, new EventArgs());
|
---|
| 81 | }
|
---|
| 82 | }
|
---|
| 83 | }
|
---|