#region License Information
/* HeuristicLab
* Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using HeuristicLab.Common;
namespace HeuristicLab.Core {
///
/// Interface for a hierarchical container of variables (containing variables and subscopes).
///
public interface IScope : IItem {
///
/// Gets the name of the current instance.
///
string Name { get; }
///
/// Gets the varibles of the current scope.
///
ICollection Variables { get; }
///
/// Gets all aliases of the current scope.
///
IEnumerable> Aliases { get; }
///
/// Gets all subscopes in the current scope.
///
IList SubScopes { get; }
///
/// Sets the parent scope for the current instance.
///
/// The parent scope of the current instance.
void SetParent(IScope scope);
///
/// Gets a variable with the given .
///
/// The name of the variable.
/// The variable with the specified name.
IVariable GetVariable(string name);
///
/// Adds the specified variable to the curent instance.
///
/// The variable to add.
void AddVariable(IVariable variable);
///
/// Deletes a variable with the specified from the current instance.
///
/// The name of the variable to delete.
void RemoveVariable(string name);
///
/// The type of the value that is searched.
T GetVariableValue(string name, bool recursiveLookup) where T : class, IItem;
///
/// The type of the value that is searched.
T GetVariableValue(string name, bool recursiveLookup, bool throwOnError) where T : class, IItem;
///
/// The name of the variable.
/// Boolean value, whether the parent scopes shall be searched
/// when the variable is not found in the current instance.
/// The value of the variable or null if it was not found.
IItem GetVariableValue(string name, bool recursiveLookup);
///
/// Gets the value of the variable with the given .
///
/// The name of the variable.
/// Boolean value, whether the parent scopes shall be searched
/// when the variable is not found in the current instance.
/// Boolean value, whether an exception shall be thrown when the searched
/// variable cannot be found, or only null shall be returned.
/// The value of the searched variable or null if
/// is set to false.
IItem GetVariableValue(string name, bool recursiveLookup, bool throwOnError);
///
/// Gets the actual name of the given alias.
///
/// The alias whose actual name is searched.
/// The actual name.
string TranslateName(string name);
///
/// Adds an alias to the current instance.
///
/// The alias to add.
/// The actual name of the alias.
void AddAlias(string alias, string name);
///
/// Deletes the specified from the current instance.
///
/// The alias to delete.
void RemoveAlias(string alias);
///
/// Adds the specified sub scope to the current instance.
///
/// The sub scope to add.
void AddSubScope(IScope scope);
///
/// Deletes the specified sub scope from the current instance.
///
/// The sub scope to delete.
void RemoveSubScope(IScope scope);
///
/// Reorders all sub scopes according to the specified chronology.
///
/// The chronology how to order the sub scopes.
void ReorderSubScopes(int[] sequence);
///
/// Gets the sub scope with the given .
///
/// The name of the sub scope.
/// The sub scope with the given .
IScope GetScope(string name);
///
/// Clears the current instance.
///
void Clear();
///
/// Occurs when a variable has been added to the current instance.
///
event EventHandler> VariableAdded;
///
/// Occurs when a variable has been deleted from the current instance.
///
event EventHandler> VariableRemoved;
///
/// Occurs when an alias has been added to the current instance.
///
event EventHandler> AliasAdded;
///
/// Occurs when an alias has been removed from the current instance.
///
event EventHandler> AliasRemoved;
///
/// Occurs when a sub scope has been added to the current instance.
///
event EventHandler> SubScopeAdded;
///
/// Occurs when a sub scope has been deleted from the current instance.
///
event EventHandler> SubScopeRemoved;
///
/// Occurs when the sub scopes have been reordered.
///
event EventHandler SubScopesReordered;
}
}