Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Core/3.3/AtomicOperation.cs @ 2301

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

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

File size: 2.9 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 single operation with one operator and one scope.
31  /// </summary>
[2]32  public class AtomicOperation : ItemBase, IOperation {
[1667]33
34    [Storable]
[2]35    private IOperator myOperator;
[776]36    /// <summary>
37    /// Gets the current operator as <see cref="IOperator"/>.
38    /// </summary>
[2]39    public IOperator Operator {
40      get { return myOperator; }
41    }
[1667]42
43    [Storable]
44    private IScope myScope;
[776]45    /// <summary>
46    /// Gets the current scope as <see cref="IScope"/>.
47    /// </summary>
[2]48    public IScope Scope {
49      get { return myScope; }
50    }
51
[776]52    /// <summary>
53    /// Initializes a new instance of <see cref="AtomicOperation"/>.
54    /// </summary>
[2]55    public AtomicOperation() { }
[776]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>
[2]62    public AtomicOperation(IOperator op, IScope scope) {
63      myOperator = op;
64      myScope = scope;
65    }
66
[776]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>
[2]74    public override object Clone(IDictionary<Guid, object> clonedObjects) {
75      AtomicOperation clone = new AtomicOperation();
76      clonedObjects.Add(Guid, clone);
77      clone.myOperator = (IOperator)Auxiliary.Clone(Operator, clonedObjects);
78      clone.myScope = (IScope)Auxiliary.Clone(Scope, clonedObjects);
79      return clone;
80    }
81  }
82}
Note: See TracBrowser for help on using the repository browser.