Ignore:
Timestamp:
12/04/15 10:35:04 (5 years ago)
Author:
mkommend
Message:

#2521: Intermediate version of schedule encoding refactoring.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Job.cs

    r12012 r13435  
    3131  [Item("Job", "Represents a composition of tasks that require processing in a scheduling problem.")]
    3232  [StorableClass]
    33   public class Job : Item, INotifyPropertyChanged {
     33  public sealed class Job : Item, INotifyPropertyChanged {
    3434
    3535    [Storable(Name = "DueDate")]
     
    3838      get { return dueDate; }
    3939      set {
    40         bool changed = dueDate != value;
     40        if (dueDate == value) return;
    4141        dueDate = value;
    42         if (changed) {
    43           OnPropertyChanged("DueDate");
    44           OnToStringChanged();
    45         }
     42        OnPropertyChanged("DueDate");
     43        OnToStringChanged();
    4644      }
    4745    }
     
    5250      get { return index; }
    5351      set {
    54         bool changed = index != value;
     52        if (index == value) return;
    5553        index = value;
    56         if (changed) {
    57           OnPropertyChanged("Index");
    58           OnToStringChanged();
    59         }
     54        OnPropertyChanged("Index");
     55        OnToStringChanged();
    6056      }
    6157    }
     
    6561    public ItemList<Task> Tasks {
    6662      get { return tasks; }
    67       set {
    68         bool changed = tasks != value;
     63      private set {
    6964        tasks = value;
    70         if (changed) OnPropertyChanged("Tasks");
     65        OnPropertyChanged("Tasks");
    7166      }
    7267    }
    7368
    7469    [StorableConstructor]
    75     protected Job(bool deserializing) : base(deserializing) { }
    76     protected Job(Job original, Cloner cloner)
     70    private Job(bool deserializing) : base(deserializing) { }
     71    private Job(Job original, Cloner cloner)
    7772      : base(original, cloner) {
    7873      this.dueDate = original.DueDate;
     
    151146    }
    152147
    153     internal Task GetPreviousTask(Task t) {
    154       if (t.TaskNr == 0) return null;
    155       return Tasks[t.TaskNr - 1];
    156     }
    157 
    158148    public event EventHandler TasksChanged;
    159     protected virtual void OnTasksChanged() {
     149    private void OnTasksChanged() {
    160150      var handler = TasksChanged;
    161151      if (handler != null) handler(this, EventArgs.Empty);
     
    163153
    164154    public event PropertyChangedEventHandler PropertyChanged;
    165     protected virtual void OnPropertyChanged(string propertyName) {
     155    private void OnPropertyChanged(string propertyName) {
    166156      var handler = PropertyChanged;
    167157      if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
Note: See TracChangeset for help on using the changeset viewer.