Changeset 10483 for branches/LogResidualEvaluator/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Resource.cs
- Timestamp:
- 02/20/14 14:56:39 (11 years ago)
- Location:
- branches/LogResidualEvaluator
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LogResidualEvaluator
- Property svn:mergeinfo changed
-
branches/LogResidualEvaluator/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Resource.cs
r9456 r10483 73 73 sb.Append("Resource#" + Index + " [ "); 74 74 foreach (ScheduledTask t in Tasks) { 75 sb.Append(t .ToString()+ " ");75 sb.Append(t+ " "); 76 76 } 77 77 sb.Append("]"); 78 78 return sb.ToString(); 79 79 } 80 81 82 public override bool Equals(object obj) {83 if (obj.GetType() == typeof(Resource))84 return AreEqual(this, obj as Resource);85 else86 return false;87 }88 89 public override int GetHashCode() {90 if (Tasks.Count == 1)91 return Tasks[0].GetHashCode();92 if (Tasks.Count == 2)93 return Tasks[0].GetHashCode() ^ Tasks[1].GetHashCode();94 return 0;95 }96 97 private static bool AreEqual(Resource res1, Resource res2) {98 if (res1.Tasks.Count != res2.Tasks.Count)99 return false;100 for (int i = 0; i < res1.Tasks.Count; i++) {101 if (!res1.Tasks[i].Equals(res2.Tasks[i]))102 return false;103 }104 105 return true;106 }107 80 } 108 81 }
Note: See TracChangeset
for help on using the changeset viewer.