Changeset 15162 for trunk/sources
- Timestamp:
- 07/06/17 14:42:50 (7 years ago)
- Location:
- trunk/sources
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/BinaryVectorEqualityComparer.cs
r15067 r15162 28 28 public class BinaryVectorEqualityComparer : EqualityComparer<BinaryVector> { 29 29 public override bool Equals(BinaryVector x, BinaryVector y) { 30 if ( x == null && y == null) return true;30 if (ReferenceEquals(x, y)) return true; 31 31 if (x == null || y == null) return false; 32 if (ReferenceEquals(x, y)) return true;33 32 if (x.Length != y.Length) return false; 34 33 for (var i = 0; i < x.Length; i++) … … 36 35 return true; 37 36 } 37 38 38 public override int GetHashCode(BinaryVector obj) { 39 39 if (obj == null) throw new ArgumentNullException("obj", "BinaryVectorEqualityComparer: Cannot compute hash value of null."); 40 40 unchecked { 41 41 int hash = 17; 42 foreach (var bit in obj) {42 foreach (var bit in obj) 43 43 hash = hash * 29 + (bit ? 1231 : 1237); 44 }45 44 return hash; 46 45 } -
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVectorEqualityComparer.cs
r15067 r15162 28 28 public class IntegerVectorEqualityComparer : EqualityComparer<IntegerVector> { 29 29 public override bool Equals(IntegerVector x, IntegerVector y) { 30 if ( x == null && y == null) return true;30 if (ReferenceEquals(x, y)) return true; 31 31 if (x == null || y == null) return false; 32 if (ReferenceEquals(x, y)) return true;33 32 if (x.Length != y.Length) return false; 34 33 for (var i = 0; i < x.Length; i++) -
trunk/sources/HeuristicLab.Encodings.LinearLinkageEncoding/3.4/LinearLinkageEqualityComparer.cs
r15067 r15162 28 28 public class LinearLinkageEqualityComparer : EqualityComparer<LinearLinkage> { 29 29 public override bool Equals(LinearLinkage x, LinearLinkage y) { 30 if ( x == null && y == null) return true;30 if (ReferenceEquals(x, y)) return true; 31 31 if (x == null || y == null) return false; 32 if (ReferenceEquals(x, y)) return true;33 32 if (x.Length != y.Length) return false; 34 33 for (var i = 0; i < x.Length; i++) -
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/PermutationEqualityComparer.cs
r15067 r15162 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;32 if (ReferenceEquals(x, y)) return true; 33 33 if (x == null || y == null) return false; 34 if (ReferenceEquals(x, y)) return true;35 34 if (x.Length != y.Length) return false; 36 35 if (x.PermutationType != y.PermutationType) return false; -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/RealVectorEqualityComparer.cs
r15067 r15162 28 28 public class RealVectorEqualityComparer : EqualityComparer<RealVector> { 29 29 public override bool Equals(RealVector x, RealVector y) { 30 if ( x == null && y == null) return true;30 if (ReferenceEquals(x, y)) return true; 31 31 if (x == null || y == null) return false; 32 if (ReferenceEquals(x, y)) return true;33 32 if (x.Length != y.Length) return false; 34 33 for (var i = 0; i < x.Length; i++) 35 if (x[i] == y[i]) return false;34 if (x[i] != y[i]) return false; 36 35 return true; 37 36 }
Note: See TracChangeset
for help on using the changeset viewer.