[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;
|
---|
[1815] | 25 | using System.Threading;
|
---|
[2] | 26 |
|
---|
| 27 | namespace HeuristicLab.Core {
|
---|
[776] | 28 | /// <summary>
|
---|
| 29 | /// Interface to represent one run. (An engine is an interpreter, holding the code,
|
---|
| 30 | /// the data and the actual state, which is the runtime stack and a pointer onto the next operation.).
|
---|
| 31 | /// It is responsible for operator execution and able to deal with parallelism.
|
---|
| 32 | /// </summary>
|
---|
[2] | 33 | public interface IEngine : IItem {
|
---|
[776] | 34 | /// <summary>
|
---|
| 35 | /// Gets the operator graph of the current instance.
|
---|
| 36 | /// </summary>
|
---|
[2] | 37 | IOperatorGraph OperatorGraph { get; }
|
---|
[776] | 38 | /// <summary>
|
---|
| 39 | /// Gets the global scope of the current instance.
|
---|
| 40 | /// </summary>
|
---|
[2] | 41 | IScope GlobalScope { get; }
|
---|
| 42 |
|
---|
[776] | 43 | /// <summary>
|
---|
| 44 | /// Gets the execution time of the current instance.
|
---|
| 45 | /// </summary>
|
---|
[2] | 46 | TimeSpan ExecutionTime { get; }
|
---|
[1815] | 47 | /// <summary>
|
---|
| 48 | /// Gets or sets the thread priority of the worker thread.
|
---|
| 49 | /// </summary>
|
---|
| 50 | ThreadPriority Priority { get; set; }
|
---|
[2] | 51 |
|
---|
[776] | 52 | /// <summary>
|
---|
| 53 | /// Gets information whether the engine is currently running.
|
---|
| 54 | /// </summary>
|
---|
[2] | 55 | bool Running { get; }
|
---|
[776] | 56 | /// <summary>
|
---|
| 57 | /// Gets information whether the engine is canceled.
|
---|
| 58 | /// </summary>
|
---|
[2] | 59 | bool Canceled { get; }
|
---|
[776] | 60 | /// <summary>
|
---|
| 61 | /// Gets information whether the engine has already terminated.
|
---|
| 62 | /// </summary>
|
---|
[2] | 63 | bool Terminated { get; }
|
---|
| 64 |
|
---|
[776] | 65 | /// <summary>
|
---|
| 66 | /// Executes the whole run.
|
---|
| 67 | /// </summary>
|
---|
[2] | 68 | void Execute();
|
---|
[776] | 69 | /// <summary>
|
---|
| 70 | /// Executes one step (one operation).
|
---|
| 71 | /// </summary>
|
---|
[2] | 72 | void ExecuteStep();
|
---|
[776] | 73 | /// <summary>
|
---|
| 74 | /// Executes the given number of steps.
|
---|
| 75 | /// </summary>
|
---|
| 76 | /// <param name="steps">The number of steps to execute.</param>
|
---|
[2] | 77 | void ExecuteSteps(int steps);
|
---|
[776] | 78 | /// <summary>
|
---|
| 79 | /// Aborts the engine run.
|
---|
| 80 | /// </summary>
|
---|
[2] | 81 | void Abort();
|
---|
[776] | 82 | /// <summary>
|
---|
| 83 | /// Resets the current instance.
|
---|
| 84 | /// </summary>
|
---|
[2] | 85 | void Reset();
|
---|
| 86 |
|
---|
[776] | 87 | /// <summary>
|
---|
| 88 | /// Occurs when the current instance is initialized.
|
---|
| 89 | /// </summary>
|
---|
[2] | 90 | event EventHandler Initialized;
|
---|
[776] | 91 | /// <summary>
|
---|
| 92 | /// Occurs when an operation is executed.
|
---|
| 93 | /// </summary>
|
---|
[2] | 94 | event EventHandler<OperationEventArgs> OperationExecuted;
|
---|
[776] | 95 | /// <summary>
|
---|
| 96 | /// Occurs when an exception was thrown.
|
---|
| 97 | /// </summary>
|
---|
[2] | 98 | event EventHandler<ExceptionEventArgs> ExceptionOccurred;
|
---|
[776] | 99 | /// <summary>
|
---|
| 100 | /// Occurs when the execution time was changed.
|
---|
| 101 | /// </summary>
|
---|
[2] | 102 | event EventHandler ExecutionTimeChanged;
|
---|
[776] | 103 | /// <summary>
|
---|
| 104 | /// Occurs when the engine is finished.
|
---|
| 105 | /// </summary>
|
---|
[2] | 106 | event EventHandler Finished;
|
---|
| 107 | }
|
---|
| 108 | }
|
---|