Ignore:
Timestamp:
02/20/14 13:46:04 (7 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/ScheduleEncoding/Schedule.cs

    r9456 r10476  
    149149      sb.Append("[ ");
    150150      foreach (Resource r in Resources) {
    151         sb.Append(r.ToString() + " \n");
     151        sb.AppendLine(r.ToString());
    152152      }
    153153      sb.Append("]");
     
    164164      return quality;
    165165    }
    166 
    167     public override bool Equals(object obj) {
    168       if (obj.GetType() == typeof(Schedule))
    169         return AreEqual(this, obj as Schedule);
    170       else
    171         return false;
    172     }
    173     public override int GetHashCode() {
    174       if (Resources.Count == 1)
    175         return Resources[0].GetHashCode();
    176       if (Resources.Count == 2)
    177         return Resources[0].GetHashCode() ^ Resources[1].GetHashCode();
    178       return 0;
    179     }
    180 
    181     private static bool AreEqual(Schedule schedule1, Schedule schedule2) {
    182       if (schedule1.Resources.Count != schedule2.Resources.Count)
    183         return false;
    184       for (int i = 0; i < schedule1.Resources.Count; i++) {
    185         if (!schedule1.Resources[i].Equals(schedule2.Resources[i]))
    186           return false;
    187       }
    188 
    189       return true;
    190     }
    191 
    192166  }
    193167}
Note: See TracChangeset for help on using the changeset viewer.