mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-03-05 01:29:47 +01:00
Bytter navn fra value til priority for bedre beskrivelse av verdien Gjør programmeringskort sammenlignbare slik at de kan sorteres
49 lines
1.2 KiB
Java
49 lines
1.2 KiB
Java
package inf112.fiasko.roborally.objects;
|
|
|
|
import inf112.fiasko.roborally.element_properties.Action;
|
|
|
|
/**
|
|
* This class represents a programming card
|
|
*/
|
|
public class ProgrammingCard implements Comparable<ProgrammingCard> {
|
|
|
|
private final int cardPriority;
|
|
private final Action cardAction;
|
|
|
|
/**
|
|
* Initializes the priority and the action of the card
|
|
* @param cardPriority the priority of the card
|
|
* @param cardAction the action of the card
|
|
*/
|
|
public ProgrammingCard(int cardPriority, Action cardAction) {
|
|
this.cardPriority = cardPriority;
|
|
this.cardAction = cardAction;
|
|
}
|
|
|
|
/**
|
|
* Gets the priority of the programming card
|
|
* @return The programming card priority
|
|
*/
|
|
public int getPriority() {
|
|
return cardPriority;
|
|
}
|
|
|
|
/**
|
|
* Gets the action of the programming card
|
|
* @return The programming card action
|
|
*/
|
|
public Action getAction() {
|
|
return cardAction;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return this.getPriority() + " " + this.cardAction.toString();
|
|
}
|
|
|
|
@Override
|
|
public int compareTo(ProgrammingCard programmingCard) {
|
|
return this.cardPriority - programmingCard.cardPriority;
|
|
}
|
|
}
|