Fiasko/src/main/java/inf112/fiasko/roborally/objects/ProgrammingCard.java

49 lines
1.2 KiB
Java
Raw Normal View History

2020-03-03 02:38:25 +01:00
package inf112.fiasko.roborally.objects;
import inf112.fiasko.roborally.element_properties.Action;
/**
* This class represents a programming card
*/
public class ProgrammingCard implements Comparable<ProgrammingCard> {
2020-03-03 02:38:25 +01:00
private final int cardPriority;
private final Action cardAction;
2020-03-03 02:38:25 +01:00
/**
* Initializes the priority and the action of the card
* @param cardPriority the priority of the card
2020-03-03 02:38:25 +01:00
* @param cardAction the action of the card
*/
public ProgrammingCard(int cardPriority, Action cardAction) {
this.cardPriority = cardPriority;
this.cardAction = cardAction;
2020-03-03 02:38:25 +01:00
}
/**
* Gets the priority of the programming card
* @return The programming card priority
*/
public int getPriority() {
return cardPriority;
2020-03-03 02:38:25 +01:00
}
/**
* Gets the action of the programming card
* @return The programming card action
*/
public Action getAction() {
2020-03-03 02:38:25 +01:00
return cardAction;
}
@Override
public String toString() {
return this.getPriority() + " " + this.cardAction.toString();
}
@Override
public int compareTo(ProgrammingCard programmingCard) {
return this.cardPriority - programmingCard.cardPriority;
}
2020-03-03 02:38:25 +01:00
}