Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/04/10 18:00:50 (14 years ago)
Author:
mkommend
Message:

Persisted the color of a run (ticket #1125)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization/3.3/Run.cs

    r4102 r4156  
    5050    }
    5151
    52     private Color color = Color.Black;
     52    [Storable]
     53    private Color color;
    5354    public Color Color {
    5455      get { return this.color; }
     
    7778    }
    7879
     80    [StorableConstructor]
     81    private Run(bool deserializing) : base(deserializing) { }
    7982    public Run()
    8083      : base() {
    8184      name = ItemName;
    8285      description = ItemDescription;
     86      color = Color.Black;
    8387      algorithm = null;
    8488      parameters = new Dictionary<string, IItem>();
     
    9094      name = algorithm.Name + " Run (" + algorithm.ExecutionTime.ToString() + ")";
    9195      description = ItemDescription;
     96      color = Color.Black;
    9297      Initialize(algorithm);
    9398    }
     
    95100      : base(name) {
    96101      if (algorithm == null) throw new ArgumentNullException();
     102      color = Color.Black;
    97103      description = ItemDescription;
    98104      Initialize(algorithm);
     
    101107      : base(name, description) {
    102108      if (algorithm == null) throw new ArgumentNullException();
     109      color = Color.Black;
    103110      Initialize(algorithm);
    104111    }
     
    116123    }
    117124
     125    [StorableHook(HookType.AfterDeserialization)]
     126    private void AfterDeserializationHook() {
     127      if (color == Color.Empty) color = Color.Black;
     128    }
     129
    118130    public override IDeepCloneable Clone(Cloner cloner) {
    119131      Run clone = (Run)base.Clone(cloner);
Note: See TracChangeset for help on using the changeset viewer.