Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 2526 was 2526, checked in by swagner, 14 years ago

Refactored cloning (#806)

File size: 2.3 KB
RevLine 
[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
22using System;
23using System.Collections.Generic;
24using System.Text;
25using System.Xml;
[1823]26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
[2]27
28namespace HeuristicLab.Core {
[776]29  /// <summary>
30  /// Represents a library of operators consisting of one <see cref="IOperatorGroup"/>.
31  /// </summary>
[2520]32  public class OperatorLibrary : ItemBase, IOperatorLibrary {
[1667]33
34    [Storable]
[2]35    private IOperatorGroup myGroup;
[776]36    /// <summary>
37    /// Gets the operator group of the current instance.
38    /// </summary>
[2]39    public IOperatorGroup Group {
40      get { return myGroup; }
41    }
42
[776]43    /// <summary>
44    /// Initializes a new instance of <see cref="OperatorLibrary"/>.
45    /// </summary>
[2]46    public OperatorLibrary() {
47      myGroup = new OperatorGroup();
48    }
49
[776]50    /// <summary>
51    /// Clones the current instance (deep clone).
52    /// </summary>
[2526]53    /// <remarks>Deep clone through <see cref="cloner.Clone"/> method of helper class
[776]54    /// <see cref="Auxiliary"/>.</remarks>
55    /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param>
56    /// <returns>The cloned object as <see cref="OperatorLibrary"/>.</returns>
[2526]57    public override IItem Clone(ICloner cloner) {
[2]58      OperatorLibrary clone = new OperatorLibrary();
[2526]59      cloner.RegisterClonedObject(this, clone);
60      clone.myGroup = (IOperatorGroup)cloner.Clone(Group);
[2]61      return clone;
62    }
63  }
64}
Note: See TracBrowser for help on using the repository browser.