- Timestamp:
- 02/19/10 06:19:16 (14 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core/3.3/OperationCollection.cs
r2829 r2834 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 24 23 using System.Linq; 25 using System.Text;26 using System.Xml;27 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 25 29 26 namespace HeuristicLab.Core { 30 public class ExecutionContextCollection : DeepCloneable, IList<IExecutionSequence>, IExecutionSequence{27 public class OperationCollection : DeepCloneable, IList<IOperation>, IOperation { 31 28 [Storable] 32 private IList<I ExecutionSequence> contexts;29 private IList<IOperation> operations; 33 30 34 31 [Storable] … … 39 36 } 40 37 41 public ExecutionContextCollection() {42 contexts = new List<IExecutionSequence>();38 public OperationCollection() { 39 operations = new List<IOperation>(); 43 40 parallel = false; 44 41 } 45 public ExecutionContextCollection(IEnumerable<IExecutionSequence> collection) {46 contexts = new List<IExecutionSequence>(collection.Where(e => e != null));42 public OperationCollection(IEnumerable<IOperation> collection) { 43 operations = new List<IOperation>(collection.Where(e => e != null)); 47 44 parallel = false; 48 45 } 49 public ExecutionContextCollection(params IExecutionSequence[] list) {50 contexts = new List<IExecutionSequence>(list.Where(e => e != null));46 public OperationCollection(params IOperation[] list) { 47 operations = new List<IOperation>(list.Where(e => e != null)); 51 48 parallel = false; 52 49 } 53 50 54 51 public override IDeepCloneable Clone(Cloner cloner) { 55 ExecutionContextCollection clone = new ExecutionContextCollection();52 OperationCollection clone = new OperationCollection(this.Select(x => (IOperation)cloner.Clone(x))); 56 53 cloner.RegisterClonedObject(this, clone); 57 54 clone.parallel = parallel; 58 for (int i = 0; i < contexts.Count; i++)59 clone.contexts.Add((IExecutionSequence)cloner.Clone(contexts[i]));60 55 return clone; 61 56 } 62 57 63 #region IList<I ExecutionContext> Members64 public int IndexOf(I ExecutionSequenceitem) {65 return contexts.IndexOf(item);58 #region IList<IOperation> Members 59 public int IndexOf(IOperation item) { 60 return operations.IndexOf(item); 66 61 } 67 public void Insert(int index, I ExecutionSequenceitem) {68 if (item != null) contexts.Insert(index, item);62 public void Insert(int index, IOperation item) { 63 if (item != null) operations.Insert(index, item); 69 64 } 70 65 public void RemoveAt(int index) { 71 contexts.RemoveAt(index);66 operations.RemoveAt(index); 72 67 } 73 public I ExecutionSequencethis[int index] {74 get { return contexts[index]; }75 set { if (value != null) contexts[index] = value; }68 public IOperation this[int index] { 69 get { return operations[index]; } 70 set { if (value != null) operations[index] = value; } 76 71 } 77 72 #endregion 78 73 79 #region ICollection<I ExecutionContext> Members80 public void Add(I ExecutionSequenceitem) {81 if (item != null) contexts.Add(item);74 #region ICollection<IOperation> Members 75 public void Add(IOperation item) { 76 if (item != null) operations.Add(item); 82 77 } 83 78 public void Clear() { 84 contexts.Clear();79 operations.Clear(); 85 80 } 86 public bool Contains(I ExecutionSequenceitem) {87 return contexts.Contains(item);81 public bool Contains(IOperation item) { 82 return operations.Contains(item); 88 83 } 89 public void CopyTo(I ExecutionSequence[] array, int arrayIndex) {90 contexts.CopyTo(array, arrayIndex);84 public void CopyTo(IOperation[] array, int arrayIndex) { 85 operations.CopyTo(array, arrayIndex); 91 86 } 92 87 public int Count { 93 get { return contexts.Count; }88 get { return operations.Count; } 94 89 } 95 90 public bool IsReadOnly { 96 get { return contexts.IsReadOnly; }91 get { return operations.IsReadOnly; } 97 92 } 98 public bool Remove(I ExecutionSequenceitem) {99 return contexts.Remove(item);93 public bool Remove(IOperation item) { 94 return operations.Remove(item); 100 95 } 101 96 #endregion 102 97 103 #region IEnumerable<I ExecutionContext> Members104 public IEnumerator<I ExecutionSequence> GetEnumerator() {105 return contexts.GetEnumerator();98 #region IEnumerable<IOperation> Members 99 public IEnumerator<IOperation> GetEnumerator() { 100 return operations.GetEnumerator(); 106 101 } 107 102 #endregion … … 109 104 #region IEnumerable Members 110 105 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { 111 return contexts.GetEnumerator();106 return operations.GetEnumerator(); 112 107 } 113 108 #endregion
Note: See TracChangeset
for help on using the changeset viewer.