Changeset 10476 for trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition
- Timestamp:
- 02/20/14 13:46:04 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/PWREncoding.cs
r9456 r10476 75 75 return sb.ToString(); 76 76 } 77 78 public override bool Equals(object obj) {79 if (obj.GetType() == typeof(PWREncoding))80 return AreEqual(this, obj as PWREncoding);81 else82 return base.Equals(obj);83 }84 85 public override int GetHashCode() {86 if (PermutationWithRepetition.Length == 1)87 return PermutationWithRepetition[0].GetHashCode();88 if (PermutationWithRepetition.Length == 2)89 return PermutationWithRepetition[0].GetHashCode() ^ PermutationWithRepetition[1].GetHashCode();90 return 0;91 }92 93 private bool AreEqual(PWREncoding pWREncoding1, PWREncoding pWREncoding2) {94 if (pWREncoding1.PermutationWithRepetition.Length != pWREncoding2.PermutationWithRepetition.Length)95 return false;96 for (int i = 0; i < pWREncoding1.PermutationWithRepetition.Length; i++) {97 if (pWREncoding1.PermutationWithRepetition[i] != pWREncoding2.PermutationWithRepetition[i])98 return false;99 }100 return true;101 }102 77 } 103 78 }
Note: See TracChangeset
for help on using the changeset viewer.