Index

A C E G H I M N P R S T 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form

A

actionPerformed(ActionEvent) - Method in class com.alessiocascini.battleship.client.event.ConfirmPlacementListener
Triggered when the "Confirm" button is clicked.
actionPerformed(ActionEvent) - Method in class com.alessiocascini.battleship.client.event.GameCellListener
Triggered when a cell on the opponent's grid is clicked.
actionPerformed(ActionEvent) - Method in class com.alessiocascini.battleship.client.event.PlacementCellListener
Invoked when a grid cell is clicked.

C

Cell - Record Class in com.alessiocascini.battleship.client.model
Represents a single coordinate on the battleship grid.
Cell(int, int) - Constructor for record class com.alessiocascini.battleship.client.model.Cell
Creates an instance of a Cell record class.
cells() - Method in record class com.alessiocascini.battleship.client.model.Ship
Returns the value of the cells record component.
col() - Method in record class com.alessiocascini.battleship.client.model.Cell
Returns the value of the col record component.
com.alessiocascini.battleship.client.event - package com.alessiocascini.battleship.client.event
 
com.alessiocascini.battleship.client.model - package com.alessiocascini.battleship.client.model
 
com.alessiocascini.battleship.client.ui - package com.alessiocascini.battleship.client.ui
 
com.alessiocascini.battleship.server - package com.alessiocascini.battleship.server
 
ConfirmPlacementListener - Class in com.alessiocascini.battleship.client.event
Listener that handles the confirmation of ship placement.
ConfirmPlacementListener(PlacementHandler, List) - Constructor for class com.alessiocascini.battleship.client.event.ConfirmPlacementListener
Constructs the listener with a UI handler and the list of placed ships.

E

equals(Object) - Method in record class com.alessiocascini.battleship.client.model.Cell
Indicates whether some other object is "equal to" this one.
equals(Object) - Method in record class com.alessiocascini.battleship.client.model.Ship
Indicates whether some other object is "equal to" this one.
equals(Object) - Method in record class com.alessiocascini.battleship.client.model.ShipInfo
Indicates whether some other object is "equal to" this one.

G

GameActionHandler - Interface in com.alessiocascini.battleship.client.event
Interface defining the actions required to update the game state during the battle phase.
GameCellListener - Class in com.alessiocascini.battleship.client.event
Listener for the gameplay grid cells.
GameCellListener(GameActionHandler, boolean, int, int) - Constructor for class com.alessiocascini.battleship.client.event.GameCellListener
Constructs a listener for a specific coordinate on the opponent's grid.
GameHandler - Class in com.alessiocascini.battleship.server
Manages the gameplay logic for an individual turn.
GameHandler(Socket) - Constructor for class com.alessiocascini.battleship.server.GameHandler
Constructs a GameHandler for the connected client.
GameUI - Class in com.alessiocascini.battleship.client.ui
The main gameplay interface.
GameUI(List, boolean) - Constructor for class com.alessiocascini.battleship.client.ui.GameUI
Constructs the game interface, initializes the grids, and renders the player's ships.
getCellsAsArray() - Method in record class com.alessiocascini.battleship.client.model.Ship
Converts the ship's cell coordinates into a primitive 2D integer array.
getSelectedOrientationIndex() - Method in interface com.alessiocascini.battleship.client.event.PlacementHandler
Retrieves the selected orientation (e.g., Horizontal or Vertical).
getSelectedOrientationIndex() - Method in class com.alessiocascini.battleship.client.ui.PlacementUI
 
getSelectedShipIndex() - Method in interface com.alessiocascini.battleship.client.event.PlacementHandler
Retrieves the index of the currently selected ship from the UI.
getSelectedShipIndex() - Method in class com.alessiocascini.battleship.client.ui.PlacementUI
 
getShipCount() - Static method in class com.alessiocascini.battleship.server.Server
Calculates the number of ships based on the total number of occupied cells.
gridSize - Static variable in class com.alessiocascini.battleship.client.ui.PlacementUI
The size of the game board (10x10)

H

hashCode() - Method in record class com.alessiocascini.battleship.client.model.Cell
Returns a hash code value for this object.
hashCode() - Method in record class com.alessiocascini.battleship.client.model.Ship
Returns a hash code value for this object.
hashCode() - Method in record class com.alessiocascini.battleship.client.model.ShipInfo
Returns a hash code value for this object.
highlightShipCells(Ship) - Method in interface com.alessiocascini.battleship.client.event.PlacementHandler
Updates the UI to visually represent a ship that has been successfully placed.
highlightShipCells(Ship) - Method in class com.alessiocascini.battleship.client.ui.PlacementUI
Colors the cells occupied by a newly placed ship to provide visual feedback.

I

