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.Persistence.Default.CompositeSerializers.Storable;
|
---|
27 |
|
---|
28 | namespace 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 | }
|
---|