[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 |
|
---|
| 22 | using System;
|
---|
| 23 | using System.Collections.Generic;
|
---|
| 24 | using System.Text;
|
---|
| 25 | using System.Xml;
|
---|
| 26 |
|
---|
| 27 | namespace HeuristicLab.Core {
|
---|
[776] | 28 | /// <summary>
|
---|
| 29 | /// Interface for a hierarchical container of variables (containing variables and subscopes).
|
---|
| 30 | /// </summary>
|
---|
[2] | 31 | public interface IScope : IItem {
|
---|
[776] | 32 | /// <summary>
|
---|
| 33 | /// Gets the name of the current instance.
|
---|
| 34 | /// </summary>
|
---|
[2] | 35 | string Name { get; }
|
---|
| 36 |
|
---|
[776] | 37 | /// <summary>
|
---|
| 38 | /// Gets the varibles of the current scope.
|
---|
| 39 | /// </summary>
|
---|
[2] | 40 | ICollection<IVariable> Variables { get; }
|
---|
[776] | 41 | /// <summary>
|
---|
| 42 | /// Gets all aliases of the current scope.
|
---|
| 43 | /// </summary>
|
---|
[63] | 44 | IEnumerable<KeyValuePair<string, string>> Aliases { get; }
|
---|
[776] | 45 | /// <summary>
|
---|
| 46 | /// Gets all subscopes in the current scope.
|
---|
| 47 | /// </summary>
|
---|
[2] | 48 | IList<IScope> SubScopes { get; }
|
---|
| 49 |
|
---|
[776] | 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>
|
---|
[2] | 54 | void SetParent(IScope scope);
|
---|
| 55 |
|
---|
[776] | 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>
|
---|
[2] | 61 | IVariable GetVariable(string name);
|
---|
[776] | 62 | /// <summary>
|
---|
| 63 | /// Adds the specified variable to the curent instance.
|
---|
| 64 | /// </summary>
|
---|
| 65 | /// <param name="variable">The variable to add.</param>
|
---|
[2] | 66 | void AddVariable(IVariable variable);
|
---|
[776] | 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>
|
---|
[2] | 71 | void RemoveVariable(string name);
|
---|
[776] | 72 |
|
---|
| 73 | /// <inheritdoc cref="GetVariableValue(string, bool)"/>
|
---|
| 74 | /// <typeparam name="T">The type of the value that is searched.</typeparam>
|
---|
[2] | 75 | T GetVariableValue<T>(string name, bool recursiveLookup) where T : class, IItem;
|
---|
[776] | 76 | /// <inheritdoc cref="GetVariableValue(string, bool, bool)"/>
|
---|
| 77 | /// <typeparam name="T">The type of the value that is searched.</typeparam>
|
---|
[2] | 78 | T GetVariableValue<T>(string name, bool recursiveLookup, bool throwOnError) where T : class, IItem;
|
---|
[776] | 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>
|
---|
[2] | 84 | IItem GetVariableValue(string name, bool recursiveLookup);
|
---|
[776] | 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>
|
---|
[2] | 95 | IItem GetVariableValue(string name, bool recursiveLookup, bool throwOnError);
|
---|
| 96 |
|
---|
[776] | 97 | /// <summary>
|
---|
[801] | 98 | /// Gets the actual name of the given alias.
|
---|
[776] | 99 | /// </summary>
|
---|
| 100 | /// <param name="name">The alias whose actual name is searched.</param>
|
---|
| 101 | /// <returns>The actual name.</returns>
|
---|
[61] | 102 | string TranslateName(string name);
|
---|
[776] | 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>
|
---|
[61] | 108 | void AddAlias(string alias, string name);
|
---|
[776] | 109 | /// <summary>
|
---|
| 110 | /// Deletes the specified <paramref name="alias"/> from the current instance.
|
---|
| 111 | /// </summary>
|
---|
| 112 | /// <param name="alias">The alias to delete.</param>
|
---|
[61] | 113 | void RemoveAlias(string alias);
|
---|
| 114 |
|
---|
[776] | 115 | /// <summary>
|
---|
| 116 | /// Adds the specified sub scope to the current instance.
|
---|
| 117 | /// </summary>
|
---|
| 118 | /// <param name="scope">The sub scope to add.</param>
|
---|
[2] | 119 | void AddSubScope(IScope scope);
|
---|
[776] | 120 | /// <summary>
|
---|
| 121 | /// Deletes the specified sub scope from the current instance.
|
---|
| 122 | /// </summary>
|
---|
| 123 | /// <param name="scope">The sub scope to delete.</param>
|
---|
[2] | 124 | void RemoveSubScope(IScope scope);
|
---|
[776] | 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>
|
---|
[2] | 129 | void ReorderSubScopes(int[] sequence);
|
---|
[776] | 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>
|
---|
[2] | 135 | IScope GetScope(Guid guid);
|
---|
[776] | 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>
|
---|
[2] | 141 | IScope GetScope(string name);
|
---|
| 142 |
|
---|
[776] | 143 | /// <summary>
|
---|
| 144 | /// Clears the current instance.
|
---|
| 145 | /// </summary>
|
---|
[2] | 146 | void Clear();
|
---|
| 147 |
|
---|
[776] | 148 | /// <summary>
|
---|
| 149 | /// Occurs when a variable has been added to the current instance.
|
---|
| 150 | /// </summary>
|
---|
[2] | 151 | event EventHandler<VariableEventArgs> VariableAdded;
|
---|
[776] | 152 | /// <summary>
|
---|
| 153 | /// Occurs when a variable has been deleted from the current instance.
|
---|
| 154 | /// </summary>
|
---|
[2] | 155 | event EventHandler<VariableEventArgs> VariableRemoved;
|
---|
[776] | 156 | /// <summary>
|
---|
| 157 | /// Occurs when an alias has been added to the current instance.
|
---|
| 158 | /// </summary>
|
---|
[61] | 159 | event EventHandler<AliasEventArgs> AliasAdded;
|
---|
[776] | 160 | /// <summary>
|
---|
| 161 | /// Occurs when an alias has been removed from the current instance.
|
---|
| 162 | /// </summary>
|
---|
[61] | 163 | event EventHandler<AliasEventArgs> AliasRemoved;
|
---|
[776] | 164 | /// <summary>
|
---|
| 165 | /// Occurs when a sub scope has been added to the current instance.
|
---|
| 166 | /// </summary>
|
---|
[2] | 167 | event EventHandler<ScopeIndexEventArgs> SubScopeAdded;
|
---|
[776] | 168 | /// <summary>
|
---|
| 169 | /// Occurs when a sub scope has been deleted from the current instance.
|
---|
| 170 | /// </summary>
|
---|
[2] | 171 | event EventHandler<ScopeIndexEventArgs> SubScopeRemoved;
|
---|
[776] | 172 | /// <summary>
|
---|
| 173 | /// Occurs when the sub scopes have been reordered.
|
---|
| 174 | /// </summary>
|
---|
[2] | 175 | event EventHandler SubScopesReordered;
|
---|
| 176 | }
|
---|
| 177 | }
|
---|