Changeset 2757 for trunk/sources/HeuristicLab.Core
- Timestamp:
- 02/08/10 03:43:36 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Core/3.3
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core/3.3/Engine.cs
r2687 r2757 93 93 /// </summary> 94 94 [Storable] 95 private Stack< ExecutionContext> executionStack;95 private Stack<IExecutionContext> executionStack; 96 96 /// <summary> 97 97 /// Gets the current execution stack. 98 98 /// </summary> 99 protected Stack< ExecutionContext> ExecutionStack {99 protected Stack<IExecutionContext> ExecutionStack { 100 100 get { return executionStack; } 101 101 } … … 135 135 protected Engine() { 136 136 globalScope = new Scope("Global"); 137 executionStack = new Stack< ExecutionContext>();137 executionStack = new Stack<IExecutionContext>(); 138 138 OperatorGraph = new OperatorGraph(); 139 139 } … … 151 151 clone.globalScope = (Scope)cloner.Clone(globalScope); 152 152 clone.executionTime = executionTime; 153 ExecutionContext[] contexts = executionStack.ToArray();153 IExecutionContext[] contexts = executionStack.ToArray(); 154 154 for (int i = contexts.Length - 1; i >= 0; i--) 155 clone.executionStack.Push(( ExecutionContext)cloner.Clone(contexts[i]));155 clone.executionStack.Push((IExecutionContext)cloner.Clone(contexts[i])); 156 156 clone.running = running; 157 157 clone.canceled = canceled; -
trunk/sources/HeuristicLab.Core/3.3/ExecutionContext.cs
r2687 r2757 26 26 27 27 namespace HeuristicLab.Core { 28 public class ExecutionContext : DeepCloneable {28 public class ExecutionContext : DeepCloneable, IExecutionContext { 29 29 [Storable] 30 30 private ExecutionContext parent; -
trunk/sources/HeuristicLab.Core/3.3/ExecutionContextCollection.cs
r2664 r2757 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq; 24 25 using System.Text; 25 26 using System.Xml; … … 27 28 28 29 namespace HeuristicLab.Core { 29 public class ExecutionContextCollection : DeepCloneable, IList< ExecutionContext>{30 public class ExecutionContextCollection : DeepCloneable, IList<IExecutionContext>, IExecutionContext { 30 31 [Storable] 31 private IList< ExecutionContext> contexts;32 private IList<IExecutionContext> contexts; 32 33 33 34 [Storable] … … 39 40 40 41 public ExecutionContextCollection() { 41 contexts = new List< ExecutionContext>();42 contexts = new List<IExecutionContext>(); 42 43 parallel = false; 43 44 } 44 public ExecutionContextCollection(IEnumerable< ExecutionContext> collection) {45 contexts = new List< ExecutionContext>(collection);45 public ExecutionContextCollection(IEnumerable<IExecutionContext> collection) { 46 contexts = new List<IExecutionContext>(collection.Where(e => e != null)); 46 47 parallel = false; 47 48 } 48 public ExecutionContextCollection(params ExecutionContext[] list) {49 contexts = new List< ExecutionContext>(list);49 public ExecutionContextCollection(params IExecutionContext[] list) { 50 contexts = new List<IExecutionContext>(list.Where(e => e != null)); 50 51 parallel = false; 51 52 } … … 56 57 clone.parallel = parallel; 57 58 for (int i = 0; i < contexts.Count; i++) 58 clone.contexts.Add(( ExecutionContext)cloner.Clone(contexts[i]));59 clone.contexts.Add((IExecutionContext)cloner.Clone(contexts[i])); 59 60 return clone; 60 61 } 61 62 62 #region IList< ExecutionContext> Members63 public int IndexOf( ExecutionContext item) {63 #region IList<IExecutionContext> Members 64 public int IndexOf(IExecutionContext item) { 64 65 return contexts.IndexOf(item); 65 66 } 66 public void Insert(int index, ExecutionContext item) {67 contexts.Insert(index, item);67 public void Insert(int index, IExecutionContext item) { 68 if (item != null) contexts.Insert(index, item); 68 69 } 69 70 public void RemoveAt(int index) { 70 71 contexts.RemoveAt(index); 71 72 } 72 public ExecutionContext this[int index] {73 public IExecutionContext this[int index] { 73 74 get { return contexts[index]; } 74 set { contexts[index] = value; }75 set { if (value != null) contexts[index] = value; } 75 76 } 76 77 #endregion 77 78 78 #region ICollection< ExecutionContext> Members79 public void Add( ExecutionContext item) {80 contexts.Add(item);79 #region ICollection<IExecutionContext> Members 80 public void Add(IExecutionContext item) { 81 if (item != null) contexts.Add(item); 81 82 } 82 83 public void Clear() { 83 84 contexts.Clear(); 84 85 } 85 public bool Contains( ExecutionContext item) {86 public bool Contains(IExecutionContext item) { 86 87 return contexts.Contains(item); 87 88 } 88 public void CopyTo( ExecutionContext[] array, int arrayIndex) {89 public void CopyTo(IExecutionContext[] array, int arrayIndex) { 89 90 contexts.CopyTo(array, arrayIndex); 90 91 } … … 95 96 get { return contexts.IsReadOnly; } 96 97 } 97 public bool Remove( ExecutionContext item) {98 public bool Remove(IExecutionContext item) { 98 99 return contexts.Remove(item); 99 100 } 100 101 #endregion 101 102 102 #region IEnumerable< ExecutionContext> Members103 public IEnumerator< ExecutionContext> GetEnumerator() {103 #region IEnumerable<IExecutionContext> Members 104 public IEnumerator<IExecutionContext> GetEnumerator() { 104 105 return contexts.GetEnumerator(); 105 106 } -
trunk/sources/HeuristicLab.Core/3.3/HeuristicLab.Core-3.3.csproj
r2756 r2757 104 104 <Compile Include="ChangedEventArgs.cs" /> 105 105 <None Include="HeuristicLabCorePlugin.cs.frame" /> 106 <Compile Include="Interfaces\IExecutionContext.cs" /> 106 107 <Compile Include="Interfaces\IValueLookupParameter.cs" /> 107 108 <Compile Include="Interfaces\IValueParameter.cs" /> -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IOperator.cs
r2653 r2757 44 44 /// <param name="scope">The scope where to execute the current instance.</param> 45 45 /// <returns>The next operation.</returns> 46 ExecutionContextCollectionExecute(ExecutionContext context);46 IExecutionContext Execute(ExecutionContext context); 47 47 /// <summary> 48 48 /// Aborts the current operator. -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IParameter.cs
r2740 r2757 29 29 public interface IParameter : INamedItem { 30 30 Type DataType { get; } 31 IItem ActualValue { get; set; } 31 32 ExecutionContext ExecutionContext { get; set; } 32 33 } -
trunk/sources/HeuristicLab.Core/3.3/ItemArray.cs
r2746 r2757 29 29 using HeuristicLab.Common.Resources; 30 30 using HeuristicLab.Collections; 31 32 31 33 32 namespace HeuristicLab.Core {
Note: See TracChangeset
for help on using the changeset viewer.