Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/20/14 13:46:04 (11 years ago)
Author:
gkronber
Message:

#2127: removed Equals() and GetHashCode() overrides as well as related static methods.
Changed ctors of Task and Job to prevent calling virtual members.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/PermutationWithRepetition/PWREncoding.cs

    r9456 r10476  
    7575      return sb.ToString();
    7676    }
    77 
    78     public override bool Equals(object obj) {
    79       if (obj.GetType() == typeof(PWREncoding))
    80         return AreEqual(this, obj as PWREncoding);
    81       else
    82         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     }
    10277  }
    10378}
Note: See TracChangeset for help on using the changeset viewer.