Changeset 15067 for trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/PermutationEqualityComparer.cs
- Timestamp:
- 06/26/17 23:13:15 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/PermutationEqualityComparer.cs
r14185 r15067 30 30 public class PermutationEqualityComparer : EqualityComparer<Permutation> { 31 31 public override bool Equals(Permutation x, Permutation y) { 32 if (x == null && y == null) return true; 33 if (x == null || y == null) return false; 34 if (ReferenceEquals(x, y)) return true; 35 if (x.Length != y.Length) return false; 32 36 if (x.PermutationType != y.PermutationType) return false; 33 if (x.Length != y.Length) return false;34 37 switch (x.PermutationType) { 35 38 case PermutationTypes.Absolute: … … 67 70 68 71 public override int GetHashCode(Permutation obj) { 69 if (obj == null) return 0;72 if (obj == null) throw new ArgumentNullException("obj", "PermutationEqualityComparer: Cannot compute hash value of null."); 70 73 return GenerateHashString(obj).GetHashCode(); 71 74 }
Note: See TracChangeset
for help on using the changeset viewer.