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
|
|
|
|
*/
|
2020-03-03 21:15:13 +01:00
|
|
|
public class ProgrammingCard implements Comparable<ProgrammingCard> {
|
2020-03-03 02:38:25 +01:00
|
|
|
|
2020-03-03 21:15:13 +01:00
|
|
|
private final int cardPriority;
|
2020-03-03 17:25:18 +01:00
|
|
|
private final Action cardAction;
|
2020-03-03 02:38:25 +01:00
|
|
|
|
|
|
|
/**
|
2020-03-03 21:15:13 +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
|
|
|
|
*/
|
2020-03-03 21:15:13 +01:00
|
|
|
public ProgrammingCard(int cardPriority, Action cardAction) {
|
|
|
|
this.cardPriority = cardPriority;
|
2020-03-03 17:25:18 +01:00
|
|
|
this.cardAction = cardAction;
|
2020-03-03 02:38:25 +01:00
|
|
|
}
|
|
|
|
|
2020-03-03 20:51:50 +01:00
|
|
|
/**
|
2020-03-03 21:15:13 +01:00
|
|
|
* Gets the priority of the programming card
|
|
|
|
* @return The programming card priority
|
2020-03-03 20:51:50 +01:00
|
|
|
*/
|
2020-03-03 21:15:13 +01:00
|
|
|
public int getPriority() {
|
|
|
|
return cardPriority;
|
2020-03-03 02:38:25 +01:00
|
|
|
}
|
|
|
|
|
2020-03-03 20:51:50 +01:00
|
|
|
/**
|
2020-03-03 21:15:13 +01:00
|
|
|
* Gets the action of the programming card
|
|
|
|
* @return The programming card action
|
2020-03-03 20:51:50 +01:00
|
|
|
*/
|
2020-03-03 21:15:13 +01:00
|
|
|
public Action getAction() {
|
2020-03-03 02:38:25 +01:00
|
|
|
return cardAction;
|
|
|
|
}
|
2020-03-03 17:25:18 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
2020-03-03 21:15:13 +01:00
|
|
|
return this.getPriority() + " " + this.cardAction.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int compareTo(ProgrammingCard programmingCard) {
|
|
|
|
return this.cardPriority - programmingCard.cardPriority;
|
2020-03-03 17:25:18 +01:00
|
|
|
}
|
2020-03-03 02:38:25 +01:00
|
|
|
}
|