Package battleship

Interface IPosition

All Known Implementing Classes:
Position

public interface IPosition
The interface Position.
Author:
fba
  • Method Details

    • getRow

      int getRow()
      Gets row.
      Returns:
      the row
    • getColumn

      int getColumn()
      Gets column.
      Returns:
      the column
    • getClassicRow

      char getClassicRow()
      Gets traditional row.
      Returns:
      the traditional row within [A-J]
    • getClassicColumn

      int getClassicColumn()
      Gets traditional column.
      Returns:
      the traditional column within [1-10]
    • equals

      boolean equals(Object other)
      Equals boolean.
      Overrides:
      equals in class Object
      Parameters:
      other - the other
      Returns:
      the boolean
    • isInside

      boolean isInside()
      Checks if the position is inside the board.
      Returns:
      true if the position is inside the board, false otherwise
    • isAdjacentTo

      boolean isAdjacentTo(IPosition other)
      Is adjacent to boolean.
      Parameters:
      other - the other
      Returns:
      the boolean
    • occupy

      void occupy()
      Occupy.
    • shoot

      void shoot()
      Shoot.
    • isOccupied

      boolean isOccupied()
      Is occupied boolean.
      Returns:
      the boolean
    • isHit

      boolean isHit()
      Is hit boolean.
      Returns:
      the boolean
    • adjacentPositions

      List<IPosition> adjacentPositions()
      Retrieves a list of positions that are adjacent to the current position. Adjacent positions are defined as those sharing a border or corner with the current position.
      Returns:
      a list of adjacent positions as IPosition objects