Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/07/10 05:22:33 (14 years ago)
Author:
swagner
Message:

Continued work on algorithm batch processing (#947).

Location:
trunk/sources/HeuristicLab.Core/3.3
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/3.3/DeepCloneable.cs

    r3017 r3280  
    2929  [StorableClass]
    3030  public abstract class DeepCloneable : IDeepCloneable {
     31    protected DeepCloneable() { }
     32    [StorableConstructor]
     33    protected DeepCloneable(bool deserializing) { }
     34
    3135    /// <summary>
    3236    /// Creates a deep clone of this instance.
  • trunk/sources/HeuristicLab.Core/3.3/Engine.cs

    r3265 r3280  
    4949
    5050    public override IDeepCloneable Clone(Cloner cloner) {
     51      if (ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState));
    5152      Engine clone = (Engine)base.Clone(cloner);
    5253      IOperation[] contexts = executionStack.ToArray();
  • trunk/sources/HeuristicLab.Core/3.3/Item.cs

    r3017 r3280  
    4242    }
    4343
     44    protected Item() : base() { }
     45    [StorableConstructor]
     46    protected Item(bool deserializing) : base(deserializing) { }
     47
     48
    4449    /// <summary>
    4550    /// Gets the string representation of the current instance.
  • trunk/sources/HeuristicLab.Core/3.3/NamedItem.cs

    r3017 r3280  
    9191      else this.description = description;
    9292    }
     93    [StorableConstructor]
     94    protected NamedItem(bool deserializing) : base(deserializing) { }
    9395
    9496    /// <summary>
  • trunk/sources/HeuristicLab.Core/3.3/ParameterizedNamedItem.cs

    r3260 r3280  
    3232  [StorableClass]
    3333  public abstract class ParameterizedNamedItem : NamedItem, IParameterizedNamedItem {
     34    [Storable]
    3435    private ParameterCollection parameters;
    35     [Storable]
    3636    protected ParameterCollection Parameters {
    3737      get { return parameters; }
    38       private set {
    39         parameters = value;
    40         readOnlyParameters = null;
    41       }
    4238    }
    4339    private ReadOnlyObservableKeyedCollection<string, IParameter> readOnlyParameters;
     
    5349      name = ItemName;
    5450      description = ItemDescription;
    55       Parameters = new ParameterCollection();
     51      parameters = new ParameterCollection();
    5652      readOnlyParameters = null;
    5753    }
     
    5955      : base(name) {
    6056      description = ItemDescription;
    61       Parameters = new ParameterCollection();
     57      parameters = new ParameterCollection();
    6258      readOnlyParameters = null;
    6359    }
     
    6561      : base(name) {
    6662      description = ItemDescription;
    67       Parameters = parameters;
     63      this.parameters = parameters;
    6864      readOnlyParameters = null;
    6965    }
    7066    protected ParameterizedNamedItem(string name, string description)
    7167      : base(name, description) {
    72       Parameters = new ParameterCollection();
     68      parameters = new ParameterCollection();
    7369      readOnlyParameters = null;
    7470    }
    7571    protected ParameterizedNamedItem(string name, string description, ParameterCollection parameters)
    7672      : base(name, description) {
    77       Parameters = parameters;
     73      this.parameters = parameters;
    7874      readOnlyParameters = null;
    7975    }
     76    [StorableConstructor]
     77    protected ParameterizedNamedItem(bool deserializing) : base(deserializing) { }
    8078
    8179    public override IDeepCloneable Clone(Cloner cloner) {
    8280      ParameterizedNamedItem clone = (ParameterizedNamedItem)base.Clone(cloner);
    83       clone.Parameters = (ParameterCollection)cloner.Clone(parameters);
     81      clone.parameters = (ParameterCollection)cloner.Clone(parameters);
     82      clone.readOnlyParameters = null;
    8483      return clone;
    8584    }
     
    8786    public virtual void CollectParameterValues(IDictionary<string, IItem> values) {
    8887      foreach (IValueParameter param in parameters.OfType<IValueParameter>()) {
    89         values.Add(param.Name, param.Value != null ? (IItem)param.Value.Clone() : null);
     88        values.Add(param.Name, param.Value);
    9089        if (param.Value is IParameterizedItem) {
    9190          Dictionary<string, IItem> children = new Dictionary<string, IItem>();
  • trunk/sources/HeuristicLab.Core/3.3/Scope.cs

    r3160 r3280  
    3535      get { return parent; }
    3636      set {
    37         if (parent != null) parent.SubScopes.Remove(this);
    38         parent = value;
    39         if ((parent != null) && !parent.SubScopes.Contains(this)) parent.SubScopes.Add(this);
     37        if (parent != value) {
     38          IScope oldParent = parent;
     39          parent = null;
     40          if (oldParent != null) oldParent.SubScopes.Remove(this);
     41          parent = value;
     42          if ((parent != null) && !parent.SubScopes.Contains(this)) parent.SubScopes.Add(this);
     43        }
    4044      }
    4145    }
     
    97101      clone.Description = Description;
    98102      if (variables.Count > 0) clone.variables = (VariableCollection)cloner.Clone(variables);
    99       if (subScopes.Count > 0) clone.SubScopes = (ScopeList)cloner.Clone(subScopes);
     103      if (subScopes.Count > 0) {
     104        clone.SubScopes = (ScopeList)cloner.Clone(subScopes);
     105        foreach (IScope child in clone.SubScopes)
     106          child.Parent = clone;
     107      }
    100108      return clone;
    101109    }
Note: See TracChangeset for help on using the changeset viewer.