Changeset 13469 for branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleDecoder.cs
- Timestamp:
- 12/15/15 15:16:24 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemRefactoring/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleDecoder.cs
r13443 r13469 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 29 30 [Item("ScheduleDecoder", "A schedule decoder translates a respresentation into an actual schedule.")] 30 31 [StorableClass] 31 public abstract class ScheduleDecoder : SingleSuccessorOperator, IScheduleDecoder { 32 public abstract class ScheduleDecoder<TSchedule> : SingleSuccessorOperator, IScheduleDecoder<TSchedule> 33 where TSchedule : class, ISchedule { 32 34 33 35 public ILookupParameter<ISchedule> ScheduleEncodingParameter { … … 43 45 [StorableConstructor] 44 46 protected ScheduleDecoder(bool deserializing) : base(deserializing) { } 45 protected ScheduleDecoder(ScheduleDecoder original, Cloner cloner) : base(original, cloner) { }47 protected ScheduleDecoder(ScheduleDecoder<TSchedule> original, Cloner cloner) : base(original, cloner) { } 46 48 public ScheduleDecoder() 47 49 : base() { … … 51 53 } 52 54 53 public abstract Schedule DecodeSchedule(ISchedule solution, ItemList<Job> jobData); 55 public Schedule DecodeSchedule(ISchedule schedule, ItemList<Job> jobData) { 56 TSchedule solution = schedule as TSchedule; 57 if (solution == null) throw new InvalidOperationException("Encoding is not of type " + typeof(TSchedule).GetPrettyName()); 58 return DecodeSchedule(solution, jobData); 59 } 60 public abstract Schedule DecodeSchedule(TSchedule schedule, ItemList<Job> jobData); 54 61 55 62 public override IOperation Apply() {
Note: See TracChangeset
for help on using the changeset viewer.