Free cookie consent management tool by TermsFeed Policy Generator

source: branches/CEDMA-Refactoring-Ticket419/HeuristicLab.Operators/OperatorExtractor.cs @ 1196

Last change on this file since 1196 was 801, checked in by vdorfer, 16 years ago

Created API documentation for HeuristicLab.Operators namespace (#331)

File size: 2.5 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 HeuristicLab.Core;
26using HeuristicLab.Data;
27
28namespace HeuristicLab.Operators {
29  /// <summary>
30  /// Retrieves an operator from a specified scope and returns a successor operation with this operation
31  /// and scope.
32  /// </summary>
33  public class OperatorExtractor : OperatorBase {
34    /// <inheritdoc select="summary"/>
35    public override string Description {
36      get { return @"An operator extractor retrievs an operator from the scope it is applied on and returns a successor operation containing this operator and the current scope. Lookup for the operator is done recursively.
37
38Operator extractors can be used to get those operators again that have been injected by combined operators."; }
39    }
40
41    /// <summary>
42    /// Initializes a new instance of <see cref="OperatorExtractor"/> with
43    /// one variable info (<c>Operator</c>).
44    /// </summary>
45    public OperatorExtractor()
46      : base() {
47      AddVariableInfo(new VariableInfo("Operator", "Extracted operator", typeof(IOperator), VariableKind.In));
48    }
49
50    /// <summary>
51    /// Gets an operator from the specified <paramref name="scope"/> and returns an
52    /// <see cref="AtomicOperation"/> containing this operator and scope.
53    /// </summary>
54    /// <param name="scope">The scope where to apply the operator on.</param>
55    /// <returns>A new <see cref="AtomicOperation"/> containing the operator and the given
56    /// <paramref name="scope"/>.</returns>
57    public override IOperation Apply(IScope scope) {
58      IOperator op = GetVariableValue<IOperator>("Operator", scope, true, true);
59      return new AtomicOperation(op, scope);
60    }
61  }
62}
Note: See TracBrowser for help on using the repository browser.