Last change
on this file since 4995 was
4993,
checked in by epitzer, 14 years ago
|
Create own class for OperatorTrace, remove unnecessary event handlers, prevent flickering while stepping, permanently highlight execution context's scope (#47)
|
File size:
1.5 KB
|
Rev | Line | |
---|
[4993] | 1 | using System.Collections.Generic;
|
---|
[4871] | 2 | using System.Linq;
|
---|
| 3 | using HeuristicLab.Collections;
|
---|
| 4 | using HeuristicLab.Common;
|
---|
| 5 | using HeuristicLab.Core;
|
---|
| 6 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 7 |
|
---|
| 8 | namespace HeuristicLab.DebugEngine {
|
---|
| 9 |
|
---|
[4993] | 10 | [StorableClass]
|
---|
| 11 | public class OperatorTrace : ObservableList<IOperator>, IContent, IDeepCloneable {
|
---|
[4871] | 12 |
|
---|
[4993] | 13 | public OperatorTrace()
|
---|
| 14 | : base() {
|
---|
| 15 | }
|
---|
| 16 | public OperatorTrace(int capacity)
|
---|
| 17 | : base(capacity) {
|
---|
| 18 | }
|
---|
| 19 | public OperatorTrace(IEnumerable<IOperator> collection)
|
---|
| 20 | : base(collection) {
|
---|
| 21 | }
|
---|
[4871] | 22 |
|
---|
| 23 | [StorableConstructor]
|
---|
[4993] | 24 | protected OperatorTrace(bool deserializing) : base(deserializing) { }
|
---|
| 25 | protected OperatorTrace(OperatorTrace original, Cloner cloner) {
|
---|
[4871] | 26 | cloner.RegisterClonedObject(original, this);
|
---|
| 27 | AddRange(original.Select(op => cloner.Clone(op)));
|
---|
| 28 | }
|
---|
| 29 | public object Clone() {
|
---|
| 30 | return Clone(new Cloner());
|
---|
| 31 | }
|
---|
| 32 | public virtual IDeepCloneable Clone(Cloner cloner) {
|
---|
[4993] | 33 | return new OperatorTrace(this, cloner);
|
---|
[4871] | 34 | }
|
---|
[4993] | 35 | public virtual void ReplaceAll(IEnumerable<IOperator> operators) {
|
---|
| 36 | var oldList = list;
|
---|
| 37 | list = new List<IOperator>(operators);
|
---|
| 38 | if (oldList.Count != list.Count)
|
---|
| 39 | OnPropertyChanged("Count");
|
---|
| 40 | OnPropertyChanged("Item[]");
|
---|
| 41 | OnCollectionReset(
|
---|
| 42 | list.Select((op, i) => new IndexedItem<IOperator>(i, op)),
|
---|
| 43 | oldList.Select((op, i) => new IndexedItem<IOperator>(i, op)));
|
---|
| 44 | }
|
---|
| 45 |
|
---|
[4871] | 46 | }
|
---|
| 47 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.