Changeset 8886 for trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Job.cs
- Timestamp:
- 11/11/12 01:46:34 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Job.cs
r8603 r8886 20 20 #endregion 21 21 22 using System.ComponentModel; 22 23 using System.Text; 23 24 using HeuristicLab.Common; … … 28 29 [Item("Job", "Represents a composition of tasks that require processing in a scheduling problem.")] 29 30 [StorableClass] 30 public class Job : Item { 31 [Storable] 32 public double DueDate { get; set; } 33 [Storable] 34 public int Index { get; set; } 35 [Storable] 36 public ItemList<Task> Tasks { get; set; } 31 public class Job : Item, INotifyPropertyChanged { 32 [Storable(Name = "DueDate")] private double dueDate; 33 public double DueDate { 34 get { return dueDate; } 35 set { 36 bool changed = dueDate != value; 37 dueDate = value; 38 if (changed) OnPropertyChanged("DueDate"); 39 } 40 } 41 42 [Storable(Name = "Index")] 43 private int index; 44 public int Index { 45 get { return index; } 46 set { 47 bool changed = index != value; 48 index = value; 49 if (changed) OnPropertyChanged("Index"); 50 } 51 } 52 53 [Storable(Name = "Tasks")] 54 private ItemList<Task> tasks; 55 public ItemList<Task> Tasks { 56 get { return tasks; } 57 set { 58 bool changed = tasks != value; 59 tasks = value; 60 if (changed) OnPropertyChanged("Tasks"); 61 } 62 } 37 63 38 64 [StorableConstructor] … … 49 75 public Job(int index, double dueDate) 50 76 : base() { 77 DueDate = dueDate; 51 78 Index = index; 52 79 Tasks = new ItemList<Task>(); 53 54 DueDate = dueDate;55 56 80 } 57 81 58 82 public override string ToString() { 59 StringBuilder sb = new StringBuilder();83 var sb = new StringBuilder(); 60 84 sb.Append("Job#" + Index + " [ "); 61 85 foreach (Task t in Tasks) { … … 68 92 69 93 internal Task GetPreviousTask(Task t) { 70 if (t.TaskNr == 0) 71 return null; 72 else 73 return Tasks[t.TaskNr - 1]; 94 if (t.TaskNr == 0) return null; 95 return Tasks[t.TaskNr - 1]; 74 96 } 75 97 76 98 public event PropertyChangedEventHandler PropertyChanged; 99 protected virtual void OnPropertyChanged(string propertyName) { 100 var handler = PropertyChanged; 101 if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); 102 } 77 103 } 78 104 }
Note: See TracChangeset
for help on using the changeset viewer.