Gjør det mulig å sjekke om to programmeringskort er like

This commit is contained in:
Kristian Knarvik 2020-04-07 22:05:47 +02:00
parent cad7677bc6
commit 4a885f9fc0

View File

@ -41,6 +41,15 @@ public class ProgrammingCard implements Comparable<ProgrammingCard> {
return this.getPriority() + " " + this.cardAction.toString();
}
@Override
public boolean equals(Object other) {
if (!(other instanceof ProgrammingCard)) {
return false;
}
ProgrammingCard otherCard = (ProgrammingCard) other;
return otherCard.cardAction == this.cardAction && otherCard.cardPriority == this.cardPriority;
}
@Override
public int compareTo(ProgrammingCard programmingCard) {
return programmingCard.cardPriority - this.cardPriority;