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

    Constructors
    Constructor
    Description
    SelectDiscardCommand(ca.uqam.info.mgl7010.max.skyjo.model.SkyjoModel model)
    Constructs a new RevealCardCommand with the specified game model.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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.
    boolean
    Indicates whether this command supports undo operations.
    Returns the name of the command
    void
    Undo the select discard command by: 1.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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:
      execute in interface ca.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:
      undo in interface ca.uqam.info.mgl7010.max.skyjo.controller.Command
    • isUndoable

      public boolean isUndoable()
      Indicates whether this command supports undo operations.
      Specified by:
      isUndoable in interface ca.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:
      getFollowUpCommands in interface ca.uqam.info.mgl7010.max.skyjo.controller.Command
    • toString

      public String toString()
      Returns the name of the command
      Overrides:
      toString in class Object
      Returns:
      a string representing the name of the class