Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Core/3.3/OperatorLibrary.cs @ 2321

Last change on this file since 2321 was 1823, checked in by epitzer, 16 years ago

Namespace refactoring: rename formatters & decomposers -> primitive and composite serializers. (#603)

File size: 2.9 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.Persistence.Default.CompositeSerializers.Storable;
27
28namespace HeuristicLab.Core {
29  /// <summary>
30  /// Represents a library of operators consisting of one <see cref="IOperatorGroup"/>.
31  /// </summary>
32  public class OperatorLibrary : ItemBase, IOperatorLibrary, IEditable {
33
34    [Storable]
35    private IOperatorGroup myGroup;
36    /// <summary>
37    /// Gets the operator group of the current instance.
38    /// </summary>
39    public IOperatorGroup Group {
40      get { return myGroup; }
41    }
42
43    /// <summary>
44    /// Initializes a new instance of <see cref="OperatorLibrary"/>.
45    /// </summary>
46    public OperatorLibrary() {
47      myGroup = new OperatorGroup();
48    }
49
50    /// <summary>
51    /// Creates a new instance of <see cref="OperatorLibraryEditor"/> to display the current instance.
52    /// </summary>
53    /// <returns>The created view as <see cref="OperatorLibraryEditor"/>.</returns>
54    public override IView CreateView() {
55      return new OperatorLibraryEditor(this);
56    }
57    /// <summary>
58    /// Creates a new instance of <see cref="OperatorLibraryEditor"/> to display the current instance.
59    /// </summary>
60    /// <returns>The created editor as <see cref="OperatorLibraryEditor"/>.</returns>
61    public virtual IEditor CreateEditor() {
62      return new OperatorLibraryEditor(this);
63    }
64
65    /// <summary>
66    /// Clones the current instance (deep clone).
67    /// </summary>
68    /// <remarks>Deep clone through <see cref="Auxiliary.Clone"/> method of helper class
69    /// <see cref="Auxiliary"/>.</remarks>
70    /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param>
71    /// <returns>The cloned object as <see cref="OperatorLibrary"/>.</returns>
72    public override object Clone(IDictionary<Guid, object> clonedObjects) {
73      OperatorLibrary clone = new OperatorLibrary();
74      clonedObjects.Add(Guid, clone);
75      clone.myGroup = (IOperatorGroup)Auxiliary.Clone(Group, clonedObjects);
76      return clone;
77    }
78  }
79}
Note: See TracBrowser for help on using the repository browser.