info() - Method in record class com.alessiocascini.battleship.client.model.Ship
Returns the value of the info record component.
isWaitingForSecondPlayer() - Static method in class com.alessiocascini.battleship.server.Server
 

M

main(String[]) - Static method in class com.alessiocascini.battleship.client.ui.PlacementUI
Main entry point for the client application.
main(String[]) - Static method in class com.alessiocascini.battleship.server.Server
Starts the server on port 5000 and handles the game lifecycle.

N

name() - Method in record class com.alessiocascini.battleship.client.model.ShipInfo
Returns the value of the name record component.

P

PlacementCellListener - Class in com.alessiocascini.battleship.client.event
Listener responsible for handling clicks on the placement grid.
PlacementCellListener(PlacementHandler, List, int, int) - Constructor for class com.alessiocascini.battleship.client.event.PlacementCellListener
Constructs a listener for a specific cell in the grid.
PlacementHandler - Class in com.alessiocascini.battleship.server
Handles the initial ship placement phase for a single client connection.
PlacementHandler - Interface in com.alessiocascini.battleship.client.event
Interface defining the necessary operations for handling the ship placement phase.
PlacementHandler(Socket) - Constructor for class com.alessiocascini.battleship.server.PlacementHandler
Constructs a new PlacementHandler for the given client socket. * @param clientSocket The socket through which the client is connected
PlacementUI - Class in com.alessiocascini.battleship.client.ui
Graphical interface for the ship placement phase.
PlacementUI() - Constructor for class com.alessiocascini.battleship.client.ui.PlacementUI
Initializes the placement window, sets up the grid of buttons, and configures the control panel.
proceedToGameUI(boolean) - Method in interface com.alessiocascini.battleship.client.event.PlacementHandler
Transitions the application from the placement screen to the main game screen.
proceedToGameUI(boolean) - Method in class com.alessiocascini.battleship.client.ui.PlacementUI
Closes the placement screen and opens the main game interface.
processMove(boolean, int[]) - Static method in class com.alessiocascini.battleship.server.Server
Processes a move from a player and checks if it's a hit, a miss, or a sinking move.
processMove(boolean, int, int, int[][]) - Method in interface com.alessiocascini.battleship.client.event.GameActionHandler
Processes and renders the result of a move on the game grids.
processMove(boolean, int, int, int[][]) - Method in class com.alessiocascini.battleship.client.ui.GameUI
Updates the UI based on the result of a move.

R

row() - Method in record class com.alessiocascini.battleship.client.model.Cell
Returns the value of the row record component.
run() - Method in class com.alessiocascini.battleship.server.GameHandler
Main game loop logic for a single turn request: 1.
run() - Method in class com.alessiocascini.battleship.server.PlacementHandler
Executes the placement logic: 1.

S

Server - Class in com.alessiocascini.battleship.server
The main entry point for the Battleship game server.
Server() - Constructor for class com.alessiocascini.battleship.server.Server
 
Ship - Record Class in com.alessiocascini.battleship.client.model
Represents a placed ship on the game board.
Ship(ShipInfo, Cell[]) - Constructor for record class com.alessiocascini.battleship.client.model.Ship
Creates an instance of a Ship record class.
ShipInfo - Record Class in com.alessiocascini.battleship.client.model
Metadata for a ship type.
ShipInfo(String, int) - Constructor for record class com.alessiocascini.battleship.client.model.ShipInfo
Creates an instance of a ShipInfo record class.
shipInfos - Static variable in class com.alessiocascini.battleship.client.ui.PlacementUI
Predefined fleet configuration with ship names and their respective sizes
showMessage(String) - Method in interface com.alessiocascini.battleship.client.event.GameActionHandler
Displays a game-related message to the player, such as turn notifications or win/loss alerts.
showMessage(String) - Method in interface com.alessiocascini.battleship.client.event.PlacementHandler
Displays a feedback message to the user, such as errors or instructions.
showMessage(String) - Method in class com.alessiocascini.battleship.client.ui.GameUI
 
showMessage(String) - Method in class com.alessiocascini.battleship.client.ui.PlacementUI
 
size() - Method in record class com.alessiocascini.battleship.client.model.ShipInfo
Returns the value of the size record component.
storeShipPositions(int[][][]) - Static method in class com.alessiocascini.battleship.server.Server
Stores the coordinates of ships placed by a player.

T

toString() - Method in record class com.alessiocascini.battleship.client.model.Cell
Returns a string representation of this record class.
toString() - Method in record class com.alessiocascini.battleship.client.model.Ship
Returns a string representation of this record class.
toString() - Method in record class com.alessiocascini.battleship.client.model.ShipInfo
Returns a string representation of this record class.
A C E G H I M N P R S T 
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form