Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/04/11 17:23:40 (13 years ago)
Author:
svonolfe
Message:

Worked on VNS main loop (#1425)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/VNS/HeuristicLab.Operators/3.3/ScopeCleaner.cs

    r5445 r5609  
    2424using HeuristicLab.Parameters;
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     26using HeuristicLab.Data;
    2627
    2728namespace HeuristicLab.Operators {
     
    3839      get { return CurrentScopeParameter.ActualValue; }
    3940    }
     41    public ValueParameter<BoolValue> ClearSubScopesParameter {
     42      get { return (ValueParameter<BoolValue>)Parameters["ClearSubScopes"]; }
     43    }
     44
     45    [StorableHook(HookType.AfterDeserialization)]
     46    private void AfterDeserializationHook() {
     47      #region Backwards Compatibility
     48      if (!Parameters.ContainsKey("ClearSubScopes")) {
     49        Parameters.Add(new ValueParameter<BoolValue>("ClearSubScopes", "Indicates, if the subscopes should be cleared.", new BoolValue(false)));
     50      }
     51      #endregion
     52    }
    4053
    4154    [StorableConstructor]
     
    4760      : base() {
    4861      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope whose variables and sub-scopes should be removed."));
     62      Parameters.Add(new ValueParameter<BoolValue>("ClearSubScopes", "Indicates, if the subscopes should be cleared.", new BoolValue(false)));
    4963    }
    5064
     
    5569    public override IOperation Apply() {
    5670      CurrentScope.Variables.Clear();
    57       CurrentScope.SubScopes.Clear();
     71      if(ClearSubScopesParameter.Value.Value)
     72        CurrentScope.SubScopes.Clear();
    5873      return base.Apply();
    5974    }
Note: See TracChangeset for help on using the changeset viewer.