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

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

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

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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:
      execute in interface ca.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:
      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