Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/Interfaces/IScope.cs @ 2042

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

Refactoring of the operator architecture (#95)

File size: 5.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;
25using System.Xml;
26
27namespace HeuristicLab.Core {
28  /// <summary>
29  /// Interface for a hierarchical container of variables (containing variables and subscopes).
30  /// </summary>
31  public interface IScope : IItem {
32    /// <summary>
33    /// Gets the name of the current instance.
34    /// </summary>
35    string Name { get; }
36
37    /// <summary>
38    /// Gets the varibles of the current scope.
39    /// </summary>
40    ICollection<IVariable> Variables { get; }
41    /// <summary>
42    /// Gets all subscopes in the current scope.
43    /// </summary>
44    IList<IScope> SubScopes { get; }
45
46    /// <summary>
47    /// Sets the parent scope for the current instance.
48    /// </summary>
49    /// <param name="scope">The parent scope of the current instance.</param>
50    void SetParent(IScope scope);
51
52    /// <summary>
53    /// Gets a variable with the given <paramref name="name"/>.
54    /// </summary>
55    /// <param name="name">The name of the variable.</param>
56    /// <returns>The variable with the specified name.</returns>
57    IVariable GetVariable(string name);
58    /// <summary>
59    /// Adds the specified variable to the curent instance.
60    /// </summary>
61    /// <param name="variable">The variable to add.</param>
62    void AddVariable(IVariable variable);
63    /// <summary>
64    /// Deletes a variable with the specified <paramref name="name"/> from the current instance.
65    /// </summary>
66    /// <param name="name">The name of the variable to delete.</param>
67    void RemoveVariable(string name);
68   
69    /// <inheritdoc cref="GetVariableValue(string, bool)"/>
70    /// <typeparam name="T">The type of the value that is searched.</typeparam>
71    T GetVariableValue<T>(string name, bool recursiveLookup) where T : class, IItem;
72    /// <inheritdoc cref="GetVariableValue(string, bool, bool)"/>
73    /// <typeparam name="T">The type of the value that is searched.</typeparam>
74    T GetVariableValue<T>(string name, bool recursiveLookup, bool throwOnError) where T : class, IItem;
75    /// <inheritdoc cref="GetVariableValue(string, bool, bool)" select="summary"/>
76    /// <param name="name">The name of the variable.</param>
77    /// <param name="recursiveLookup">Boolean value, whether the parent scopes shall be searched
78    /// when the variable is not found in the current instance.</param>
79    /// <returns>The value of the variable or <c>null</c> if it was not found.</returns>
80    IItem GetVariableValue(string name, bool recursiveLookup);
81    /// <summary>
82    /// Gets the value of the variable with the given <paramref name="name"/>.
83    /// </summary>
84    /// <param name="name">The name of the variable.</param>
85    /// <param name="recursiveLookup">Boolean value, whether the parent scopes shall be searched
86    /// when the variable is not found in the current instance.</param>
87    /// <param name="throwOnError">Boolean value, whether an exception shall be thrown when the searched
88    /// variable cannot be found, or only <c>null</c> shall be returned.</param>
89    /// <returns>The value of the searched variable or <c>null</c> if <paramref name="throwOnError"/>
90    /// is set to <c>false</c>.</returns>
91    IItem GetVariableValue(string name, bool recursiveLookup, bool throwOnError);
92
93    /// <summary>
94    /// Adds the specified sub scope to the current instance.
95    /// </summary>
96    /// <param name="scope">The sub scope to add.</param>
97    void AddSubScope(IScope scope);
98    /// <summary>
99    /// Deletes the specified sub scope from the current instance.
100    /// </summary>
101    /// <param name="scope">The sub scope to delete.</param>
102    void RemoveSubScope(IScope scope);
103    /// <summary>
104    /// Reorders all sub scopes according to the specified chronology.
105    /// </summary>
106    /// <param name="sequence">The chronology how to order the sub scopes.</param>
107    void ReorderSubScopes(int[] sequence);
108    /// <summary>
109    /// Gets the sub scope with the given <paramref name="name"/>.
110    /// </summary>
111    /// <param name="name">The name of the sub scope.</param>
112    /// <returns>The sub scope with the given <paramref name="name"/>.</returns>
113    IScope GetScope(string name);
114
115    /// <summary>
116    /// Clears the current instance.
117    /// </summary>
118    void Clear();
119
120    /// <summary>
121    /// Occurs when a variable has been added to the current instance.
122    /// </summary>
123    event EventHandler<VariableEventArgs> VariableAdded;
124    /// <summary>
125    /// Occurs when a variable has been deleted from the current instance.
126    /// </summary>
127    event EventHandler<VariableEventArgs> VariableRemoved;
128    /// <summary>
129    /// Occurs when a sub scope has been added to the current instance.
130    /// </summary>
131    event EventHandler<ScopeIndexEventArgs> SubScopeAdded;
132    /// <summary>
133    /// Occurs when a sub scope has been deleted from the current instance.
134    /// </summary>
135    event EventHandler<ScopeIndexEventArgs> SubScopeRemoved;
136    /// <summary>
137    /// Occurs when the sub scopes have been reordered.
138    /// </summary>
139    event EventHandler SubScopesReordered;
140  }
141}
Note: See TracBrowser for help on using the repository browser.