java.lang.Object
be.belegkarnil.game.board.spectrangle.Action

public class Action extends Object
This class represents all possible actions during a Game.
Author:
Belegkarnil
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The maximum number of rotation that can be applied to a Piece
    final Piece
    The piece played during the action
    final Point
    The position at which to put the piece during the action
    final boolean
    The replace/swap request during the action
    final int
    The rotation applied to the piece played during the action
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct an action to skip turn, no action
    Action(Piece piece)
    Construct an action to replace/swap action (i.e.
    Action(Piece piece, Point position, int rotation)
    Construct an action to play a piece on the board
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Know if the action is to replace/swap a Piece
    boolean
    Know if the action is to skip the turn

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • piece

      public final Piece piece
      The piece played during the action
    • replace

      public final boolean replace
      The replace/swap request during the action
    • rotation

      public final int rotation
      The rotation applied to the piece played during the action
    • position

      public final Point position
      The position at which to put the piece during the action
    • MAX_ROTATION

      public static final int MAX_ROTATION
      The maximum number of rotation that can be applied to a Piece
      See Also:
  • Constructor Details

    • Action

      public Action(Piece piece)
      Construct an action to replace/swap action (i.e. put a piece in the bag and ask another)
      Parameters:
      piece - the piece to put back in the bag
    • Action

      public Action()
      Construct an action to skip turn, no action
    • Action

      public Action(Piece piece, Point position, int rotation)
      Construct an action to play a piece on the board
      Parameters:
      piece - the piece to put on the board at pos position
      position - the position to put the piece on
      rotation - the number of clockwise rotation to apply on the piece
  • Method Details

    • isReplace

      public boolean isReplace()
      Know if the action is to replace/swap a Piece
      Returns:
      true iff the action is to replace/swap a Piece
    • isSkip

      public boolean isSkip()
      Know if the action is to skip the turn
      Returns:
      true iff the action is to skip the turn