Class SelectDiscardCommand
java.lang.Object
ca.uqam.info.controller.SelectDiscardCommand
- All Implemented Interfaces:
ca.uqam.info.mgl7010.max.skyjo.controller.Command
public class SelectDiscardCommand
extends Object
implements ca.uqam.info.mgl7010.max.skyjo.controller.Command
Command implementation for select a card from the discard an put it on the bufferin Skyjo game.
This command represents the player's decision to use the discard card
- Version:
- 3.1
- Author:
- Mohamed Latif Diallo, Hamza Afif, Ussel Sabbat
-
Constructor Summary
ConstructorsConstructorDescriptionSelectDiscardCommand(ca.uqam.info.mgl7010.max.skyjo.model.SkyjoModel model) Constructs a new RevealCardCommand with the specified game model. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()Executes the select discard 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 the select discard command by: 1.
-
Constructor Details
-
SelectDiscardCommand
public SelectDiscardCommand(ca.uqam.info.mgl7010.max.skyjo.model.SkyjoModel model) Constructs a new RevealCardCommand with the specified game model.- Parameters:
model- the Skyjo game model instance, must not be null
-
-
Method Details
-
execute
public void execute()Executes the select discard command by: 1. Select the discard 2. put it on the buffer card- Specified by:
executein interfaceca.uqam.info.mgl7010.max.skyjo.controller.Command
-
undo
public void undo()Undo the select discard command by: 1. return the buffer card to the discard- 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
-