Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Operator Architecture Refactoring/HeuristicLab.Core/3.2/Interfaces/IOperator.cs @ 2027

Last change on this file since 2027 was 2027, checked in by swagner, 15 years ago

Refactoring of the operator architecture (#95)

File size: 4.9 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;
25
26namespace HeuristicLab.Core {
27  /// <summary>
28  /// Interface to represent an operator (e.g. GreaterThanComparator,...),
29  /// a basic instruction of an algorithm.
30  /// </summary>
31  public interface IOperator : IItem {
32    /// <summary>
33    /// Gets or sets the name of the current instance.
34    /// </summary>
35    string Name { get; set; }
36    /// <summary>
37    /// Gets or sets the description of the current instance.
38    /// </summary>
39    string Description { get; }
40
41    /// <summary>
42    /// Gets information whether the current operator has been canceled.
43    /// </summary>
44    bool Canceled { get; }
45    /// <summary>
46    /// Gets or sets a boolean value whether the engine should stop here during the run.
47    /// </summary>
48    bool Breakpoint { get; set; }
49
50    /// <summary>
51    /// Gets a list of all sub operators.
52    /// </summary>
53    IList<IOperator> SubOperators { get; }
54    /// <summary>
55    /// Gets a collection of all variable (parameter) infos.
56    /// </summary>
57    ICollection<IParameter> Parameters { get; }
58
59    /// <summary>
60    /// Adds the given sub operator to the current instance.
61    /// </summary>
62    /// <param name="op">The operator to add.</param>
63    void AddSubOperator(IOperator op);
64    /// <summary>
65    /// Adds the given sub operator at a the specified <paramref name="index"/>.
66    /// </summary>
67    /// <param name="op">The operator to add.</param>
68    /// <param name="index">The position where to add the operator.</param>
69    void AddSubOperator(IOperator op, int index);
70    /// <summary>
71    /// Removes a sub operator at the specified <paramref name="index"/>.
72    /// </summary>
73    /// <param name="index">The position where to delete the operator.</param>
74    void RemoveSubOperator(int index);
75
76    /// <summary>
77    /// Gets the variable info with the given <paramref name="formalName"/>.
78    /// </summary>
79    /// <param name="formalName">The formal name of the variable info.</param>
80    /// <returns>The variable info with the specified formal name.</returns>
81    IParameter GetParameter(string name);
82    /// <summary>
83    /// Adds the specified variable info to the current instance.
84    /// </summary>
85    /// <param name="variableInfo">The variable info to add.</param>
86    void AddParameter(IParameter parameter);
87    /// <summary>
88    /// Removes the variable info with the given formal name.
89    /// </summary>
90    /// <param name="formalName">The formal name of the variable info to remove.</param>
91    void RemoveParameter(string name);
92
93    /// <summary>
94    /// Executes the current instance on the specified <paramref name="scope"/>.
95    /// </summary>
96    /// <param name="scope">The scope where to execute the current instance.</param>
97    /// <returns>The next operation.</returns>
98    IOperation Execute(IEnvironment env, IScope scope);
99    /// <summary>
100    /// Aborts the current operator.
101    /// </summary>
102    void Abort();
103
104    /// <summary>
105    /// Occurs when the name of the operator was changed.
106    /// </summary>
107    event EventHandler NameChanged;
108    /// <summary>
109    /// Occurs when the breakpoint flag of the current instance was changed.
110    /// </summary>
111    event EventHandler BreakpointChanged;
112    /// <summary>
113    /// Occurs when a sub operator has been added.
114    /// </summary>
115    event EventHandler<OperatorIndexEventArgs> SubOperatorAdded;
116    /// <summary>
117    /// Occurs when a sub operator has been deleted.
118    /// </summary>
119    event EventHandler<OperatorIndexEventArgs> SubOperatorRemoved;
120    /// <summary>
121    /// Occurs when a variable info has been added.
122    /// </summary>
123    event EventHandler<ParameterEventArgs> ParameterAdded;
124    /// <summary>
125    /// Occurs when a variable info has been deleted.
126    /// </summary>
127    event EventHandler<ParameterEventArgs> ParameterRemoved;
128    /// <summary>
129    /// Occurs when the current instance is executed.
130    /// </summary>
131    event EventHandler Executed;
132  }
133}
Note: See TracBrowser for help on using the repository browser.