- Timestamp:
- 07/02/14 15:08:32 (10 years ago)
- Location:
- stable
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 10213,10433,10476,10494
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Encodings.ScheduleEncoding/3.3/JobSequenceMatrix/JSMEncoding.cs
r9456 r11073 20 20 #endregion 21 21 22 using System; 22 23 using System.Text; 23 24 using HeuristicLab.Common; … … 53 54 54 55 foreach (Permutation p in JobSequenceMatrix) { 55 sb.Append (p.ToString() + " \n");56 sb.AppendLine(p.ToString()); 56 57 } 57 58 … … 59 60 return sb.ToString(); 60 61 } 61 62 63 public override bool Equals(object obj) {64 if (obj.GetType() == typeof(JSMEncoding))65 return AreEqual(this, obj as JSMEncoding);66 67 return false;68 }69 public override int GetHashCode() {70 if (JobSequenceMatrix.Count == 1)71 return JobSequenceMatrix[0].GetHashCode();72 if (JobSequenceMatrix.Count == 2)73 return JobSequenceMatrix[0].GetHashCode() ^ JobSequenceMatrix[1].GetHashCode();74 return 0;75 }76 private static bool AreEqual(JSMEncoding jSMEncoding1, JSMEncoding jSMEncoding2) {77 if (jSMEncoding1.JobSequenceMatrix.Count != jSMEncoding2.JobSequenceMatrix.Count)78 return false;79 for (int i = 0; i < jSMEncoding1.JobSequenceMatrix.Count; i++) {80 if (!AreEqual(jSMEncoding1.JobSequenceMatrix[i], jSMEncoding2.JobSequenceMatrix[i]))81 return false;82 }83 return true;84 }85 86 private static bool AreEqual(Permutation p1, Permutation p2) {87 if (p1.Length != p2.Length)88 return false;89 for (int i = 0; i < p1.Length; i++) {90 if (p1[i] != p2[i])91 return false;92 }93 return true;94 }95 62 } 96 63 }
Note: See TracChangeset
for help on using the changeset viewer.