2020-03-03 10:20:52 +01:00
|
|
|
package inf112.fiasko.roborally.objects;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Describes a deck
|
2020-03-09 13:21:52 +01:00
|
|
|
*
|
|
|
|
* Any card stored in the deck is assumed to be immutable. If it's not, the integrity of the deck cannot be
|
|
|
|
* guaranteed.
|
2020-03-03 10:20:52 +01:00
|
|
|
*/
|
2020-03-03 12:14:07 +01:00
|
|
|
public interface IDeck <T> {
|
2020-03-03 10:20:52 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Shuffles the order of the cards in the deck
|
|
|
|
*/
|
|
|
|
void shuffle();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Draws one card from the top of another deck
|
|
|
|
* @param other The deck to draw the card from
|
|
|
|
*/
|
2020-03-03 12:14:07 +01:00
|
|
|
void draw(IDeck<T> other);
|
2020-03-03 10:20:52 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Draws n cards from the top of another deck
|
|
|
|
* @param other The other deck to draw from
|
|
|
|
* @param n The number of cards to draw
|
|
|
|
*/
|
2020-03-03 12:14:07 +01:00
|
|
|
void draw(IDeck<T> other, int n);
|
2020-03-03 10:20:52 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Moves all cards in this deck into another deck
|
|
|
|
* @param other The deck to move this deck's cards into
|
|
|
|
*/
|
2020-03-03 12:14:07 +01:00
|
|
|
void emptyInto(IDeck<T> other);
|
2020-03-03 10:20:52 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether this deck is empty
|
|
|
|
* @return True if this deck is currently empty
|
|
|
|
*/
|
|
|
|
boolean isEmpty();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the number of cards currently in this deck
|
|
|
|
* @return The number of cards in this deck
|
|
|
|
*/
|
|
|
|
int size();
|
|
|
|
|
2020-03-09 13:21:52 +01:00
|
|
|
/**
|
|
|
|
* Takes a peek at the card currently at the top of the deck
|
|
|
|
* @return The card at the top of the deck
|
|
|
|
*/
|
|
|
|
T peekTop();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Takes a peek at the card currently at the bottom of the deck
|
|
|
|
* @return The card at the bottom of the deck
|
|
|
|
*/
|
|
|
|
T peekBottom();
|
|
|
|
|
2020-03-03 10:20:52 +01:00
|
|
|
/**
|
|
|
|
* Gets a list of all cards in this deck
|
|
|
|
*
|
2020-03-09 13:21:52 +01:00
|
|
|
* The list should have the correct order according to the actual order within the deck.
|
2020-03-03 10:20:52 +01:00
|
|
|
*
|
|
|
|
* @return A list of all cards in this deck
|
|
|
|
*/
|
2020-03-03 12:14:07 +01:00
|
|
|
List<T> getCards();
|
2020-03-03 10:20:52 +01:00
|
|
|
}
|