Index
All Classes|All Packages
A
- AbstractPlayer - Class in battleship.model.player
-
Abstract player class see
Player
to know more about this code organisation - AbstractPlayer() - Constructor for class battleship.model.player.AbstractPlayer
- AbstractView - Class in battleship.view
-
Abstract view class
- AbstractView(Game) - Constructor for class battleship.view.AbstractView
- addMove(Triplet<Integer, Integer, Boolean>) - Method in class battleship.model.player.AbstractPlayer
-
add
move
to theAbstractPlayer.moves
list - addMove(Triplet<Integer, Integer, Boolean>) - Method in interface battleship.model.player.Player
-
Adds coordinates of the
move
in theAbstractPlayer.moves
list - areValid(int, int) - Method in class battleship.model.player.AbstractPlayer
- areValid(int, int) - Method in interface battleship.model.player.Player
-
check if coordinates from
View.chooseMove(Player)
are in valids position - arrow - Variable in enum battleship.model.Direction
B
- battleship - package battleship
-
Contains Main Class
- battleship.control - package battleship.control
-
Contains keyboard and mouse listeners
- battleship.model - package battleship.model
-
Contains all main Game classes
- battleship.model.player - package battleship.model.player
-
Contains all players classes instances and theirs super classes and interface
- battleship.utils - package battleship.utils
-
Utility classes
- battleship.view - package battleship.view
-
Contains terminal and windows view classes and theirs super class and interface
C
- changeCurrentPlayer() - Method in class battleship.model.Game
- checkDrownedShips() - Method in class battleship.model.Game
-
Update ship to know if they're drowned
- chooseMove() - Method in class battleship.model.player.Human
- chooseMove() - Method in interface battleship.model.player.Player
-
Used by computer only
- chooseMove() - Method in class battleship.model.player.Random
- chooseMove(Player) - Method in class battleship.view.AbstractView
-
used by
Computer
player to play a move in the grid depending of its algorithm - chooseMove(Player) - Method in class battleship.view.Terminal
-
ask player to choose a coords on its opponent grid, call
AbstractView.chooseMove(Player)
if instance of player isComputer
ifplayer
isn'tHuman
instance - chooseMove(Player) - Method in interface battleship.view.View
-
ask the player the choose a position on its opponent grid
- chooseMove(Player) - Method in class battleship.view.Window
-
ask player to choose a position in its opponent grid
- Computer - Class in battleship.model.player
-
Computer super class, all player object which use an algorithm to calculate coordinates to use should extend from this object.
- Computer() - Constructor for class battleship.model.player.Computer
- coords - Variable in class battleship.model.Ship
-
base coordinates of the ship
- currentPlayer - Variable in class battleship.model.Game
D
- DEFAULT - battleship.model.Direction
- direction - Variable in enum battleship.model.Direction
- direction - Variable in class battleship.model.Ship
- Direction - Enum in battleship.model
- Direction(Pair<Integer, Integer>, String, int) - Constructor for enum battleship.model.Direction
- displayBoard() - Method in class battleship.view.Terminal
-
print board in terminal
- displayBoard() - Method in interface battleship.view.View
-
Display all grids
- displayBoard() - Method in class battleship.view.Window
-
refresh windows to display updated content
- displayWinner(Player) - Method in class battleship.view.Terminal
-
print grid, winner player and close scanner, game automatically close after this
- displayWinner(Player) - Method in interface battleship.view.View
-
Display the winner of the game and then close the game
- displayWinner(Player) - Method in class battleship.view.Window
-
open a dialog to display the winner and exit the program when window is closed
- DOWN - battleship.model.Direction
- Draw(Window) - Constructor for class battleship.view.Window.Draw
E
- equals(Object) - Method in class battleship.utils.Pair
- equals(Object) - Method in class battleship.utils.Triplet
F
- frame - Variable in class battleship.view.Window
- fullCoords - Variable in class battleship.model.Ship
-
ship full coordinates calculate thank to base coordinates, direction and size
G
- game - Static variable in class battleship.Main
- game - Variable in class battleship.view.AbstractView
- Game - Class in battleship.model
-
Main game class
- Game(Player[]) - Constructor for class battleship.model.Game
- getArrow() - Method in enum battleship.model.Direction
- getCoords() - Method in class battleship.model.Ship
- getCurrentPlayer() - Method in class battleship.model.Game
- getDirection() - Method in enum battleship.model.Direction
- getDirection() - Method in class battleship.model.Ship
- getDirectionFromChar() - Method in class battleship.view.AbstractView
-
ask player for keyboard input and parse it into one of
Direction
value - getFullCoords() - Method in class battleship.model.Ship
- getId() - Method in class battleship.model.player.AbstractPlayer
- getId() - Method in interface battleship.model.player.Player
- getKeyInput() - Method in class battleship.view.AbstractView
-
ask player for keyboard input and return result
- getKeyInput() - Method in class battleship.view.Terminal
- getKeyInput() - Method in class battleship.view.Window
- getKeyword() - Method in enum battleship.model.Direction
- getLeft() - Method in class battleship.utils.Pair
- getLeft() - Method in class battleship.utils.Triplet
- getMiddle() - Method in class battleship.utils.Triplet
- getMoves() - Method in class battleship.model.player.AbstractPlayer
- getMoves() - Method in interface battleship.model.player.Player
- getOtherPlayer() - Method in class battleship.model.Game
- getOtherPlayer(Player) - Method in class battleship.model.Game
- getRight() - Method in class battleship.utils.Pair
- getRight() - Method in class battleship.utils.Triplet
- getShips() - Method in class battleship.model.player.AbstractPlayer
- getShips() - Method in interface battleship.model.player.Player
- getSize() - Method in class battleship.model.Ship
- getWinner() - Method in class battleship.model.Game
H
- hashCode() - Method in class battleship.utils.Pair
- hashCode() - Method in class battleship.utils.Triplet
- height - Variable in class battleship.view.Window
-
grids height, do no represent frame size
- Human - Class in battleship.model.player
-
This object do nothing itself, it just an interface to know the type of player (Human or not), each view interact with the player with its methods
- Human() - Constructor for class battleship.model.player.Human
I
- id - Variable in class battleship.model.player.AbstractPlayer
- isDrown - Variable in class battleship.model.Ship
-
if true the ship is destroyed
- isDrown() - Method in class battleship.model.Ship
- isPositionDrowned(Player, Ship, Pair<Integer, Integer>) - Method in class battleship.view.AbstractView
- isPositionDrowned(Player, Pair<Integer, Integer>) - Method in class battleship.view.AbstractView
- isShipPosition(Ship, Pair<Integer, Integer>) - Method in class battleship.view.AbstractView
K
- keyboardComponent - Variable in class battleship.view.Terminal
- keyboardComponent - Variable in class battleship.view.Window
- keyboardInput() - Method in class battleship.control.TerminalKeyboardListener
- keyboardInput() - Method in class battleship.view.AbstractView
-
ask
Game.currentPlayer
for keyboard input - keyboardInput() - Method in class battleship.view.Terminal
- keyboardInput() - Method in class battleship.view.Window
-
ask
Game.currentPlayer
for keyboard input - keyboardInputInteger() - Method in class battleship.view.Terminal
- keyPressed(KeyEvent) - Method in class battleship.control.WindowKeyboardListener
- keyReleased(KeyEvent) - Method in class battleship.control.WindowKeyboardListener
- keyTyped - Variable in class battleship.control.WindowKeyboardListener
- keyTyped(KeyEvent) - Method in class battleship.control.WindowKeyboardListener
- keyTypedArrow - Variable in class battleship.control.WindowKeyboardListener
- keyword - Variable in enum battleship.model.Direction
L
- lastInput - Variable in class battleship.control.WindowMouseListener
- left - Variable in class battleship.utils.Pair
- left - Variable in class battleship.utils.Triplet
- LEFT - battleship.model.Direction
M
- main(String[]) - Static method in class battleship.Main
- Main - Class in battleship
-
Main class Given arguments are importants, please give attention to
Main.parseArgs(String[])
about this - Main() - Constructor for class battleship.Main
- middle - Variable in class battleship.utils.Triplet
- mouseClicked(MouseEvent) - Method in class battleship.control.WindowMouseListener
- mouseClicked(MouseEvent) - Method in class battleship.view.WindowListener
- mouseComponent - Variable in class battleship.view.Window
- mouseEntered(MouseEvent) - Method in class battleship.control.WindowMouseListener
- mouseEntered(MouseEvent) - Method in class battleship.view.WindowListener
- mouseExited(MouseEvent) - Method in class battleship.control.WindowMouseListener
- mouseExited(MouseEvent) - Method in class battleship.view.WindowListener
- mouseInput(Player) - Method in class battleship.view.AbstractView
-
ask
player
for mouse input - mouseInput(Player) - Method in class battleship.view.Terminal
-
Never call in Terminal
- mouseInput(Player) - Method in class battleship.view.Window
-
ask
player
for mouse input - mousePressed(MouseEvent) - Method in class battleship.control.WindowMouseListener
- mousePressed(MouseEvent) - Method in class battleship.view.WindowListener
- mouseReleased(MouseEvent) - Method in class battleship.control.WindowMouseListener
- mouseReleased(MouseEvent) - Method in class battleship.view.WindowListener
- move(Pair<Integer, Integer>) - Method in class battleship.model.Game
-
Play the selected move from current player in grid
- moves - Variable in class battleship.model.player.AbstractPlayer
-
reference every shot on the opponent board, left and middle side of the Triplet reference the coordinates and the right side if this move hit or not an opponent ship
O
- openDialog(String) - Method in class battleship.view.Window
-
Open a window with
message
as content and with a "OK" button - openDialog(String, boolean) - Method in class battleship.view.Window
-
Open a window with
message
as content and with a "OK" button
P
- paintComponent(Graphics) - Method in class battleship.view.Window.Draw
- Pair<U,K> - Class in battleship.utils
-
tuple containing 2 generic type elements
- Pair(U, K) - Constructor for class battleship.utils.Pair
- parseArgs(String[]) - Static method in class battleship.Main
-
Read and parse launch arguments.
launch arguments need to follow this syntax: - placeShipRandomly() - Method in class battleship.model.player.Computer
- placeShips() - Method in class battleship.model.player.Human
- placeShips() - Method in interface battleship.model.player.Player
-
Used by
Computer
instances to place ships - placeShips() - Method in class battleship.model.player.Random
- Play(View) - Method in class battleship.model.Game
-
game loop
- Player - Interface in battleship.model.player
-
Player interface, used as an API.
- playerIdLastInput - Variable in class battleship.control.WindowMouseListener
- players - Variable in class battleship.model.Game
R
- Random - Class in battleship.model.player
-
place its ship and choose moves randomly
- Random() - Constructor for class battleship.model.player.Random
- recalculateFullCoords() - Method in class battleship.model.Ship
-
recalculate all coords based on this base coords, direction and size
- requestInput - Variable in class battleship.control.WindowKeyboardListener
- requestInput - Variable in class battleship.control.WindowMouseListener
- right - Variable in class battleship.utils.Pair
- right - Variable in class battleship.utils.Triplet
- RIGHT - battleship.model.Direction
S
- scanner - Variable in class battleship.control.TerminalKeyboardListener
- scanner - Static variable in class battleship.view.Terminal
- setCoords(Pair<Integer, Integer>) - Method in class battleship.model.Ship
- setDirection(Direction) - Method in class battleship.model.Ship
- setDrown() - Method in class battleship.model.Ship
-
set
Ship.isDrown
to true - setId(int) - Method in class battleship.model.player.AbstractPlayer
- setId(int) - Method in interface battleship.model.player.Player
- setShips(Player) - Method in class battleship.view.AbstractView
-
used if
player
instance ofComputer
- setShips(Player) - Method in class battleship.view.Terminal
-
Ask
player
to set position of its ships - setShips(Player) - Method in interface battleship.view.View
-
Ask
player
to set position of its ships - setShips(Player) - Method in class battleship.view.Window
-
Ask
player
to set position of its ships - setShips(Ship) - Method in class battleship.model.player.AbstractPlayer
- setShips(Ship) - Method in interface battleship.model.player.Player
-
check if ship position and direction are valides and does not overlap on other vessels add the ship to player
AbstractPlayer.ships
list and returntrue
if validfalse
otherwise - setUpperText(String) - Method in class battleship.view.AbstractView
- setUpperText(String) - Method in class battleship.view.Terminal
-
print string
- setUpperText(String) - Method in class battleship.view.Window
-
Display a text above the grid
- Ship - Class in battleship.model
-
player's ship class
- Ship(Pair<Integer, Integer>, int, Direction) - Constructor for class battleship.model.Ship
- ships - Variable in class battleship.model.player.AbstractPlayer
- shipSize - Static variable in interface battleship.model.player.Player
- shipsSize - Static variable in interface battleship.view.View
- size - Variable in class battleship.model.Ship
-
ship size
T
- Terminal - Class in battleship.view
-
Terminal view, instanced if argument 2 equals to "nogui"
- Terminal(Game) - Constructor for class battleship.view.Terminal
- TerminalKeyboardListener - Class in battleship.control
- TerminalKeyboardListener(Scanner) - Constructor for class battleship.control.TerminalKeyboardListener
- toString() - Method in class battleship.model.player.AbstractPlayer
- toString() - Method in class battleship.model.Ship
- toString() - Method in class battleship.utils.Pair
- toString() - Method in class battleship.utils.Triplet
- toString() - Method in class battleship.view.AbstractView
-
Used during debugging, used in terminal to display grids too
- toString(boolean) - Method in class battleship.view.AbstractView
- Triplet<U,K,V> - Class in battleship.utils
-
tuple containing 3 generic type elements
- Triplet(Pair<U, K>, V) - Constructor for class battleship.utils.Triplet
- Triplet(U, K, V) - Constructor for class battleship.utils.Triplet
U
- UP - battleship.model.Direction
- updateIsDrown(Player) - Method in class battleship.model.Ship
-
update value
Ship.isDrown
to true ifplayer
hit all of ship boxes - upperSubTitle - Variable in class battleship.view.Window
- upperTitle - Variable in class battleship.view.Window
V
- validMoves() - Method in class battleship.model.player.AbstractPlayer
- validMoves() - Method in interface battleship.model.player.Player
-
give a list of the player possible moves, used in
Player.chooseMove()
- valueOf(String) - Static method in enum battleship.model.Direction
-
Returns the enum constant of this type with the specified name.
- values() - Static method in enum battleship.model.Direction
-
Returns an array containing the constants of this enum type, in the order they are declared.
- view - Static variable in class battleship.Main
- View - Interface in battleship.view
-
View interface, used as an API
W
- width - Variable in class battleship.view.Window
-
grids width, do no represent frame size
- window - Variable in class battleship.control.WindowMouseListener
- window - Variable in class battleship.view.Window.Draw
- Window - Class in battleship.view
-
Window view, instanced if argument 2 equals to "nogui"
- Window(Game) - Constructor for class battleship.view.Window
- Window.Draw - Class in battleship.view
-
Panel where we paint the board
- WindowKeyboardListener - Class in battleship.control
- WindowKeyboardListener() - Constructor for class battleship.control.WindowKeyboardListener
- WindowListener - Class in battleship.view
- WindowListener() - Constructor for class battleship.view.WindowListener
- WindowMouseListener - Class in battleship.control
- WindowMouseListener(Window) - Constructor for class battleship.control.WindowMouseListener
All Classes|All Packages