Class CallShotMove

java.lang.Object
student.micro.battleship.Move
student.micro.battleship.CallShotMove

public class CallShotMove extends Move
Represents a "call out a shot" (or make a shot) move in the game "Battleship". When one player "fires" on another player's board and specifies the coordinate positions, that action is represented by an instance of this class.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CallShotMove(int x, int y)
    Creates a new move.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    int
    Get the x-coordinate of the position associated with this shot.
    int
    Get the y-coordinate of the position associated with this shot.
    int

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • CallShotMove

      public CallShotMove(int x, int y)
      Creates a new move.
      Parameters:
      x - The x-coordinate of the position at which the shot is being fired.
      y - The y-coordinate of the position at which the shot is being fired.
  • Method Details

    • getX

      public int getX()
      Get the x-coordinate of the position associated with this shot.
      Returns:
      The x-coordinate of the position at which this shot was fired.
    • getY

      public int getY()
      Get the y-coordinate of the position associated with this shot.
      Returns:
      The y-coordinate of the position at which this shot was fired.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object