Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Core/3.3/Interfaces/IScope.cs @ 1921

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

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

File size: 7.4 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 aliases of the current scope.
43    /// </summary>
44    IEnumerable<KeyValuePair<string, string>> Aliases { get; }
45    /// <summary>
46    /// Gets all subscopes in the current scope.
47    /// </summary>
48    IList<IScope> SubScopes { get; }
49
50    /// <summary>
51    /// Sets the parent scope for the current instance.
52    /// </summary>
53    /// <param name="scope">The parent scope of the current instance.</param>
54    void SetParent(IScope scope);
55
56    /// <summary>
57    /// Gets a variable with the given <paramref name="name"/>.
58    /// </summary>
59    /// <param name="name">The name of the variable.</param>
60    /// <returns>The variable with the specified name.</returns>
61    IVariable GetVariable(string name);
62    /// <summary>
63    /// Adds the specified variable to the curent instance.
64    /// </summary>
65    /// <param name="variable">The variable to add.</param>
66    void AddVariable(IVariable variable);
67    /// <summary>
68    /// Deletes a variable with the specified <paramref name="name"/> from the current instance.
69    /// </summary>
70    /// <param name="name">The name of the variable to delete.</param>
71    void RemoveVariable(string name);
72   
73    /// <inheritdoc cref="GetVariableValue(string, bool)"/>
74    /// <typeparam name="T">The type of the value that is searched.</typeparam>
75    T GetVariableValue<T>(string name, bool recursiveLookup) where T : class, IItem;
76    /// <inheritdoc cref="GetVariableValue(string, bool, bool)"/>
77    /// <typeparam name="T">The type of the value that is searched.</typeparam>
78    T GetVariableValue<T>(string name, bool recursiveLookup, bool throwOnError) where T : class, IItem;
79    /// <inheritdoc cref="GetVariableValue(string, bool, bool)" select="summary"/>
80    /// <param name="name">The name of the variable.</param>
81    /// <param name="recursiveLookup">Boolean value, whether the parent scopes shall be searched
82    /// when the variable is not found in the current instance.</param>
83    /// <returns>The value of the variable or <c>null</c> if it was not found.</returns>
84    IItem GetVariableValue(string name, bool recursiveLookup);
85    /// <summary>
86    /// Gets the value of the variable with the given <paramref name="name"/>.
87    /// </summary>
88    /// <param name="name">The name of the variable.</param>
89    /// <param name="recursiveLookup">Boolean value, whether the parent scopes shall be searched
90    /// when the variable is not found in the current instance.</param>
91    /// <param name="throwOnError">Boolean value, whether an exception shall be thrown when the searched
92    /// variable cannot be found, or only <c>null</c> shall be returned.</param>
93    /// <returns>The value of the searched variable or <c>null</c> if <paramref name="throwOnError"/>
94    /// is set to <c>false</c>.</returns>
95    IItem GetVariableValue(string name, bool recursiveLookup, bool throwOnError);
96
97    /// <summary>
98    /// Gets the actual name of the given alias.
99    /// </summary>
100    /// <param name="name">The alias whose actual name is searched.</param>
101    /// <returns>The actual name.</returns>
102    string TranslateName(string name);
103    /// <summary>
104    /// Adds an alias to the current instance.
105    /// </summary>
106    /// <param name="alias">The alias to add.</param>
107    /// <param name="name">The actual name of the alias.</param>
108    void AddAlias(string alias, string name);
109    /// <summary>
110    /// Deletes the specified <paramref name="alias"/> from the current instance.
111    /// </summary>
112    /// <param name="alias">The alias to delete.</param>
113    void RemoveAlias(string alias);
114
115    /// <summary>
116    /// Adds the specified sub scope to the current instance.
117    /// </summary>
118    /// <param name="scope">The sub scope to add.</param>
119    void AddSubScope(IScope scope);
120    /// <summary>
121    /// Deletes the specified sub scope from the current instance.
122    /// </summary>
123    /// <param name="scope">The sub scope to delete.</param>
124    void RemoveSubScope(IScope scope);
125    /// <summary>
126    /// Reorders all sub scopes according to the specified chronology.
127    /// </summary>
128    /// <param name="sequence">The chronology how to order the sub scopes.</param>
129    void ReorderSubScopes(int[] sequence);
130    /// <summary>
131    /// Gets the sub scope with the given <paramref name="guid"/>.
132    /// </summary>
133    /// <param name="guid">The unique identifier of the sub scope.</param>
134    /// <returns>The sub scope with the given <paramref name="guid"/>.</returns>
135    IScope GetScope(Guid guid);
136    /// <summary>
137    /// Gets the sub scope with the given <paramref name="name"/>.
138    /// </summary>
139    /// <param name="name">The name of the sub scope.</param>
140    /// <returns>The sub scope with the given <paramref name="name"/>.</returns>
141    IScope GetScope(string name);
142
143    /// <summary>
144    /// Clears the current instance.
145    /// </summary>
146    void Clear();
147
148    /// <summary>
149    /// Occurs when a variable has been added to the current instance.
150    /// </summary>
151    event EventHandler<VariableEventArgs> VariableAdded;
152    /// <summary>
153    /// Occurs when a variable has been deleted from the current instance.
154    /// </summary>
155    event EventHandler<VariableEventArgs> VariableRemoved;
156    /// <summary>
157    /// Occurs when an alias has been added to the current instance.
158    /// </summary>
159    event EventHandler<AliasEventArgs> AliasAdded;
160    /// <summary>
161    /// Occurs when an alias has been removed from the current instance.
162    /// </summary>
163    event EventHandler<AliasEventArgs> AliasRemoved;
164    /// <summary>
165    /// Occurs when a sub scope has been added to the current instance.
166    /// </summary>
167    event EventHandler<ScopeIndexEventArgs> SubScopeAdded;
168    /// <summary>
169    /// Occurs when a sub scope has been deleted from the current instance.
170    /// </summary>
171    event EventHandler<ScopeIndexEventArgs> SubScopeRemoved;
172    /// <summary>
173    /// Occurs when the sub scopes have been reordered.
174    /// </summary>
175    event EventHandler SubScopesReordered;
176  }
177}
Note: See TracBrowser for help on using the repository browser.