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 single operation with one operator and one scope.
|
---|
31 | /// </summary>
|
---|
32 | public class AtomicOperation : ItemBase, IOperation {
|
---|
33 |
|
---|
34 | [Storable]
|
---|
35 | private IOperator myOperator;
|
---|
36 | /// <summary>
|
---|
37 | /// Gets the current operator as <see cref="IOperator"/>.
|
---|
38 | /// </summary>
|
---|
39 | public IOperator Operator {
|
---|
40 | get { return myOperator; }
|
---|
41 | }
|
---|
42 |
|
---|
43 | [Storable]
|
---|
44 | private IScope myScope;
|
---|
45 | /// <summary>
|
---|
46 | /// Gets the current scope as <see cref="IScope"/>.
|
---|
47 | /// </summary>
|
---|
48 | public IScope Scope {
|
---|
49 | get { return myScope; }
|
---|
50 | }
|
---|
51 |
|
---|
52 | /// <summary>
|
---|
53 | /// Initializes a new instance of <see cref="AtomicOperation"/>.
|
---|
54 | /// </summary>
|
---|
55 | public AtomicOperation() { }
|
---|
56 | /// <summary>
|
---|
57 | /// Initializes a new instance of <see cref="AtomicOperation"/> with the given <paramref name="op"/>
|
---|
58 | /// and the given <paramref name="scope"/>.
|
---|
59 | /// </summary>
|
---|
60 | /// <param name="op">The operator to assign.</param>
|
---|
61 | /// <param name="scope">The scope to assign.</param>
|
---|
62 | public AtomicOperation(IOperator op, IScope scope) {
|
---|
63 | myOperator = op;
|
---|
64 | myScope = scope;
|
---|
65 | }
|
---|
66 |
|
---|
67 | /// <summary>
|
---|
68 | /// Clones the current instance.
|
---|
69 | /// </summary>
|
---|
70 | /// <remarks>The operator and the scope objects are cloned with the
|
---|
71 | /// <see cref="HeuristicLab.Core.Auxiliary.Clone"/> method of the <see cref="Auxiliary"/> class.</remarks>
|
---|
72 | /// <param name="clonedObjects">All already cloned objects. (Needed to avoid cycles.)</param>
|
---|
73 | /// <returns>The cloned object as <see cref="AtomicOperation"/>.</returns>
|
---|
74 | public override ICloneable Clone(ICloner cloner) {
|
---|
75 | AtomicOperation clone = new AtomicOperation();
|
---|
76 | cloner.AddClonedObject(this, clone);
|
---|
77 | clone.myOperator = (IOperator)cloner.Clone(Operator);
|
---|
78 | clone.myScope = (IScope)cloner.Clone(Scope);
|
---|
79 | return clone;
|
---|
80 | }
|
---|
81 | }
|
---|
82 | }
|
---|