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/JobSequenceMatrix/JSMEncoding.cs

    r9456 r10476  
    2020#endregion
    2121
     22using System;
    2223using System.Text;
    2324using HeuristicLab.Common;
     
    5354
    5455      foreach (Permutation p in JobSequenceMatrix) {
    55         sb.Append(p.ToString() + " \n");
     56        sb.AppendLine(p.ToString());
    5657      }
    5758
     
    5960      return sb.ToString();
    6061    }
    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     }
    9562  }
    9663}
Note: See TracChangeset for help on using the changeset viewer.