Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/13/10 06:41:56 (15 years ago)
Author:
swagner
Message:

Implemented ReadOnlyView property for items (#969).

Location:
trunk/sources/HeuristicLab.Operators/3.3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Operators/3.3/MultipleCallsOperator.cs

    r3212 r3317  
    3737    private List<IValueParameter<IOperator>> operatorParameters;
    3838
     39    [Storable]
    3940    private OperatorList operators;
    40     [Storable]
    4141    public OperatorList Operators {
    4242      get { return operators; }
    43       private set {
    44         if (operators != null) DeregisterOperatorsEvents();
    45         operators = value;
    46         if (operators != null) RegisterOperatorsEvents();
    47       }
    4843    }
    4944
    5045    public MultipleCallsOperator()
    5146      : base() {
    52       Operators = new OperatorList();
     47      operators = new OperatorList();
    5348      Initialize();
    5449    }
     50    [StorableConstructor]
     51    protected MultipleCallsOperator(bool deserializing) : base(deserializing) { }
    5552
    5653    [StorableHook(HookType.AfterDeserialization)]
    5754    private void Initialize() {
     55      if (operators != null) RegisterOperatorsEvents();
    5856      operatorParameters = new List<IValueParameter<IOperator>>();
    5957      for (int i = 0; i < Operators.Count; i++) {
     
    6664    public override IDeepCloneable Clone(Cloner cloner) {
    6765      MultipleCallsOperator clone = (MultipleCallsOperator)base.Clone(cloner);
    68       clone.Operators = (OperatorList)cloner.Clone(operators);
     66      clone.operators = (OperatorList)cloner.Clone(operators);
    6967      clone.Initialize();
    7068      return clone;
  • trunk/sources/HeuristicLab.Operators/3.3/Operator.cs

    r3306 r3317  
    113113      breakpoint = false;
    114114    }
     115    [StorableConstructor]
     116    protected Operator(bool deserializing) : base(deserializing) { }
    115117
    116118    /// <summary>
  • trunk/sources/HeuristicLab.Operators/3.3/SingleSuccessorOperator.cs

    r3160 r3317  
    4343      Parameters.Add(new OperatorParameter("Successor", "Operator which is executed next."));
    4444    }
     45    [StorableConstructor]
     46    protected SingleSuccessorOperator(bool deserializing) : base(deserializing) { }
    4547
    4648    public override IOperation Apply() {
  • trunk/sources/HeuristicLab.Operators/3.3/ValuesCollector.cs

    r3160 r3317  
    3131  [StorableClass]
    3232  public abstract class ValuesCollector : SingleSuccessorOperator, IOperator {
     33    [Storable]
    3334    private ParameterCollection collectedValues;
    34     [Storable]
    3535    public ParameterCollection CollectedValues {
    3636      get { return collectedValues; }
    37       private set {
    38         collectedValues = value;
    39         collectedValues.ItemsAdded += new CollectionItemsChangedEventHandler<IParameter>(collectedValues_ItemsAdded);
    40         collectedValues.ItemsRemoved += new CollectionItemsChangedEventHandler<IParameter>(collectedValues_ItemsRemoved);
    41         collectedValues.CollectionReset += new CollectionItemsChangedEventHandler<IParameter>(collectedValues_CollectionReset);
    42       }
    4337    }
    4438
    4539    public ValuesCollector()
    4640      : base() {
    47       CollectedValues = new ParameterCollection();
     41      collectedValues = new ParameterCollection();
     42      Initialize();
     43    }
     44    [StorableConstructor]
     45    protected ValuesCollector(bool deserializing) : base(deserializing) { }
     46
     47    [StorableHook(HookType.AfterDeserialization)]
     48    private void Initialize() {
     49      collectedValues.ItemsAdded += new CollectionItemsChangedEventHandler<IParameter>(collectedValues_ItemsAdded);
     50      collectedValues.ItemsRemoved += new CollectionItemsChangedEventHandler<IParameter>(collectedValues_ItemsRemoved);
     51      collectedValues.CollectionReset += new CollectionItemsChangedEventHandler<IParameter>(collectedValues_CollectionReset);
    4852    }
    4953
    5054    public override IDeepCloneable Clone(Cloner cloner) {
    5155      ValuesCollector clone = (ValuesCollector)base.Clone(cloner);
    52       clone.CollectedValues = (ParameterCollection)cloner.Clone(collectedValues);
     56      clone.collectedValues = (ParameterCollection)cloner.Clone(collectedValues);
     57      clone.Initialize();
    5358      return clone;
    5459    }
Note: See TracChangeset for help on using the changeset viewer.