#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 HeuristicLab.Common;
namespace HeuristicLab.Core {
///
/// Interface to represent an operator (e.g. GreaterThanComparator,...),
/// a basic instruction of an algorithm.
///
public interface IOperator : IItem {
///
/// Gets or sets the name of the current instance.
///
string Name { get; set; }
///
/// Gets or sets the description of the current instance.
///
string Description { get; }
///
/// Gets information whether the current operator has been canceled.
///
bool Canceled { get; }
///
/// Gets or sets a boolean value whether the engine should stop here during the run.
///
bool Breakpoint { get; set; }
///
/// Gets a list of all sub operators.
///
IList SubOperators { get; }
///
/// Gets a collection of all variable (parameter) infos.
///
ICollection VariableInfos { get; }
///
/// Gets a collection of all variables of the current operator.
///
ICollection Variables { get; }
///
/// Adds the given sub operator to the current instance.
///
/// The operator to add.
void AddSubOperator(IOperator op);
///
/// Adds the given sub operator at a the specified .
///
/// The operator to add.
/// The position where to add the operator.
void AddSubOperator(IOperator op, int index);
///
/// Removes a sub operator at the specified .
///
/// The position where to delete the operator.
void RemoveSubOperator(int index);
///
/// Gets the variable info with the given .
///
/// The formal name of the variable info.
/// The variable info with the specified formal name.
IVariableInfo GetVariableInfo(string formalName);
///
/// Adds the specified variable info to the current instance.
///
/// The variable info to add.
void AddVariableInfo(IVariableInfo variableInfo);
///
/// Removes the variable info with the given formal name.
///
/// The formal name of the variable info to remove.
void RemoveVariableInfo(string formalName);
///
/// Gets a variable with the given .
///
/// The name of the variable.
/// The variable with the specified name.
IVariable GetVariable(string name);
///
/// Adds the specified to the current instance.
///
/// The variable to add.
void AddVariable(IVariable variable);
///
/// Deletes the variable with the specified .
///
/// The name of the variable to delete.
void RemoveVariable(string name);
///
/// The type of the value that is searched.
T GetVariableValue(string formalName, IScope scope, bool recursiveLookup) where T : class, IItem;
///
/// The type of the value that is searched.
T GetVariableValue(string formalName, IScope scope, bool recursiveLookup, bool throwOnError) where T : class, IItem;
///
/// The formal name of the variable info whose variable value is searched.
/// The scope where to look for the variable.
/// Boolean value, whether also the parent scopes shall be searched if
/// the variable is not found in the specified .
/// The value of the searched variable or null if it is not found.
IItem GetVariableValue(string formalName, IScope scope, bool recursiveLookup);
///
/// Gets the value of the variable in the specified
/// whose variable(parameter) info has the specified .
///
/// The formal name of the variable info whose variable value is searched.
/// The scope where to look for the variable.
/// Boolean value, whether also the parent scopes shall be searched if
/// the variable is not found in the specified .
/// Boolean value, whether an exception shall be thrown, if the variable
/// cannot be found or just null shall be returned.
/// The value of the searched variable (or null if the variable is not
/// found and is set to false).
IItem GetVariableValue(string formalName, IScope scope, bool recursiveLookup, bool throwOnError);
///
/// Executes the current instance on the specified .
///
/// The scope where to execute the current instance.
/// The next operation.
IOperation Execute(IScope scope);
///
/// Aborts the current operator.
///
void Abort();
///
/// Occurs when the name of the operator was changed.
///
event EventHandler NameChanged;
///
/// Occurs when the breakpoint flag of the current instance was changed.
///
event EventHandler BreakpointChanged;
///
/// Occurs when a sub operator has been added.
///
event EventHandler> SubOperatorAdded;
///
/// Occurs when a sub operator has been deleted.
///
event EventHandler> SubOperatorRemoved;
///
/// Occurs when a variable info has been added.
///
event EventHandler> VariableInfoAdded;
///
/// Occurs when a variable info has been deleted.
///
event EventHandler> VariableInfoRemoved;
///
/// Occurs when a variable has been added.
///
event EventHandler> VariableAdded;
///
/// Occurs when a variable has been deleted.
///
event EventHandler> VariableRemoved;
///
/// Occurs when the current instance is executed.
///
event EventHandler Executed;
}
}