Class RejectCardCommand
java.lang.Object
ca.uqam.info.controller.RejectCardCommand
- All Implemented Interfaces:
ca.uqam.info.mgl7010.max.skyjo.controller.Command
public class RejectCardCommand
extends Object
implements ca.uqam.info.mgl7010.max.skyjo.controller.Command
Command implementation for rejecting the currently buffered card in Skyjo game.
This command represents the player's decision to discard the card they previously
drew from the deck, placing it on the discard pile and ending their turn.
This command is only available when a card is present in the buffer (isBufferCardPresent() returns true).
- Version:
- 3.1
- Author:
- Mohamed Latif Diallo, Hamza Afif, Ussel Sabbat
-
Constructor Summary
ConstructorsConstructorDescriptionRejectCardCommand(ca.uqam.info.mgl7010.max.skyjo.model.SkyjoModel model) Constructs a new RejectCardCommand with the specified game model. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()Executes the reject card command by: 1.ca.uqam.info.mgl7010.max.skyjo.controller.Command[]After execution of a command calling this method creates a list of legal follow-up commands.booleanIndicates whether this command supports undo operations.toString()Returns the name of the commandvoidundo()Undo operation for this command.
-
Constructor Details
-
RejectCardCommand
public RejectCardCommand(ca.uqam.info.mgl7010.max.skyjo.model.SkyjoModel model) Constructs a new RejectCardCommand with the specified game model.- Parameters:
model- the Skyjo game model instance, must not be null
-
-
Method Details
-
execute
public void execute()Executes the reject card command by: 1. Removing the card from the buffer 2. Placing it on top of the discard pile- Specified by:
executein interfaceca.uqam.info.mgl7010.max.skyjo.controller.Command
-
undo
public void undo()Undo operation for this command. Not implemented for TP2 requirements. This method is part of the Command interface but remains unused in this version.- Specified by:
undoin interfaceca.uqam.info.mgl7010.max.skyjo.controller.Command
-
isUndoable
public boolean isUndoable()Indicates whether this command supports undo operations.- Specified by:
isUndoablein interfaceca.uqam.info.mgl7010.max.skyjo.controller.Command- Returns:
- false as undo functionality is not implemented for TP2
-
getFollowUpCommands
public ca.uqam.info.mgl7010.max.skyjo.controller.Command[] getFollowUpCommands()After execution of a command calling this method creates a list of legal follow-up commands. Can only be empty at game end. Returns: legal followup commands.- Specified by:
getFollowUpCommandsin interfaceca.uqam.info.mgl7010.max.skyjo.controller.Command
-
toString
-