diff --git a/livraison/dist/BattleShip.jar b/livraison/dist/BattleShip.jar new file mode 100644 index 0000000..32983f2 Binary files /dev/null and b/livraison/dist/BattleShip.jar differ diff --git a/livraison/doc/allclasses-index.html b/livraison/doc/allclasses-index.html new file mode 100644 index 0000000..bf71f65 --- /dev/null +++ b/livraison/doc/allclasses-index.html @@ -0,0 +1,208 @@ + + + + + +All Classes + + + + + + + + + + + + + + +
+ +
+
+
+

All Classes

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ClassDescription
AbstractPlayer +
Abstract player class see Player to know more about this code organisation
+
AbstractView +
Abstract view class
+
Computer +
Computer super class, all player object which use an algorithm to calculate coordinates to use should extend from + this object.
+
Direction 
Game +
Main game class
+
Human +
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
+
Main +
Main class + Given arguments are importants, please give attention to Main.parseArgs(String[]) about this
+
Pair<U,​K> +
tuple containing 2 generic type elements
+
Player +
Player interface, used as an API.
+
Random +
place its ship and choose moves randomly
+
Ship +
player's ship class
+
Terminal +
Terminal view, instanced if argument 2 equals to "nogui"
+
TerminalKeyboardListener 
Triplet<U,​K,​V> +
tuple containing 3 generic type elements
+
View +
View interface, used as an API
+
Window +
Window view, instanced if argument 2 equals to "nogui"
+
WindowKeyboardListener 
WindowListener 
WindowMouseListener 
+
+
+
+ +
+
+ + diff --git a/livraison/doc/allpackages-index.html b/livraison/doc/allpackages-index.html new file mode 100644 index 0000000..d0b0203 --- /dev/null +++ b/livraison/doc/allpackages-index.html @@ -0,0 +1,129 @@ + + + + + +All Packages + + + + + + + + + + + + + + +
+ +
+
+
+

All Packages

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Package Summary
PackageDescription
battleship +
Contains Main Class
+
battleship.control +
Contains keyboard and mouse listeners
+
battleship.model +
Contains all main Game classes
+
battleship.model.player +
Contains all players classes instances and theirs super classes and interface
+
battleship.utils +
Utility classes
+
battleship.view +
Contains terminal and windows view classes and theirs super class and interface
+
+
+
+ +
+
+ + diff --git a/livraison/doc/battleship/Main.html b/livraison/doc/battleship/Main.html new file mode 100644 index 0000000..fb6c48f --- /dev/null +++ b/livraison/doc/battleship/Main.html @@ -0,0 +1,304 @@ + + + + + +Main + + + + + + + + + + + + + + +
+ +
+
+ +
+
Package battleship
+

Class Main

+
+
java.lang.Object +
battleship.Main
+
+
+
+
public class Main
+extends java.lang.Object
+
Main class + Given arguments are importants, please give attention to parseArgs(String[]) about this
+
+
+
    + +
  • +
    +

    Field Summary

    +
    + + + + + + + + + + + + + + + + + + + + + +
    Fields
    Modifier and TypeFieldDescription
    static Gamegame 
    static Viewview 
    +
    +
    +
  • + +
  • +
    +

    Constructor Summary

    +
    + + + + + + + + + + + + + + +
    Constructors
    ConstructorDescription
    Main() 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    static voidmain​(java.lang.String[] args) 
    private static voidparseArgs​(java.lang.String[] args) +
    Read and parse launch arguments.
    + launch arguments need to follow this syntax:
    +
    +
    +
    +
    +

    Methods inherited from class java.lang.Object

    +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      view

      +
      public static View view
      +
      +
    • +
    • +
      +

      game

      +
      public static Game game
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      Main

      +
      public Main()
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      main

      +
      public static void main​(java.lang.String[] args)
      +
      +
    • +
    • +
      +

      parseArgs

      +
      private static void parseArgs​(java.lang.String[] args) + throws java.lang.NoSuchMethodException, +java.lang.IllegalAccessException, +java.lang.reflect.InvocationTargetException, +java.lang.InstantiationException
      +

      Read and parse launch arguments.
      + launch arguments need to follow this syntax:

      +

      <player1_instance> <player2_instance> [nogui]

      +

      <arg> -> mandatory parameter
      + [arg] -> optional parameter
      + player_instance values are: "Human" or "Random"
      + nogui to launch the game in terminal or nothing to launch in graphical interface

      +
      +
      Parameters:
      +
      args - launch arguments
      +
      Throws:
      +
      java.lang.NoSuchMethodException - reflect exception
      +
      java.lang.IllegalAccessException - reflect exception
      +
      java.lang.reflect.InvocationTargetException - reflect exception
      +
      java.lang.InstantiationException - reflect exception
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/control/TerminalKeyboardListener.html b/livraison/doc/battleship/control/TerminalKeyboardListener.html new file mode 100644 index 0000000..07ee04e --- /dev/null +++ b/livraison/doc/battleship/control/TerminalKeyboardListener.html @@ -0,0 +1,257 @@ + + + + + +TerminalKeyboardListener + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Class TerminalKeyboardListener

+
+
java.lang.Object +
battleship.control.TerminalKeyboardListener
+
+
+
+
public class TerminalKeyboardListener
+extends java.lang.Object
+
+
+
    + +
  • +
    +

    Field Summary

    +
    + + + + + + + + + + + + + + + + +
    Fields
    Modifier and TypeFieldDescription
    private java.util.Scannerscanner 
    +
    +
    +
  • + +
  • +
    +

    Constructor Summary

    +
    + + + + + + + + + + + + + + +
    Constructors
    ConstructorDescription
    TerminalKeyboardListener​(java.util.Scanner scanner) 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    java.lang.StringkeyboardInput() 
    +
    +
    +
    +

    Methods inherited from class java.lang.Object

    +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      scanner

      +
      private final java.util.Scanner scanner
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      TerminalKeyboardListener

      +
      public TerminalKeyboardListener​(java.util.Scanner scanner)
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      keyboardInput

      +
      public java.lang.String keyboardInput()
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/control/WindowKeyboardListener.html b/livraison/doc/battleship/control/WindowKeyboardListener.html new file mode 100644 index 0000000..47f632c --- /dev/null +++ b/livraison/doc/battleship/control/WindowKeyboardListener.html @@ -0,0 +1,318 @@ + + + + + +WindowKeyboardListener + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Class WindowKeyboardListener

+
+
java.lang.Object +
battleship.control.WindowKeyboardListener
+
+
+
+
All Implemented Interfaces:
+
java.awt.event.KeyListener, java.util.EventListener
+
+
+
public class WindowKeyboardListener
+extends java.lang.Object
+implements java.awt.event.KeyListener
+
+
+
    + +
  • +
    +

    Field Summary

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Fields
    Modifier and TypeFieldDescription
    charkeyTyped 
    intkeyTypedArrow 
    booleanrequestInput 
    +
    +
    +
  • + +
  • +
    +

    Constructor Summary

    +
    + + + + + + + + + + + + + + +
    Constructors
    ConstructorDescription
    WindowKeyboardListener() 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    voidkeyPressed​(java.awt.event.KeyEvent e) 
    voidkeyReleased​(java.awt.event.KeyEvent e) 
    voidkeyTyped​(java.awt.event.KeyEvent e) 
    +
    +
    +
    +

    Methods inherited from class java.lang.Object

    +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      requestInput

      +
      public boolean requestInput
      +
      +
    • +
    • +
      +

      keyTyped

      +
      public char keyTyped
      +
      +
    • +
    • +
      +

      keyTypedArrow

      +
      public int keyTypedArrow
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      WindowKeyboardListener

      +
      public WindowKeyboardListener()
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      keyTyped

      +
      public void keyTyped​(java.awt.event.KeyEvent e)
      +
      +
      Specified by:
      +
      keyTyped in interface java.awt.event.KeyListener
      +
      +
      +
    • +
    • +
      +

      keyPressed

      +
      public void keyPressed​(java.awt.event.KeyEvent e)
      +
      +
      Specified by:
      +
      keyPressed in interface java.awt.event.KeyListener
      +
      +
      +
    • +
    • +
      +

      keyReleased

      +
      public void keyReleased​(java.awt.event.KeyEvent e)
      +
      +
      Specified by:
      +
      keyReleased in interface java.awt.event.KeyListener
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/control/WindowMouseListener.html b/livraison/doc/battleship/control/WindowMouseListener.html new file mode 100644 index 0000000..cb55549 --- /dev/null +++ b/livraison/doc/battleship/control/WindowMouseListener.html @@ -0,0 +1,359 @@ + + + + + +WindowMouseListener + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Class WindowMouseListener

+
+
java.lang.Object +
battleship.control.WindowMouseListener
+
+
+
+
All Implemented Interfaces:
+
java.awt.event.MouseListener, java.util.EventListener
+
+
+
public class WindowMouseListener
+extends java.lang.Object
+implements java.awt.event.MouseListener
+
+
+
    + +
  • +
    +

    Field Summary

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Fields
    Modifier and TypeFieldDescription
    Pair<java.lang.Integer,​java.lang.Integer>lastInput 
    intplayerIdLastInput 
    booleanrequestInput 
    private Windowwindow 
    +
    +
    +
  • + +
  • +
    +

    Constructor Summary

    +
    + + + + + + + + + + + + + + +
    Constructors
    ConstructorDescription
    WindowMouseListener​(Window view) 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    voidmouseClicked​(java.awt.event.MouseEvent e) 
    voidmouseEntered​(java.awt.event.MouseEvent ignored) 
    voidmouseExited​(java.awt.event.MouseEvent ignored) 
    voidmousePressed​(java.awt.event.MouseEvent e) 
    voidmouseReleased​(java.awt.event.MouseEvent e) 
    +
    +
    +
    +

    Methods inherited from class java.lang.Object

    +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      window

      +
      private final Window window
      +
      +
    • +
    • +
      +

      requestInput

      +
      public boolean requestInput
      +
      +
    • +
    • +
      +

      lastInput

      +
      public Pair<java.lang.Integer,​java.lang.Integer> lastInput
      +
      +
    • +
    • +
      +

      playerIdLastInput

      +
      public int playerIdLastInput
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      WindowMouseListener

      +
      public WindowMouseListener​(Window view)
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      mouseClicked

      +
      public void mouseClicked​(java.awt.event.MouseEvent e)
      +
      +
      Specified by:
      +
      mouseClicked in interface java.awt.event.MouseListener
      +
      +
      +
    • +
    • +
      +

      mousePressed

      +
      public void mousePressed​(java.awt.event.MouseEvent e)
      +
      +
      Specified by:
      +
      mousePressed in interface java.awt.event.MouseListener
      +
      +
      +
    • +
    • +
      +

      mouseReleased

      +
      public void mouseReleased​(java.awt.event.MouseEvent e)
      +
      +
      Specified by:
      +
      mouseReleased in interface java.awt.event.MouseListener
      +
      +
      +
    • +
    • +
      +

      mouseEntered

      +
      public void mouseEntered​(java.awt.event.MouseEvent ignored)
      +
      +
      Specified by:
      +
      mouseEntered in interface java.awt.event.MouseListener
      +
      +
      +
    • +
    • +
      +

      mouseExited

      +
      public void mouseExited​(java.awt.event.MouseEvent ignored)
      +
      +
      Specified by:
      +
      mouseExited in interface java.awt.event.MouseListener
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/control/package-summary.html b/livraison/doc/battleship/control/package-summary.html new file mode 100644 index 0000000..4fb4b03 --- /dev/null +++ b/livraison/doc/battleship/control/package-summary.html @@ -0,0 +1,114 @@ + + + + + +battleship.control + + + + + + + + + + + + + + +
+ +
+
+
+

Package battleship.control

+
+
+
Contains keyboard and mouse listeners
+
+
+ +
+
+ +
+
+ + diff --git a/livraison/doc/battleship/control/package-tree.html b/livraison/doc/battleship/control/package-tree.html new file mode 100644 index 0000000..eda03f7 --- /dev/null +++ b/livraison/doc/battleship/control/package-tree.html @@ -0,0 +1,96 @@ + + + + + +battleship.control Class Hierarchy + + + + + + + + + + + + + + +
+ +
+
+
+

Hierarchy For Package battleship.control

+Package Hierarchies: + +
+
+

Class Hierarchy

+ +
+
+ +
+
+ + diff --git a/livraison/doc/battleship/model/Direction.html b/livraison/doc/battleship/model/Direction.html new file mode 100644 index 0000000..768490b --- /dev/null +++ b/livraison/doc/battleship/model/Direction.html @@ -0,0 +1,448 @@ + + + + + +Direction + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Enum Direction

+
+
java.lang.Object +
java.lang.Enum<Direction> +
battleship.model.Direction
+
+
+
+
+
All Implemented Interfaces:
+
java.io.Serializable, java.lang.Comparable<Direction>, java.lang.constant.Constable
+
+
+
public enum Direction
+extends java.lang.Enum<Direction>
+
+
+
    + +
  • +
    +

    Nested Class Summary

    +
    +

    Nested classes/interfaces inherited from class java.lang.Enum

    +java.lang.Enum.EnumDesc<E extends java.lang.Enum<E>>
    +
    +
  • + +
  • +
    +

    Enum Constant Summary

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Enum Constants
    Enum ConstantDescription
    DEFAULT 
    DOWN 
    LEFT 
    RIGHT 
    UP 
    +
    +
    +
  • + +
  • +
    +

    Field Summary

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Fields
    Modifier and TypeFieldDescription
    private intarrow 
    private Pair<java.lang.Integer,​java.lang.Integer>direction 
    private java.lang.Stringkeyword 
    +
    +
    +
  • + +
  • +
    +

    Constructor Summary

    +
    + + + + + + + + + + + + + + + + +
    Constructors
    ModifierConstructorDescription
    private Direction​(Pair<java.lang.Integer,​java.lang.Integer> ukPair, +java.lang.String keyword, +int arrow) 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    intgetArrow() 
    Pair<java.lang.Integer,​java.lang.Integer>getDirection() 
    java.lang.StringgetKeyword() 
    static DirectionvalueOf​(java.lang.String name) +
    Returns the enum constant of this type with the specified name.
    +
    static Direction[]values() +
    Returns an array containing the constants of this enum type, in +the order they are declared.
    +
    +
    +
    +
    +

    Methods inherited from class java.lang.Enum

    +clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
    +
    +

    Methods inherited from class java.lang.Object

    +getClass, notify, notifyAll, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Enum Constant Details

    +
      +
    • + +
    • +
    • +
      +

      LEFT

      +
      public static final Direction LEFT
      +
      +
    • +
    • +
      +

      UP

      +
      public static final Direction UP
      +
      +
    • +
    • +
      +

      DOWN

      +
      public static final Direction DOWN
      +
      +
    • +
    • +
      +

      DEFAULT

      +
      public static final Direction DEFAULT
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      direction

      +
      private final Pair<java.lang.Integer,​java.lang.Integer> direction
      +
      +
    • +
    • +
      +

      keyword

      +
      private final java.lang.String keyword
      +
      +
    • +
    • +
      +

      arrow

      +
      private final int arrow
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      Direction

      +
      private Direction​(Pair<java.lang.Integer,​java.lang.Integer> ukPair, +java.lang.String keyword, +int arrow)
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      values

      +
      public static Direction[] values()
      +
      Returns an array containing the constants of this enum type, in +the order they are declared.
      +
      +
      Returns:
      +
      an array containing the constants of this enum type, in the order they are declared
      +
      +
      +
    • +
    • +
      +

      valueOf

      +
      public static Direction valueOf​(java.lang.String name)
      +
      Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.)
      +
      +
      Parameters:
      +
      name - the name of the enum constant to be returned.
      +
      Returns:
      +
      the enum constant with the specified name
      +
      Throws:
      +
      java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
      +
      java.lang.NullPointerException - if the argument is null
      +
      +
      +
    • +
    • +
      +

      getDirection

      +
      public Pair<java.lang.Integer,​java.lang.Integer> getDirection()
      +
      +
    • +
    • +
      +

      getKeyword

      +
      public java.lang.String getKeyword()
      +
      +
    • +
    • +
      +

      getArrow

      +
      public int getArrow()
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/model/Game.html b/livraison/doc/battleship/model/Game.html new file mode 100644 index 0000000..91258c2 --- /dev/null +++ b/livraison/doc/battleship/model/Game.html @@ -0,0 +1,367 @@ + + + + + +Game + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Class Game

+
+
java.lang.Object +
battleship.model.Game
+
+
+
+
public class Game
+extends java.lang.Object
+
Main game class
+
+
+
    + +
  • +
    +

    Field Summary

    +
    + + + + + + + + + + + + + + + + + + + + + +
    Fields
    Modifier and TypeFieldDescription
    PlayercurrentPlayer 
    Player[]players 
    +
    +
    +
  • + +
  • +
    +

    Constructor Summary

    +
    + + + + + + + + + + + + + + +
    Constructors
    ConstructorDescription
    Game​(Player[] players) 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    voidchangeCurrentPlayer() 
    voidcheckDrownedShips() +
    Update ship to know if they're drowned
    +
    PlayergetCurrentPlayer() 
    PlayergetOtherPlayer() 
    PlayergetOtherPlayer​(Player player) 
    PlayergetWinner() 
    voidmove​(Pair<java.lang.Integer,​java.lang.Integer> move) +
    Play the selected move from current player in grid
    +
    voidPlay​(View view) +
    game loop
    +
    +
    +
    +
    +

    Methods inherited from class java.lang.Object

    +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      players

      +
      public final Player[] players
      +
      +
    • +
    • +
      +

      currentPlayer

      +
      public Player currentPlayer
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      Game

      +
      public Game​(Player[] players)
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      getCurrentPlayer

      +
      public Player getCurrentPlayer()
      +
      +
    • +
    • +
      +

      getOtherPlayer

      +
      public Player getOtherPlayer()
      +
      +
    • +
    • +
      +

      getOtherPlayer

      +
      public Player getOtherPlayer​(Player player)
      +
      +
    • +
    • +
      +

      changeCurrentPlayer

      +
      public void changeCurrentPlayer()
      +
      +
    • +
    • +
      +

      checkDrownedShips

      +
      public void checkDrownedShips()
      +
      Update ship to know if they're drowned
      +
      +
    • +
    • +
      +

      getWinner

      +
      public Player getWinner()
      +
      +
      Returns:
      +
      player 1 if player 2' ships are drowned, or player 2 if player1' ships are drowned, null otherwise
      +
      +
      +
    • +
    • +
      +

      move

      +
      public void move​(Pair<java.lang.Integer,​java.lang.Integer> move)
      +
      Play the selected move from current player in grid
      +
      +
      Parameters:
      +
      move - selected player move
      +
      +
      +
    • +
    • +
      +

      Play

      +
      public void Play​(View view)
      +
      game loop
      +
      +
      Parameters:
      +
      view - can be Terminal or Window
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/model/Ship.html b/livraison/doc/battleship/model/Ship.html new file mode 100644 index 0000000..f9e5344 --- /dev/null +++ b/livraison/doc/battleship/model/Ship.html @@ -0,0 +1,445 @@ + + + + + +Ship + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Class Ship

+
+
java.lang.Object +
battleship.model.Ship
+
+
+
+
public class Ship
+extends java.lang.Object
+
player's ship class
+
+
+
    + +
  • +
    +

    Field Summary

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Fields
    Modifier and TypeFieldDescription
    private Pair<java.lang.Integer,​java.lang.Integer>coords +
    base coordinates of the ship
    +
    private Directiondirection 
    (package private) Pair<java.lang.Integer,​java.lang.Integer>[]fullCoords +
    ship full coordinates calculate thank to base coordinates, direction and size
    +
    private booleanisDrown +
    if true the ship is destroyed
    +
    private intsize +
    ship size
    +
    +
    +
    +
  • + +
  • +
    +

    Constructor Summary

    +
    + + + + + + + + + + + + + + +
    Constructors
    ConstructorDescription
    Ship​(Pair<java.lang.Integer,​java.lang.Integer> coords, +int size, +Direction direction) 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    Pair<java.lang.Integer,​java.lang.Integer>getCoords() 
    DirectiongetDirection() 
    Pair<java.lang.Integer,​java.lang.Integer>[]getFullCoords() 
    intgetSize() 
    booleanisDrown() 
    voidrecalculateFullCoords() +
    recalculate all coords based on this base coords, direction and size
    +
    voidsetCoords​(Pair<java.lang.Integer,​java.lang.Integer> c) 
    voidsetDirection​(Direction d) 
    voidsetDrown() +
    set isDrown to true
    +
    java.lang.StringtoString() 
    voidupdateIsDrown​(Player player) +
    update value isDrown to true if player hit all of ship boxes
    +
    +
    +
    +
    +

    Methods inherited from class java.lang.Object

    +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      coords

      +
      private Pair<java.lang.Integer,​java.lang.Integer> coords
      +
      base coordinates of the ship
      +
      +
    • +
    • +
      +

      size

      +
      private final int size
      +
      ship size
      +
      +
    • +
    • +
      +

      fullCoords

      +
      final Pair<java.lang.Integer,​java.lang.Integer>[] fullCoords
      +
      ship full coordinates calculate thank to base coordinates, direction and size
      +
      +
    • +
    • +
      +

      direction

      +
      private Direction direction
      +
      +
    • +
    • +
      +

      isDrown

      +
      private boolean isDrown
      +
      if true the ship is destroyed
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      Ship

      +
      public Ship​(Pair<java.lang.Integer,​java.lang.Integer> coords, +int size, +Direction direction)
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      setDirection

      +
      public void setDirection​(Direction d)
      +
      +
    • +
    • +
      +

      setCoords

      +
      public void setCoords​(Pair<java.lang.Integer,​java.lang.Integer> c)
      +
      +
    • +
    • +
      +

      setDrown

      +
      public void setDrown()
      +
      set isDrown to true
      +
      +
    • +
    • +
      +

      isDrown

      +
      public boolean isDrown()
      +
      +
    • +
    • +
      +

      getSize

      +
      public int getSize()
      +
      +
    • +
    • +
      +

      getDirection

      +
      public Direction getDirection()
      +
      +
    • +
    • +
      +

      getCoords

      +
      public Pair<java.lang.Integer,​java.lang.Integer> getCoords()
      +
      +
    • +
    • +
      +

      recalculateFullCoords

      +
      public void recalculateFullCoords()
      +
      recalculate all coords based on this base coords, direction and size
      +
      +
    • +
    • +
      +

      getFullCoords

      +
      public Pair<java.lang.Integer,​java.lang.Integer>[] getFullCoords()
      +
      +
    • +
    • +
      +

      toString

      +
      public java.lang.String toString()
      +
      +
      Overrides:
      +
      toString in class java.lang.Object
      +
      +
      +
    • +
    • +
      +

      updateIsDrown

      +
      public void updateIsDrown​(Player player)
      +
      update value isDrown to true if player hit all of ship boxes
      +
      +
      Parameters:
      +
      player - the opponent of this ship owner
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/model/package-summary.html b/livraison/doc/battleship/model/package-summary.html new file mode 100644 index 0000000..b73a018 --- /dev/null +++ b/livraison/doc/battleship/model/package-summary.html @@ -0,0 +1,133 @@ + + + + + +battleship.model + + + + + + + + + + + + + + +
+ +
+
+
+

Package battleship.model

+
+
+
Contains all main Game classes
+
+
+
    +
  • +
    + + + + + + + + + + + + + + + + + + +
    Class Summary
    ClassDescription
    Game +
    Main game class
    +
    Ship +
    player's ship class
    +
    +
    +
  • +
  • +
    + + + + + + + + + + + + + + +
    Enum Summary
    EnumDescription
    Direction 
    +
    +
  • +
+
+
+ +
+
+ + diff --git a/livraison/doc/battleship/model/package-tree.html b/livraison/doc/battleship/model/package-tree.html new file mode 100644 index 0000000..b80008c --- /dev/null +++ b/livraison/doc/battleship/model/package-tree.html @@ -0,0 +1,109 @@ + + + + + +battleship.model Class Hierarchy + + + + + + + + + + + + + + +
+ +
+
+
+

Hierarchy For Package battleship.model

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • battleship.model.Game
    • +
    • battleship.model.Ship
    • +
    +
  • +
+
+
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.lang.constant.Constable, java.io.Serializable) + +
    • +
    +
  • +
+
+
+ +
+
+ + diff --git a/livraison/doc/battleship/model/player/AbstractPlayer.html b/livraison/doc/battleship/model/player/AbstractPlayer.html new file mode 100644 index 0000000..d823fc5 --- /dev/null +++ b/livraison/doc/battleship/model/player/AbstractPlayer.html @@ -0,0 +1,465 @@ + + + + + +AbstractPlayer + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Class AbstractPlayer

+
+
java.lang.Object +
battleship.model.player.AbstractPlayer
+
+
+
+
All Implemented Interfaces:
+
Player
+
+
+
Direct Known Subclasses:
+
Computer, Human
+
+
+
public abstract class AbstractPlayer
+extends java.lang.Object
+implements Player
+
Abstract player class see Player to know more about this code organisation
+
+
See Also:
+
Player, +Human, +Computer, +Random
+
+
+
+
    + +
  • +
    +

    Field Summary

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Fields
    Modifier and TypeFieldDescription
    intid 
    (package private) java.util.ArrayList<Triplet<java.lang.Integer,​java.lang.Integer,​java.lang.Boolean>>moves +
    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
    +
    (package private) java.util.ArrayList<Ship>ships 
    +
    +
    +

    Fields inherited from interface battleship.model.player.Player

    +shipSize
    +
    +
  • + +
  • +
    +

    Constructor Summary

    +
    + + + + + + + + + + + + + + +
    Constructors
    ConstructorDescription
    AbstractPlayer() 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    voidaddMove​(Triplet<java.lang.Integer,​java.lang.Integer,​java.lang.Boolean> move) +
    add move to the moves list
    +
    booleanareValid​(int x, +int y) +
    check if coordinates from View.chooseMove(Player)are in valids position
    +
    intgetId() 
    java.util.ArrayList<Triplet<java.lang.Integer,​java.lang.Integer,​java.lang.Boolean>>getMoves() 
    java.util.ArrayList<Ship>getShips() 
    voidsetId​(int i) 
    booleansetShips​(Ship ship) +
    check if ship position and direction are valides and does not overlap on other vessels + add the ship to player ships list and return true if valid + false otherwise
    +
    java.lang.StringtoString() 
    java.util.ArrayList<Pair<java.lang.Integer,​java.lang.Integer>>validMoves() +
    give a list of the player possible moves, used in Player.chooseMove()
    +
    +
    +
    +
    +

    Methods inherited from class java.lang.Object

    +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    +
    +

    Methods inherited from interface battleship.model.player.Player

    +chooseMove, placeShips
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      ships

      +
      final java.util.ArrayList<Ship> ships
      +
      +
    • +
    • +
      +

      moves

      +
      final java.util.ArrayList<Triplet<java.lang.Integer,​java.lang.Integer,​java.lang.Boolean>> moves
      +
      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
      +
      +
    • +
    • +
      +

      id

      +
      public int id
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      AbstractPlayer

      +
      public AbstractPlayer()
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      setShips

      +
      public boolean setShips​(Ship ship)
      +
      Description copied from interface: Player
      +
      check if ship position and direction are valides and does not overlap on other vessels + add the ship to player ships list and return true if valid + false otherwise
      +
      +
      Specified by:
      +
      setShips in interface Player
      +
      Parameters:
      +
      ship - the ship instance we check
      +
      Returns:
      +
      true if ship data are valids, false otherwise
      +
      +
      +
    • +
    • +
      +

      addMove

      +
      public void addMove​(Triplet<java.lang.Integer,​java.lang.Integer,​java.lang.Boolean> move)
      +
      add move to the moves list
      +
      +
      Specified by:
      +
      addMove in interface Player
      +
      Parameters:
      +
      move - the move chosen by the player
      +
      +
      +
    • +
    • +
      +

      validMoves

      +
      public java.util.ArrayList<Pair<java.lang.Integer,​java.lang.Integer>> validMoves()
      +
      Description copied from interface: Player
      +
      give a list of the player possible moves, used in Player.chooseMove()
      +
      +
      Specified by:
      +
      validMoves in interface Player
      +
      Returns:
      +
      a list of playable move
      +
      +
      +
    • +
    • +
      +

      areValid

      +
      public boolean areValid​(int x, +int y)
      +
      Description copied from interface: Player
      +
      check if coordinates from View.chooseMove(Player)are in valids position
      +
      +
      Specified by:
      +
      areValid in interface Player
      +
      Parameters:
      +
      x - the x-axis of the coordinates
      +
      y - the y-axis of the coordinates
      +
      Returns:
      +
      true if valid, false otherwise
      +
      +
      +
    • +
    • +
      +

      setId

      +
      public void setId​(int i)
      +
      +
      Specified by:
      +
      setId in interface Player
      +
      +
      +
    • +
    • +
      +

      getId

      +
      public int getId()
      +
      +
      Specified by:
      +
      getId in interface Player
      +
      +
      +
    • +
    • +
      +

      toString

      +
      public java.lang.String toString()
      +
      +
      Overrides:
      +
      toString in class java.lang.Object
      +
      +
      +
    • +
    • +
      +

      getShips

      +
      public java.util.ArrayList<Ship> getShips()
      +
      +
      Specified by:
      +
      getShips in interface Player
      +
      +
      +
    • +
    • +
      +

      getMoves

      +
      public java.util.ArrayList<Triplet<java.lang.Integer,​java.lang.Integer,​java.lang.Boolean>> getMoves()
      +
      +
      Specified by:
      +
      getMoves in interface Player
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/model/player/Computer.html b/livraison/doc/battleship/model/player/Computer.html new file mode 100644 index 0000000..19eddbb --- /dev/null +++ b/livraison/doc/battleship/model/player/Computer.html @@ -0,0 +1,249 @@ + + + + + +Computer + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Class Computer

+
+
java.lang.Object +
battleship.model.player.AbstractPlayer +
battleship.model.player.Computer
+
+
+
+
+
All Implemented Interfaces:
+
Player
+
+
+
Direct Known Subclasses:
+
Random
+
+
+
public abstract class Computer
+extends AbstractPlayer
+

Computer super class, all player object which use an algorithm to calculate coordinates to use should extend from + this object.

+

Random is the only algorithm include here but another algorithm can be easily implemented

+
+
+ +
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      Computer

      +
      public Computer()
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      placeShipRandomly

      +
      public void placeShipRandomly()
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/model/player/Human.html b/livraison/doc/battleship/model/player/Human.html new file mode 100644 index 0000000..50af7f3 --- /dev/null +++ b/livraison/doc/battleship/model/player/Human.html @@ -0,0 +1,266 @@ + + + + + +Human + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Class Human

+
+
java.lang.Object +
battleship.model.player.AbstractPlayer +
battleship.model.player.Human
+
+
+
+
+
All Implemented Interfaces:
+
Player
+
+
+
public class Human
+extends AbstractPlayer
+
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
+
+
+
    + +
  • +
    +

    Field Summary

    +
    +

    Fields inherited from class battleship.model.player.AbstractPlayer

    +id, moves, ships
    +
    +

    Fields inherited from interface battleship.model.player.Player

    +shipSize
    +
    +
  • + +
  • +
    +

    Constructor Summary

    +
    + + + + + + + + + + + + + + +
    Constructors
    ConstructorDescription
    Human() 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    Pair<java.lang.Integer,​java.lang.Integer>chooseMove() +
    Used by computer only
    +
    voidplaceShips() +
    Used by Computer instances to place ships
    +
    +
    +
    +
    +

    Methods inherited from class battleship.model.player.AbstractPlayer

    +addMove, areValid, getId, getMoves, getShips, setId, setShips, toString, validMoves
    +
    +

    Methods inherited from class java.lang.Object

    +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      Human

      +
      public Human()
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      chooseMove

      +
      public Pair<java.lang.Integer,​java.lang.Integer> chooseMove()
      +
      Description copied from interface: Player
      +
      Used by computer only
      +
      +
      Returns:
      +
      coords in its opponent grid to play a move
      +
      See Also:
      +
      Random.chooseMove()
      +
      +
      +
    • +
    • +
      +

      placeShips

      +
      public void placeShips()
      +
      Description copied from interface: Player
      +
      Used by Computer instances to place ships
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/model/player/Player.html b/livraison/doc/battleship/model/player/Player.html new file mode 100644 index 0000000..79006ac --- /dev/null +++ b/livraison/doc/battleship/model/player/Player.html @@ -0,0 +1,379 @@ + + + + + +Player + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Interface Player

+
+
+
+
All Known Implementing Classes:
+
AbstractPlayer, Computer, Human, Random
+
+
+
public interface Player
+

Player interface, used as an API.

+

This model (interface -> abstract class(es) -> concrete classes) prevent hard code.

+

This is the only object which interact with other object
+ Allows an outside person from the project to easily change the code or to add a view easily without modifying + existing classes

+
+
See Also:
+
AbstractPlayer, +Computer, +Human, +Random
+
+
+
+
    + +
  • +
    +

    Field Summary

    +
    + + + + + + + + + + + + + + + + +
    Fields
    Modifier and TypeFieldDescription
    static int[]shipSize 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    voidaddMove​(Triplet<java.lang.Integer,​java.lang.Integer,​java.lang.Boolean> move) +
    Adds coordinates of the move in the AbstractPlayer.moves list
    +
    booleanareValid​(int x, +int y) +
    check if coordinates from View.chooseMove(Player)are in valids position
    +
    Pair<java.lang.Integer,​java.lang.Integer>chooseMove() +
    Used by computer only
    +
    intgetId() 
    java.util.ArrayList<Triplet<java.lang.Integer,​java.lang.Integer,​java.lang.Boolean>>getMoves() 
    java.util.ArrayList<Ship>getShips() 
    voidplaceShips() +
    Used by Computer instances to place ships
    +
    voidsetId​(int i) 
    booleansetShips​(Ship ship) +
    check if ship position and direction are valides and does not overlap on other vessels + add the ship to player AbstractPlayer.ships list and return true if valid + false otherwise
    +
    java.util.ArrayList<Pair<java.lang.Integer,​java.lang.Integer>>validMoves() +
    give a list of the player possible moves, used in chooseMove()
    +
    +
    +
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      shipSize

      +
      static final int[] shipSize
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      chooseMove

      +
      Pair<java.lang.Integer,​java.lang.Integer> chooseMove()
      +
      Used by computer only
      +
      +
      Returns:
      +
      coords in its opponent grid to play a move
      +
      See Also:
      +
      Random.chooseMove()
      +
      +
      +
    • +
    • +
      +

      setShips

      +
      boolean setShips​(Ship ship)
      +
      check if ship position and direction are valides and does not overlap on other vessels + add the ship to player AbstractPlayer.ships list and return true if valid + false otherwise
      +
      +
      Parameters:
      +
      ship - the ship instance we check
      +
      Returns:
      +
      true if ship data are valids, false otherwise
      +
      +
      +
    • +
    • +
      +

      getId

      +
      int getId()
      +
      +
    • +
    • +
      +

      addMove

      +
      void addMove​(Triplet<java.lang.Integer,​java.lang.Integer,​java.lang.Boolean> move)
      +
      Adds coordinates of the move in the AbstractPlayer.moves list
      +
      +
      Parameters:
      +
      move - the move chosen by the player
      +
      +
      +
    • +
    • +
      +

      setId

      +
      void setId​(int i)
      +
      +
    • +
    • +
      +

      validMoves

      +
      java.util.ArrayList<Pair<java.lang.Integer,​java.lang.Integer>> validMoves()
      +
      give a list of the player possible moves, used in chooseMove()
      +
      +
      Returns:
      +
      a list of playable move
      +
      +
      +
    • +
    • +
      +

      placeShips

      +
      void placeShips()
      +
      Used by Computer instances to place ships
      +
      +
    • +
    • +
      +

      areValid

      +
      boolean areValid​(int x, +int y)
      +
      check if coordinates from View.chooseMove(Player)are in valids position
      +
      +
      Parameters:
      +
      x - the x-axis of the coordinates
      +
      y - the y-axis of the coordinates
      +
      Returns:
      +
      true if valid, false otherwise
      +
      +
      +
    • +
    • +
      +

      getShips

      +
      java.util.ArrayList<Ship> getShips()
      +
      +
    • +
    • +
      +

      getMoves

      +
      java.util.ArrayList<Triplet<java.lang.Integer,​java.lang.Integer,​java.lang.Boolean>> getMoves()
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/model/player/Random.html b/livraison/doc/battleship/model/player/Random.html new file mode 100644 index 0000000..4064af3 --- /dev/null +++ b/livraison/doc/battleship/model/player/Random.html @@ -0,0 +1,270 @@ + + + + + +Random + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Class Random

+
+
java.lang.Object + +
+
+
+
All Implemented Interfaces:
+
Player
+
+
+
public class Random
+extends Computer
+
place its ship and choose moves randomly
+
+
+
    + +
  • +
    +

    Field Summary

    +
    +

    Fields inherited from class battleship.model.player.AbstractPlayer

    +id, moves, ships
    +
    +

    Fields inherited from interface battleship.model.player.Player

    +shipSize
    +
    +
  • + +
  • +
    +

    Constructor Summary

    +
    + + + + + + + + + + + + + + +
    Constructors
    ConstructorDescription
    Random() 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    Pair<java.lang.Integer,​java.lang.Integer>chooseMove() +
    Used by computer only
    +
    voidplaceShips() +
    Used by Computer instances to place ships
    +
    +
    +
    +
    +

    Methods inherited from class battleship.model.player.Computer

    +placeShipRandomly
    +
    +

    Methods inherited from class battleship.model.player.AbstractPlayer

    +addMove, areValid, getId, getMoves, getShips, setId, setShips, toString, validMoves
    +
    +

    Methods inherited from class java.lang.Object

    +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      Random

      +
      public Random()
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      chooseMove

      +
      public Pair<java.lang.Integer,​java.lang.Integer> chooseMove()
      +
      Description copied from interface: Player
      +
      Used by computer only
      +
      +
      Returns:
      +
      coords in its opponent grid to play a move
      +
      See Also:
      +
      chooseMove()
      +
      +
      +
    • +
    • +
      +

      placeShips

      +
      public void placeShips()
      +
      Description copied from interface: Player
      +
      Used by Computer instances to place ships
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/model/player/package-summary.html b/livraison/doc/battleship/model/player/package-summary.html new file mode 100644 index 0000000..53206c5 --- /dev/null +++ b/livraison/doc/battleship/model/player/package-summary.html @@ -0,0 +1,149 @@ + + + + + +battleship.model.player + + + + + + + + + + + + + + +
+ +
+
+
+

Package battleship.model.player

+
+
+
Contains all players classes instances and theirs super classes and interface
+
+
+
    +
  • +
    + + + + + + + + + + + + + + +
    Interface Summary
    InterfaceDescription
    Player +
    Player interface, used as an API.
    +
    +
    +
  • +
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary
    ClassDescription
    AbstractPlayer +
    Abstract player class see Player to know more about this code organisation
    +
    Computer +
    Computer super class, all player object which use an algorithm to calculate coordinates to use should extend from + this object.
    +
    Human +
    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
    +
    Random +
    place its ship and choose moves randomly
    +
    +
    +
  • +
+
+
+ +
+
+ + diff --git a/livraison/doc/battleship/model/player/package-tree.html b/livraison/doc/battleship/model/player/package-tree.html new file mode 100644 index 0000000..553e51e --- /dev/null +++ b/livraison/doc/battleship/model/player/package-tree.html @@ -0,0 +1,109 @@ + + + + + +battleship.model.player Class Hierarchy + + + + + + + + + + + + + + +
+ +
+
+
+

Hierarchy For Package battleship.model.player

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • battleship.model.player.AbstractPlayer (implements battleship.model.player.Player) +
        +
      • battleship.model.player.Computer +
          +
        • battleship.model.player.Random
        • +
        +
      • +
      • battleship.model.player.Human
      • +
      +
    • +
    +
  • +
+
+
+

Interface Hierarchy

+
    +
  • battleship.model.player.Player
  • +
+
+
+ +
+
+ + diff --git a/livraison/doc/battleship/package-summary.html b/livraison/doc/battleship/package-summary.html new file mode 100644 index 0000000..b569943 --- /dev/null +++ b/livraison/doc/battleship/package-summary.html @@ -0,0 +1,109 @@ + + + + + +battleship + + + + + + + + + + + + + + +
+ +
+
+
+

Package battleship

+
+
+
Contains Main Class
+
+
+
    +
  • +
    + + + + + + + + + + + + + + +
    Class Summary
    ClassDescription
    Main +
    Main class + Given arguments are importants, please give attention to Main.parseArgs(String[]) about this
    +
    +
    +
  • +
+
+
+ +
+
+ + diff --git a/livraison/doc/battleship/package-tree.html b/livraison/doc/battleship/package-tree.html new file mode 100644 index 0000000..97dd623 --- /dev/null +++ b/livraison/doc/battleship/package-tree.html @@ -0,0 +1,94 @@ + + + + + +battleship Class Hierarchy + + + + + + + + + + + + + + +
+ +
+
+
+

Hierarchy For Package battleship

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object + +
  • +
+
+
+ +
+
+ + diff --git a/livraison/doc/battleship/utils/Pair.html b/livraison/doc/battleship/utils/Pair.html new file mode 100644 index 0000000..abc0aca --- /dev/null +++ b/livraison/doc/battleship/utils/Pair.html @@ -0,0 +1,332 @@ + + + + + +Pair + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Class Pair<U,​K>

+
+
java.lang.Object +
battleship.utils.Pair<U,​K>
+
+
+
+
Type Parameters:
+
U - left
+
K - right
+
+
+
public class Pair<U,​K>
+extends java.lang.Object
+
tuple containing 2 generic type elements
+
+
+
    + +
  • +
    +

    Field Summary

    +
    + + + + + + + + + + + + + + + + + + + + + +
    Fields
    Modifier and TypeFieldDescription
    private Uleft 
    private Kright 
    +
    +
    +
  • + +
  • +
    +

    Constructor Summary

    +
    + + + + + + + + + + + + + + +
    Constructors
    ConstructorDescription
    Pair​(U left, +K right) 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    booleanequals​(java.lang.Object obj) 
    UgetLeft() 
    KgetRight() 
    inthashCode() 
    java.lang.StringtoString() 
    +
    +
    +
    +

    Methods inherited from class java.lang.Object

    +clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      left

      +
      private final U left
      +
      +
    • +
    • + +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      Pair

      +
      public Pair​(U left, +K right)
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      getLeft

      +
      public U getLeft()
      +
      +
    • +
    • +
      +

      getRight

      +
      public K getRight()
      +
      +
    • +
    • +
      +

      equals

      +
      public boolean equals​(java.lang.Object obj)
      +
      +
      Overrides:
      +
      equals in class java.lang.Object
      +
      +
      +
    • +
    • +
      +

      hashCode

      +
      public int hashCode()
      +
      +
      Overrides:
      +
      hashCode in class java.lang.Object
      +
      +
      +
    • +
    • +
      +

      toString

      +
      public java.lang.String toString()
      +
      +
      Overrides:
      +
      toString in class java.lang.Object
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/utils/Triplet.html b/livraison/doc/battleship/utils/Triplet.html new file mode 100644 index 0000000..aa3dea2 --- /dev/null +++ b/livraison/doc/battleship/utils/Triplet.html @@ -0,0 +1,369 @@ + + + + + +Triplet + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Class Triplet<U,​K,​V>

+
+
java.lang.Object +
battleship.utils.Triplet<U,​K,​V>
+
+
+
+
Type Parameters:
+
U - left
+
K - middle
+
V - right
+
+
+
public class Triplet<U,​K,​V>
+extends java.lang.Object
+
tuple containing 3 generic type elements
+
+
+
    + +
  • +
    +

    Field Summary

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Fields
    Modifier and TypeFieldDescription
    private Uleft 
    private Kmiddle 
    private Vright 
    +
    +
    +
  • + +
  • +
    +

    Constructor Summary

    +
    + + + + + + + + + + + + + + + + + + +
    Constructors
    ConstructorDescription
    Triplet​(Pair<U,​K> pair, +V right) 
    Triplet​(U left, +K middle, +V right) 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    booleanequals​(java.lang.Object obj) 
    UgetLeft() 
    KgetMiddle() 
    VgetRight() 
    inthashCode() 
    java.lang.StringtoString() 
    +
    +
    +
    +

    Methods inherited from class java.lang.Object

    +clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      left

      +
      private final U left
      +
      +
    • +
    • +
      +

      middle

      +
      private final K middle
      +
      +
    • +
    • + +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      Triplet

      +
      public Triplet​(U left, +K middle, +V right)
      +
      +
    • +
    • +
      +

      Triplet

      +
      public Triplet​(Pair<U,​K> pair, +V right)
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      getLeft

      +
      public U getLeft()
      +
      +
    • +
    • +
      +

      getMiddle

      +
      public K getMiddle()
      +
      +
    • +
    • +
      +

      getRight

      +
      public V getRight()
      +
      +
    • +
    • +
      +

      equals

      +
      public boolean equals​(java.lang.Object obj)
      +
      +
      Overrides:
      +
      equals in class java.lang.Object
      +
      +
      +
    • +
    • +
      +

      hashCode

      +
      public int hashCode()
      +
      +
      Overrides:
      +
      hashCode in class java.lang.Object
      +
      +
      +
    • +
    • +
      +

      toString

      +
      public java.lang.String toString()
      +
      +
      Overrides:
      +
      toString in class java.lang.Object
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/utils/package-summary.html b/livraison/doc/battleship/utils/package-summary.html new file mode 100644 index 0000000..ef2044d --- /dev/null +++ b/livraison/doc/battleship/utils/package-summary.html @@ -0,0 +1,114 @@ + + + + + +battleship.utils + + + + + + + + + + + + + + +
+ +
+
+
+

Package battleship.utils

+
+
+
Utility classes
+
+
+
    +
  • +
    + + + + + + + + + + + + + + + + + + +
    Class Summary
    ClassDescription
    Pair<U,​K> +
    tuple containing 2 generic type elements
    +
    Triplet<U,​K,​V> +
    tuple containing 3 generic type elements
    +
    +
    +
  • +
+
+
+ +
+
+ + diff --git a/livraison/doc/battleship/utils/package-tree.html b/livraison/doc/battleship/utils/package-tree.html new file mode 100644 index 0000000..4c6a66e --- /dev/null +++ b/livraison/doc/battleship/utils/package-tree.html @@ -0,0 +1,95 @@ + + + + + +battleship.utils Class Hierarchy + + + + + + + + + + + + + + +
+ +
+
+
+

Hierarchy For Package battleship.utils

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • battleship.utils.Pair<U,​K>
    • +
    • battleship.utils.Triplet<U,​K,​V>
    • +
    +
  • +
+
+
+ +
+
+ + diff --git a/livraison/doc/battleship/view/AbstractView.html b/livraison/doc/battleship/view/AbstractView.html new file mode 100644 index 0000000..714a07d --- /dev/null +++ b/livraison/doc/battleship/view/AbstractView.html @@ -0,0 +1,524 @@ + + + + + +AbstractView + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Class AbstractView

+
+
java.lang.Object +
battleship.view.AbstractView
+
+
+
+
All Implemented Interfaces:
+
View
+
+
+
Direct Known Subclasses:
+
Terminal, Window
+
+
+
public abstract class AbstractView
+extends java.lang.Object
+implements View
+
Abstract view class
+
+
See Also:
+
View, +Window, +Terminal
+
+
+
+
    + +
  • +
    +

    Field Summary

    +
    + + + + + + + + + + + + + + + + +
    Fields
    Modifier and TypeFieldDescription
    protected Gamegame 
    +
    +
    +

    Fields inherited from interface battleship.view.View

    +shipsSize
    +
    +
  • + +
  • +
    +

    Constructor Summary

    +
    + + + + + + + + + + + + + + +
    Constructors
    ConstructorDescription
    AbstractView​(Game game) 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    Pair<java.lang.Integer,​java.lang.Integer>chooseMove​(Player player) +
    used by Computer player to play a move in the grid depending of its algorithm
    +
    protected DirectiongetDirectionFromChar() +
    ask player for keyboard input and parse it into one of Direction value
    +
    protected abstract java.lang.StringgetKeyInput() +
    ask player for keyboard input and return result
    +
    private intisPositionDrowned​(Player other, +Ship ship, +Pair<java.lang.Integer,​java.lang.Integer> pair) 
    private intisPositionDrowned​(Player other, +Pair<java.lang.Integer,​java.lang.Integer> pair) 
    private booleanisShipPosition​(Ship ship, +Pair<java.lang.Integer,​java.lang.Integer> boardsCoords) 
    protected abstract java.lang.StringkeyboardInput() +
    ask Game.currentPlayer for keyboard input
    +
    protected abstract Pair<java.lang.Integer,​java.lang.Integer>mouseInput​(Player player) +
    ask player for mouse input
    +
    voidsetShips​(Player player) +
    used if player instance of Computer
    +
    protected abstract voidsetUpperText​(java.lang.String s) +
    Display a text above the grid on Window, simply print text on Terminal
    +
    java.lang.StringtoString() +
    Used during debugging, used in terminal to display grids too
    +
    java.lang.StringtoString​(boolean debug) 
    +
    +
    +
    +

    Methods inherited from class java.lang.Object

    +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    +
    +

    Methods inherited from interface battleship.view.View

    +displayBoard, displayWinner
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      game

      +
      protected final Game game
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      AbstractView

      +
      public AbstractView​(Game game)
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      toString

      +
      public java.lang.String toString()
      +
      Used during debugging, used in terminal to display grids too
      +
      +
      Overrides:
      +
      toString in class java.lang.Object
      +
      Returns:
      +
      all player grids
      +
      +
      +
    • +
    • +
      +

      toString

      +
      public java.lang.String toString​(boolean debug)
      +
      +
    • +
    • +
      +

      isShipPosition

      +
      private boolean isShipPosition​(Ship ship, +Pair<java.lang.Integer,​java.lang.Integer> boardsCoords)
      +
      +
      Returns:
      +
      true if Ship.getFullCoords() contains boardsCoords, false otherwise
      +
      +
      +
    • +
    • +
      +

      getDirectionFromChar

      +
      protected Direction getDirectionFromChar() + throws java.lang.InterruptedException
      +
      ask player for keyboard input and parse it into one of Direction value
      +
      +
      Returns:
      +
      Direction depending of player input
      +
      Throws:
      +
      java.lang.InterruptedException - caused by Window.getKeyInput()
      +
      See Also:
      +
      getDirectionFromChar()
      +
      +
      +
    • +
    • +
      +

      getKeyInput

      +
      protected abstract java.lang.String getKeyInput() + throws java.lang.InterruptedException
      +
      ask player for keyboard input and return result
      +
      +
      Returns:
      +
      String given by player
      +
      Throws:
      +
      java.lang.InterruptedException - see Window.getKeyInput()
      +
      +
      +
    • +
    • +
      +

      setUpperText

      +
      protected abstract void setUpperText​(java.lang.String s)
      +
      Display a text above the grid on Window, simply print text on Terminal
      +
      +
      Parameters:
      +
      s - text to display
      +
      See Also:
      +
      Window.setUpperText(String), +Terminal.setUpperText(String)
      +
      +
      +
    • +
    • +
      +

      setShips

      +
      public void setShips​(Player player) + throws java.lang.InterruptedException
      +
      used if player instance of Computer
      +
      +
      Specified by:
      +
      setShips in interface View
      +
      Parameters:
      +
      player - player we ask to set position of its ships
      +
      Throws:
      +
      java.lang.InterruptedException - see Window.setShips(Player)
      +
      +
      +
    • +
    • +
      +

      isPositionDrowned

      +
      private int isPositionDrowned​(Player other, +Ship ship, +Pair<java.lang.Integer,​java.lang.Integer> pair)
      +
      +
      Parameters:
      +
      other - other than the current player
      +
      ship - check if this ship at this position has been hit
      +
      pair - coords
      +
      Returns:
      +
      1 if ship fully drowned, 2 if only damaged, 0 if not
      +
      See Also:
      +
      isPositionDrowned(Player, Pair)
      +
      +
      +
    • +
    • +
      +

      isPositionDrowned

      +
      private int isPositionDrowned​(Player other, +Pair<java.lang.Integer,​java.lang.Integer> pair)
      +
      +
      Parameters:
      +
      other - other than the current player
      +
      pair - coords to check
      +
      Returns:
      +
      2 if player already played here, 0 otherwise
      +
      +
      +
    • +
    • +
      +

      chooseMove

      +
      public Pair<java.lang.Integer,​java.lang.Integer> chooseMove​(Player player) + throws java.lang.InterruptedException
      +
      used by Computer player to play a move in the grid depending of its algorithm
      +
      +
      Specified by:
      +
      chooseMove in interface View
      +
      Parameters:
      +
      player - Game.currentPlayer
      +
      Returns:
      +
      a couple (Pair containing the x and y coordinate (left side store Y and right side X)
      +
      Throws:
      +
      java.lang.InterruptedException - see Window.chooseMove(Player)
      +
      +
      +
    • +
    • +
      +

      mouseInput

      +
      protected abstract Pair<java.lang.Integer,​java.lang.Integer> mouseInput​(Player player) + throws java.lang.InterruptedException
      +
      ask player for mouse input
      +
      +
      Parameters:
      +
      player - Game.currentPlayer
      +
      Returns:
      +
      coordinate of player opponent grid
      +
      Throws:
      +
      java.lang.InterruptedException - see Window.mouseInput(Player)
      +
      See Also:
      +
      Window.mouseInput(Player)
      +
      +
      +
    • +
    • +
      +

      keyboardInput

      +
      protected abstract java.lang.String keyboardInput() + throws java.lang.InterruptedException
      +
      ask Game.currentPlayer for keyboard input
      +
      +
      Returns:
      +
      String given by player
      +
      Throws:
      +
      java.lang.InterruptedException - see Window.keyboardInput()
      +
      See Also:
      +
      Window.keyboardInput(), +Terminal.keyboardInput(), +Terminal.keyboardInputInteger()
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/view/Terminal.html b/livraison/doc/battleship/view/Terminal.html new file mode 100644 index 0000000..4f7630c --- /dev/null +++ b/livraison/doc/battleship/view/Terminal.html @@ -0,0 +1,480 @@ + + + + + +Terminal + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Class Terminal

+
+
java.lang.Object +
battleship.view.AbstractView +
battleship.view.Terminal
+
+
+
+
+
All Implemented Interfaces:
+
View
+
+
+
public class Terminal
+extends AbstractView
+
Terminal view, instanced if argument 2 equals to "nogui"
+
+
See Also:
+
View, +AbstractView
+
+
+
+
    + +
  • +
    +

    Field Summary

    +
    + + + + + + + + + + + + + + + + + + + + + +
    Fields
    Modifier and TypeFieldDescription
    private TerminalKeyboardListenerkeyboardComponent 
    static java.util.Scannerscanner 
    +
    +
    +

    Fields inherited from class battleship.view.AbstractView

    +game
    +
    +

    Fields inherited from interface battleship.view.View

    +shipsSize
    +
    +
  • + +
  • +
    +

    Constructor Summary

    +
    + + + + + + + + + + + + + + +
    Constructors
    ConstructorDescription
    Terminal​(Game game) 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    Pair<java.lang.Integer,​java.lang.Integer>chooseMove​(Player player) +
    ask player to choose a coords on its opponent grid, call AbstractView.chooseMove(Player) if instance of + player is Computer + if player isn't Human instance
    +
    voiddisplayBoard() +
    print board in terminal
    +
    voiddisplayWinner​(Player winner) +
    print grid, winner player and close scanner, game automatically close after this
    +
    protected java.lang.StringgetKeyInput() +
    ask player for keyboard input and return result
    +
    protected java.lang.StringkeyboardInput() +
    ask Game.currentPlayer for keyboard input
    +
    protected intkeyboardInputInteger() 
    protected Pair<java.lang.Integer,​java.lang.Integer>mouseInput​(Player player) +
    Never call in Terminal
    +
    voidsetShips​(Player player) +
    Ask player to set position of its ships
    +
    protected voidsetUpperText​(java.lang.String s) +
    print string
    +
    +
    +
    +
    +

    Methods inherited from class battleship.view.AbstractView

    +getDirectionFromChar, toString, toString
    +
    +

    Methods inherited from class java.lang.Object

    +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      scanner

      +
      public static java.util.Scanner scanner
      +
      +
    • +
    • +
      +

      keyboardComponent

      +
      private final TerminalKeyboardListener keyboardComponent
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      Terminal

      +
      public Terminal​(Game game)
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    + +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/view/View.html b/livraison/doc/battleship/view/View.html new file mode 100644 index 0000000..6a6396a --- /dev/null +++ b/livraison/doc/battleship/view/View.html @@ -0,0 +1,295 @@ + + + + + +View + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Interface View

+
+
+
+
All Known Implementing Classes:
+
AbstractView, Terminal, Window
+
+
+
public interface View
+

View interface, used as an API

+

This model (interface -> abstract class(es) -> concrete classes) prevent hard code.

+

This is the only object which interact with other object
+ Allows an outside person easily change the code or add a view easily without modifying existing classes

+
+
See Also:
+
AbstractView, +Terminal, +Window
+
+
+
+
    + +
  • +
    +

    Field Summary

    +
    + + + + + + + + + + + + + + + + +
    Fields
    Modifier and TypeFieldDescription
    static int[]shipsSize 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    Pair<java.lang.Integer,​java.lang.Integer>chooseMove​(Player player) +
    ask the player the choose a position on its opponent grid
    +
    voiddisplayBoard() +
    Display all grids
    +
    voiddisplayWinner​(Player winner) +
    Display the winner of the game and then close the game
    +
    voidsetShips​(Player player) +
    Ask player to set position of its ships
    +
    +
    +
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      shipsSize

      +
      static final int[] shipsSize
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      setShips

      +
      void setShips​(Player player) + throws java.lang.InterruptedException
      +
      Ask player to set position of its ships
      +
      +
      Parameters:
      +
      player - player instance we ask
      +
      Throws:
      +
      java.lang.InterruptedException - see Window.setShips(Player)
      +
      +
      +
    • +
    • +
      +

      displayBoard

      +
      void displayBoard()
      +
      Display all grids
      +
      +
    • +
    • +
      +

      chooseMove

      +
      Pair<java.lang.Integer,​java.lang.Integer> chooseMove​(Player player) + throws java.lang.InterruptedException
      +
      ask the player the choose a position on its opponent grid
      +
      +
      Parameters:
      +
      player - Game.currentPlayer
      +
      Returns:
      +
      a element containing the x and y coordinate (left side store Y and right side X)
      +
      Throws:
      +
      java.lang.InterruptedException - see Window.chooseMove(Player)
      +
      +
      +
    • +
    • +
      +

      displayWinner

      +
      void displayWinner​(Player winner)
      +
      Display the winner of the game and then close the game
      +
      +
      Parameters:
      +
      winner - the winner of the game.
      +
      See Also:
      +
      Window.displayWinner(Player), +Terminal.displayWinner(Player)
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/view/Window.Draw.html b/livraison/doc/battleship/view/Window.Draw.html new file mode 100644 index 0000000..f4e0a57 --- /dev/null +++ b/livraison/doc/battleship/view/Window.Draw.html @@ -0,0 +1,321 @@ + + + + + +Window.Draw + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Class Window.Draw

+
+
java.lang.Object +
java.awt.Component +
java.awt.Container +
javax.swing.JComponent +
javax.swing.JPanel +
battleship.view.Window.Draw
+
+
+
+
+
+
+
+
All Implemented Interfaces:
+
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
+
+
+
Enclosing class:
+
Window
+
+
+
class Window.Draw
+extends javax.swing.JPanel
+
Panel where we paint the board
+
+
See Also:
+
JPanel
+
+
+
+
    + +
  • +
    +

    Nested Class Summary

    +
    +

    Nested classes/interfaces inherited from class javax.swing.JPanel

    +javax.swing.JPanel.AccessibleJPanel
    +
    +

    Nested classes/interfaces inherited from class javax.swing.JComponent

    +javax.swing.JComponent.AccessibleJComponent
    +
    +

    Nested classes/interfaces inherited from class java.awt.Container

    +java.awt.Container.AccessibleAWTContainer
    +
    +

    Nested classes/interfaces inherited from class java.awt.Component

    +java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    +
    +
  • + +
  • +
    +

    Field Summary

    +
    + + + + + + + + + + + + + + + + +
    Fields
    Modifier and TypeFieldDescription
    private Windowwindow 
    +
    +
    +

    Fields inherited from class javax.swing.JComponent

    +listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
    +
    +

    Fields inherited from class java.awt.Component

    +accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
    +
    +

    Fields inherited from interface java.awt.image.ImageObserver

    +ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    +
    +
  • + +
  • +
    +

    Constructor Summary

    +
    + + + + + + + + + + + + + + +
    Constructors
    ConstructorDescription
    Draw​(Window window) 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    voidpaintComponent​(java.awt.Graphics g) 
    +
    +
    +
    +

    Methods inherited from class javax.swing.JPanel

    +getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
    +
    +

    Methods inherited from class javax.swing.JComponent

    +addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
    +
    +

    Methods inherited from class java.awt.Container

    +add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
    +
    +

    Methods inherited from class java.awt.Component

    +action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
    +
    +

    Methods inherited from class java.lang.Object

    +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      window

      +
      private final Window window
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      Draw

      +
      public Draw​(Window window)
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      paintComponent

      +
      public void paintComponent​(java.awt.Graphics g)
      +
      +
      Overrides:
      +
      paintComponent in class javax.swing.JComponent
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/view/Window.html b/livraison/doc/battleship/view/Window.html new file mode 100644 index 0000000..9dab4e9 --- /dev/null +++ b/livraison/doc/battleship/view/Window.html @@ -0,0 +1,603 @@ + + + + + +Window + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Class Window

+
+
java.lang.Object +
battleship.view.AbstractView +
battleship.view.Window
+
+
+
+
+
All Implemented Interfaces:
+
View
+
+
+
public class Window
+extends AbstractView
+
Window view, instanced if argument 2 equals to "nogui"
+
+
See Also:
+
View, +AbstractView
+
+
+
+
    + +
  • +
    +

    Nested Class Summary

    +
    + + + + + + + + + + + + + + + + +
    Nested Classes
    Modifier and TypeClassDescription
    (package private) class Window.Draw +
    Panel where we paint the board
    +
    +
    +
    +
  • + +
  • +
    +

    Field Summary

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Fields
    Modifier and TypeFieldDescription
    (package private) javax.swing.JFrameframe 
    intheight +
    grids height, do no represent frame size
    +
    private WindowKeyboardListenerkeyboardComponent 
    private WindowMouseListenermouseComponent 
    (package private) java.lang.StringupperSubTitle 
    (package private) java.lang.StringupperTitle 
    intwidth +
    grids width, do no represent frame size
    +
    +
    +
    +

    Fields inherited from class battleship.view.AbstractView

    +game
    +
    +

    Fields inherited from interface battleship.view.View

    +shipsSize
    +
    +
  • + +
  • +
    +

    Constructor Summary

    +
    + + + + + + + + + + + + + + +
    Constructors
    ConstructorDescription
    Window​(Game game) 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    Pair<java.lang.Integer,​java.lang.Integer>chooseMove​(Player player) +
    ask player to choose a position in its opponent grid
    +
    voiddisplayBoard() +
    refresh windows to display updated content
    +
    voiddisplayWinner​(Player winner) +
    open a dialog to display the winner and exit the program when window is closed
    +
    protected java.lang.StringgetKeyInput() +
    ask player for keyboard input and return result
    +
    protected java.lang.StringkeyboardInput() +
    ask Game.currentPlayer for keyboard input
    +
    protected Pair<java.lang.Integer,​java.lang.Integer>mouseInput​(Player player) +
    ask player for mouse input
    +
    voidopenDialog​(java.lang.String message) +
    Open a window with message as content and with a "OK" button
    +
    voidopenDialog​(java.lang.String message, +boolean exitOnClose) +
    Open a window with message as content and with a "OK" button
    +
    voidsetShips​(Player player) +
    Ask player to set position of its ships
    +
    protected voidsetUpperText​(java.lang.String s) +
    Display a text above the grid
    +
    +
    +
    +
    +

    Methods inherited from class battleship.view.AbstractView

    +getDirectionFromChar, toString, toString
    +
    +

    Methods inherited from class java.lang.Object

    +clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Field Details

    +
      +
    • +
      +

      frame

      +
      final javax.swing.JFrame frame
      +
      +
    • +
    • +
      +

      height

      +
      public final int height
      +
      grids height, do no represent frame size
      +
      +
      See Also:
      +
      Constant Field Values
      +
      +
      +
    • +
    • +
      +

      width

      +
      public final int width
      +
      grids width, do no represent frame size
      +
      +
      See Also:
      +
      Constant Field Values
      +
      +
      +
    • +
    • +
      +

      mouseComponent

      +
      private final WindowMouseListener mouseComponent
      +
      +
    • +
    • +
      +

      keyboardComponent

      +
      private final WindowKeyboardListener keyboardComponent
      +
      +
    • +
    • +
      +

      upperTitle

      +
      java.lang.String upperTitle
      +
      +
    • +
    • +
      +

      upperSubTitle

      +
      java.lang.String upperSubTitle
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      Window

      +
      public Window​(Game game)
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      getKeyInput

      +
      protected java.lang.String getKeyInput() + throws java.lang.InterruptedException
      +
      Description copied from class: AbstractView
      +
      ask player for keyboard input and return result
      +
      +
      Specified by:
      +
      getKeyInput in class AbstractView
      +
      Returns:
      +
      String given by player
      +
      Throws:
      +
      java.lang.InterruptedException - see getKeyInput()
      +
      +
      +
    • +
    • +
      +

      setUpperText

      +
      protected void setUpperText​(java.lang.String s)
      +
      Display a text above the grid
      +
      +
      Specified by:
      +
      setUpperText in class AbstractView
      +
      Parameters:
      +
      s - text to display
      +
      See Also:
      +
      setUpperText(String), +Terminal.setUpperText(String)
      +
      +
      +
    • +
    • +
      +

      setShips

      +
      public void setShips​(Player player) + throws java.lang.InterruptedException
      +
      Ask player to set position of its ships
      +
      +
      Specified by:
      +
      setShips in interface View
      +
      Overrides:
      +
      setShips in class AbstractView
      +
      Parameters:
      +
      player - player we ask
      +
      Throws:
      +
      java.lang.InterruptedException - see mouseInput(Player) and AbstractView.getDirectionFromChar()
      +
      +
      +
    • +
    • +
      +

      keyboardInput

      +
      protected java.lang.String keyboardInput() + throws java.lang.InterruptedException
      +
      ask Game.currentPlayer for keyboard input
      +
      +
      Specified by:
      +
      keyboardInput in class AbstractView
      +
      Returns:
      +
      String given by player
      +
      Throws:
      +
      java.lang.InterruptedException - throw if this Thread is interrupted while sleeping
      +
      See Also:
      +
      keyboardInput(), +Terminal.keyboardInput(), +Terminal.keyboardInputInteger()
      +
      +
      +
    • +
    • +
      +

      mouseInput

      +
      protected Pair<java.lang.Integer,​java.lang.Integer> mouseInput​(Player player) + throws java.lang.InterruptedException
      +
      ask player for mouse input
      +
      +
      Specified by:
      +
      mouseInput in class AbstractView
      +
      Parameters:
      +
      player - Game.currentPlayer
      +
      Returns:
      +
      coordinate of player opponent grid
      +
      Throws:
      +
      java.lang.InterruptedException - throw if this Thread is interrupted while sleeping
      +
      See Also:
      +
      mouseInput(Player)
      +
      +
      +
    • +
    • +
      +

      openDialog

      +
      public void openDialog​(java.lang.String message, +boolean exitOnClose)
      +
      Open a window with message as content and with a "OK" button
      +
      +
      Parameters:
      +
      message - message to display
      +
      exitOnClose - true if when user close this window, the program exit, false otherwise
      +
      +
      +
    • +
    • +
      +

      openDialog

      +
      public void openDialog​(java.lang.String message)
      +
      Open a window with message as content and with a "OK" button
      +
      +
      Parameters:
      +
      message - message to display
      +
      See Also:
      +
      openDialog(String, boolean)
      +
      +
      +
    • +
    • +
      +

      displayBoard

      +
      public void displayBoard()
      +
      refresh windows to display updated content
      +
      +
    • +
    • +
      +

      chooseMove

      +
      public Pair<java.lang.Integer,​java.lang.Integer> chooseMove​(Player player) + throws java.lang.InterruptedException
      +
      ask player to choose a position in its opponent grid
      +
      +
      Specified by:
      +
      chooseMove in interface View
      +
      Overrides:
      +
      chooseMove in class AbstractView
      +
      Parameters:
      +
      player - Game.currentPlayer
      +
      Returns:
      +
      a couple (Pair containing the x and y coordinate (left side store Y and right side X)
      +
      Throws:
      +
      java.lang.InterruptedException - see mouseInput(Player)
      +
      +
      +
    • +
    • +
      +

      displayWinner

      +
      public void displayWinner​(Player winner)
      +
      open a dialog to display the winner and exit the program when window is closed
      +
      +
      Parameters:
      +
      winner - the winner of the game.
      +
      See Also:
      +
      displayWinner(Player), +Terminal.displayWinner(Player)
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/view/WindowListener.html b/livraison/doc/battleship/view/WindowListener.html new file mode 100644 index 0000000..2040c75 --- /dev/null +++ b/livraison/doc/battleship/view/WindowListener.html @@ -0,0 +1,287 @@ + + + + + +WindowListener + + + + + + + + + + + + + + +
+ +
+
+ +
+ +

Class WindowListener

+
+
java.lang.Object +
battleship.view.WindowListener
+
+
+
+
All Implemented Interfaces:
+
java.awt.event.MouseListener, java.util.EventListener
+
+
+
public class WindowListener
+extends java.lang.Object
+implements java.awt.event.MouseListener
+
+
+
    + +
  • +
    +

    Constructor Summary

    +
    + + + + + + + + + + + + + + +
    Constructors
    ConstructorDescription
    WindowListener() 
    +
    +
    +
  • + +
  • +
    +

    Method Summary

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Modifier and TypeMethodDescription
    voidmouseClicked​(java.awt.event.MouseEvent e) 
    voidmouseEntered​(java.awt.event.MouseEvent e) 
    voidmouseExited​(java.awt.event.MouseEvent e) 
    voidmousePressed​(java.awt.event.MouseEvent e) 
    voidmouseReleased​(java.awt.event.MouseEvent e) 
    +
    +
    +
    +

    Methods inherited from class java.lang.Object

    +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +
    +
  • +
+
+
+
    + +
  • +
    +

    Constructor Details

    +
      +
    • +
      +

      WindowListener

      +
      public WindowListener()
      +
      +
    • +
    +
    +
  • + +
  • +
    +

    Method Details

    +
      +
    • +
      +

      mouseClicked

      +
      public void mouseClicked​(java.awt.event.MouseEvent e)
      +
      +
      Specified by:
      +
      mouseClicked in interface java.awt.event.MouseListener
      +
      +
      +
    • +
    • +
      +

      mousePressed

      +
      public void mousePressed​(java.awt.event.MouseEvent e)
      +
      +
      Specified by:
      +
      mousePressed in interface java.awt.event.MouseListener
      +
      +
      +
    • +
    • +
      +

      mouseReleased

      +
      public void mouseReleased​(java.awt.event.MouseEvent e)
      +
      +
      Specified by:
      +
      mouseReleased in interface java.awt.event.MouseListener
      +
      +
      +
    • +
    • +
      +

      mouseEntered

      +
      public void mouseEntered​(java.awt.event.MouseEvent e)
      +
      +
      Specified by:
      +
      mouseEntered in interface java.awt.event.MouseListener
      +
      +
      +
    • +
    • +
      +

      mouseExited

      +
      public void mouseExited​(java.awt.event.MouseEvent e)
      +
      +
      Specified by:
      +
      mouseExited in interface java.awt.event.MouseListener
      +
      +
      +
    • +
    +
    +
  • +
+
+ +
+ +
+
+ + diff --git a/livraison/doc/battleship/view/package-summary.html b/livraison/doc/battleship/view/package-summary.html new file mode 100644 index 0000000..47ebe07 --- /dev/null +++ b/livraison/doc/battleship/view/package-summary.html @@ -0,0 +1,145 @@ + + + + + +battleship.view + + + + + + + + + + + + + + +
+ +
+
+
+

Package battleship.view

+
+
+
Contains terminal and windows view classes and theirs super class and interface
+
+
+
    +
  • +
    + + + + + + + + + + + + + + +
    Interface Summary
    InterfaceDescription
    View +
    View interface, used as an API
    +
    +
    +
  • +
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Class Summary
    ClassDescription
    AbstractView +
    Abstract view class
    +
    Terminal +
    Terminal view, instanced if argument 2 equals to "nogui"
    +
    Window +
    Window view, instanced if argument 2 equals to "nogui"
    +
    WindowListener 
    +
    +
  • +
+
+
+ +
+
+ + diff --git a/livraison/doc/battleship/view/package-tree.html b/livraison/doc/battleship/view/package-tree.html new file mode 100644 index 0000000..d4dde33 --- /dev/null +++ b/livraison/doc/battleship/view/package-tree.html @@ -0,0 +1,123 @@ + + + + + +battleship.view Class Hierarchy + + + + + + + + + + + + + + +
+ +
+
+
+

Hierarchy For Package battleship.view

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • battleship.view.AbstractView (implements battleship.view.View) + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) + +
          • +
          +
        • +
        +
      • +
      +
    • +
    • battleship.view.WindowListener (implements java.awt.event.MouseListener)
    • +
    +
  • +
+
+
+

Interface Hierarchy

+
    +
  • battleship.view.View
  • +
+
+
+ +
+
+ + diff --git a/livraison/doc/constant-values.html b/livraison/doc/constant-values.html new file mode 100644 index 0000000..192bd07 --- /dev/null +++ b/livraison/doc/constant-values.html @@ -0,0 +1,117 @@ + + + + + +Constant Field Values + + + + + + + + + + + + + + +
+ +
+
+
+

Constant Field Values

+
+

Contents

+ +
+
+
+

battleship.view.*

+
    +
  • +
    + + + + + + + + + + + + + + + + + + + + + +
    battleship.view.Window
    Modifier and TypeConstant FieldValue
    public final intheight600
    public final intwidth1200
    +
    +
  • +
+
+
+ +
+
+ + diff --git a/livraison/doc/deprecated-list.html b/livraison/doc/deprecated-list.html new file mode 100644 index 0000000..3036f2c --- /dev/null +++ b/livraison/doc/deprecated-list.html @@ -0,0 +1,81 @@ + + + + + +Deprecated List + + + + + + + + + + + + + + +
+ +
+
+
+

Deprecated API

+

Contents

+
+
+ +
+
+ + diff --git a/livraison/doc/element-list b/livraison/doc/element-list new file mode 100644 index 0000000..b8f57aa --- /dev/null +++ b/livraison/doc/element-list @@ -0,0 +1,6 @@ +battleship +battleship.control +battleship.model +battleship.model.player +battleship.utils +battleship.view diff --git a/livraison/doc/help-doc.html b/livraison/doc/help-doc.html new file mode 100644 index 0000000..09e0ce0 --- /dev/null +++ b/livraison/doc/help-doc.html @@ -0,0 +1,181 @@ + + + + + +API Help + + + + + + + + + + + + + + +
+ +
+
+
+

How This API Document Is Organized

+
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
+
+
+

Overview

+

The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

+
+
+

Package

+

Each package has a page that contains a list of its classes and interfaces, with a summary for each. These pages may contain six categories:

+
    +
  • Interfaces
  • +
  • Classes
  • +
  • Enums
  • +
  • Exceptions
  • +
  • Errors
  • +
  • Annotation Types
  • +
+
+
+

Class or Interface

+

Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

+
    +
  • Class Inheritance Diagram
  • +
  • Direct Subclasses
  • +
  • All Known Subinterfaces
  • +
  • All Known Implementing Classes
  • +
  • Class or Interface Declaration
  • +
  • Class or Interface Description
  • +
+
+
    +
  • Nested Class Summary
  • +
  • Field Summary
  • +
  • Property Summary
  • +
  • Constructor Summary
  • +
  • Method Summary
  • +
+
+
    +
  • Field Details
  • +
  • Property Details
  • +
  • Constructor Details
  • +
  • Method Details
  • +
+

The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

+
+
+

Annotation Type

+

Each annotation type has its own separate page with the following sections:

+
    +
  • Annotation Type Declaration
  • +
  • Annotation Type Description
  • +
  • Required Element Summary
  • +
  • Optional Element Summary
  • +
  • Element Details
  • +
+
+
+

Enum

+

Each enum has its own separate page with the following sections:

+
    +
  • Enum Declaration
  • +
  • Enum Description
  • +
  • Enum Constant Summary
  • +
  • Enum Constant Details
  • +
+
+
+

Tree (Class Hierarchy)

+

There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. Classes are organized by inheritance structure starting with java.lang.Object. Interfaces do not inherit from java.lang.Object.

+
    +
  • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
  • +
  • When viewing a particular package, class or interface page, clicking on "Tree" displays the hierarchy for only that package.
  • +
+
+
+

Deprecated API

+

The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to shortcomings, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

+
+
+

Index

+

The Index contains an alphabetic index of all classes, interfaces, constructors, methods, and fields, as well as lists of all packages and all classes.

+
+
+

Serialized Form

+

Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to those who implement rather than use the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See Also" section of the class description.

+
+
+

Constant Field Values

+

The Constant Field Values page lists the static final fields and their values.

+
+
+

Search

+

You can search for definitions of modules, packages, types, fields, methods, system properties and other terms defined in the API, using some or all of the name, optionally using "camel-case" abbreviations. For example:

+
    +
  • j.l.obj will match "java.lang.Object"
  • +
  • InpStr will match "java.io.InputStream"
  • +
  • HM.cK will match "java.util.HashMap.containsKey(Object)"
  • +
+

Refer to the Javadoc Search Specification for a full description of search features.

+
+
+This help file applies to API documentation generated by the standard doclet.
+ +
+
+ + diff --git a/livraison/doc/index-all.html b/livraison/doc/index-all.html new file mode 100644 index 0000000..1ef3823 --- /dev/null +++ b/livraison/doc/index-all.html @@ -0,0 +1,697 @@ + + + + + +Index + + + + + + + + + + + + + + +
+ +
+
+
+

Index

+
+A B C D E F G H I K L M O P R S T U V W 
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 the AbstractPlayer.moves list
+
+
addMove(Triplet<Integer, Integer, Boolean>) - Method in interface battleship.model.player.Player
+
+
Adds coordinates of the move in the AbstractPlayer.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 is Computer + if player isn't Human 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 of Computer
+
+
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 return true if valid + false otherwise
+
+
setUpperText(String) - Method in class battleship.view.AbstractView
+
+
Display a text above the grid on Window, simply print text on Terminal
+
+
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 if player 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
+
 
+
+A B C D E F G H I K L M O P R S T U V W 
All Classes|All Packages
+ +
+
+ + diff --git a/livraison/doc/index.html b/livraison/doc/index.html new file mode 100644 index 0000000..b3c3a04 --- /dev/null +++ b/livraison/doc/index.html @@ -0,0 +1,127 @@ + + + + + +Overview + + + + + + + + + + + + + + +
+ +
+
+
BattleShip package
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Packages
PackageDescription
battleship +
Contains Main Class
+
battleship.control +
Contains keyboard and mouse listeners
+
battleship.model +
Contains all main Game classes
+
battleship.model.player +
Contains all players classes instances and theirs super classes and interface
+
battleship.utils +
Utility classes
+
battleship.view +
Contains terminal and windows view classes and theirs super class and interface
+
+
+
+ +
+
+ + diff --git a/livraison/doc/jquery-ui.overrides.css b/livraison/doc/jquery-ui.overrides.css new file mode 100644 index 0000000..1abff95 --- /dev/null +++ b/livraison/doc/jquery-ui.overrides.css @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + +.ui-state-active, +.ui-widget-content .ui-state-active, +.ui-widget-header .ui-state-active, +a.ui-button:active, +.ui-button:active, +.ui-button.ui-state-active:hover { + /* Overrides the color of selection used in jQuery UI */ + background: #F8981D; +} diff --git a/livraison/doc/member-search-index.js b/livraison/doc/member-search-index.js new file mode 100644 index 0000000..8c5ebc0 --- /dev/null +++ b/livraison/doc/member-search-index.js @@ -0,0 +1 @@ +memberSearchIndex = [{"p":"battleship.model.player","c":"AbstractPlayer","l":"AbstractPlayer()","u":"%3Cinit%3E()"},{"p":"battleship.view","c":"AbstractView","l":"AbstractView(Game)","u":"%3Cinit%3E(battleship.model.Game)"},{"p":"battleship.model.player","c":"AbstractPlayer","l":"addMove(Triplet)","u":"addMove(battleship.utils.Triplet)"},{"p":"battleship.model.player","c":"Player","l":"addMove(Triplet)","u":"addMove(battleship.utils.Triplet)"},{"p":"battleship.model.player","c":"AbstractPlayer","l":"areValid(int, int)","u":"areValid(int,int)"},{"p":"battleship.model.player","c":"Player","l":"areValid(int, int)","u":"areValid(int,int)"},{"p":"battleship.model","c":"Direction","l":"arrow"},{"p":"battleship.model","c":"Game","l":"changeCurrentPlayer()"},{"p":"battleship.model","c":"Game","l":"checkDrownedShips()"},{"p":"battleship.model.player","c":"Human","l":"chooseMove()"},{"p":"battleship.model.player","c":"Player","l":"chooseMove()"},{"p":"battleship.model.player","c":"Random","l":"chooseMove()"},{"p":"battleship.view","c":"AbstractView","l":"chooseMove(Player)","u":"chooseMove(battleship.model.player.Player)"},{"p":"battleship.view","c":"Terminal","l":"chooseMove(Player)","u":"chooseMove(battleship.model.player.Player)"},{"p":"battleship.view","c":"View","l":"chooseMove(Player)","u":"chooseMove(battleship.model.player.Player)"},{"p":"battleship.view","c":"Window","l":"chooseMove(Player)","u":"chooseMove(battleship.model.player.Player)"},{"p":"battleship.model.player","c":"Computer","l":"Computer()","u":"%3Cinit%3E()"},{"p":"battleship.model","c":"Ship","l":"coords"},{"p":"battleship.model","c":"Game","l":"currentPlayer"},{"p":"battleship.model","c":"Direction","l":"DEFAULT"},{"p":"battleship.model","c":"Direction","l":"direction"},{"p":"battleship.model","c":"Ship","l":"direction"},{"p":"battleship.model","c":"Direction","l":"Direction(Pair, String, int)","u":"%3Cinit%3E(battleship.utils.Pair,java.lang.String,int)"},{"p":"battleship.view","c":"Terminal","l":"displayBoard()"},{"p":"battleship.view","c":"View","l":"displayBoard()"},{"p":"battleship.view","c":"Window","l":"displayBoard()"},{"p":"battleship.view","c":"Terminal","l":"displayWinner(Player)","u":"displayWinner(battleship.model.player.Player)"},{"p":"battleship.view","c":"View","l":"displayWinner(Player)","u":"displayWinner(battleship.model.player.Player)"},{"p":"battleship.view","c":"Window","l":"displayWinner(Player)","u":"displayWinner(battleship.model.player.Player)"},{"p":"battleship.model","c":"Direction","l":"DOWN"},{"p":"battleship.view","c":"Window.Draw","l":"Draw(Window)","u":"%3Cinit%3E(battleship.view.Window)"},{"p":"battleship.utils","c":"Pair","l":"equals(Object)","u":"equals(java.lang.Object)"},{"p":"battleship.utils","c":"Triplet","l":"equals(Object)","u":"equals(java.lang.Object)"},{"p":"battleship.view","c":"Window","l":"frame"},{"p":"battleship.model","c":"Ship","l":"fullCoords"},{"p":"battleship","c":"Main","l":"game"},{"p":"battleship.view","c":"AbstractView","l":"game"},{"p":"battleship.model","c":"Game","l":"Game(Player[])","u":"%3Cinit%3E(battleship.model.player.Player[])"},{"p":"battleship.model","c":"Direction","l":"getArrow()"},{"p":"battleship.model","c":"Ship","l":"getCoords()"},{"p":"battleship.model","c":"Game","l":"getCurrentPlayer()"},{"p":"battleship.model","c":"Direction","l":"getDirection()"},{"p":"battleship.model","c":"Ship","l":"getDirection()"},{"p":"battleship.view","c":"AbstractView","l":"getDirectionFromChar()"},{"p":"battleship.model","c":"Ship","l":"getFullCoords()"},{"p":"battleship.model.player","c":"AbstractPlayer","l":"getId()"},{"p":"battleship.model.player","c":"Player","l":"getId()"},{"p":"battleship.view","c":"AbstractView","l":"getKeyInput()"},{"p":"battleship.view","c":"Terminal","l":"getKeyInput()"},{"p":"battleship.view","c":"Window","l":"getKeyInput()"},{"p":"battleship.model","c":"Direction","l":"getKeyword()"},{"p":"battleship.utils","c":"Pair","l":"getLeft()"},{"p":"battleship.utils","c":"Triplet","l":"getLeft()"},{"p":"battleship.utils","c":"Triplet","l":"getMiddle()"},{"p":"battleship.model.player","c":"AbstractPlayer","l":"getMoves()"},{"p":"battleship.model.player","c":"Player","l":"getMoves()"},{"p":"battleship.model","c":"Game","l":"getOtherPlayer()"},{"p":"battleship.model","c":"Game","l":"getOtherPlayer(Player)","u":"getOtherPlayer(battleship.model.player.Player)"},{"p":"battleship.utils","c":"Pair","l":"getRight()"},{"p":"battleship.utils","c":"Triplet","l":"getRight()"},{"p":"battleship.model.player","c":"AbstractPlayer","l":"getShips()"},{"p":"battleship.model.player","c":"Player","l":"getShips()"},{"p":"battleship.model","c":"Ship","l":"getSize()"},{"p":"battleship.model","c":"Game","l":"getWinner()"},{"p":"battleship.utils","c":"Pair","l":"hashCode()"},{"p":"battleship.utils","c":"Triplet","l":"hashCode()"},{"p":"battleship.view","c":"Window","l":"height"},{"p":"battleship.model.player","c":"Human","l":"Human()","u":"%3Cinit%3E()"},{"p":"battleship.model.player","c":"AbstractPlayer","l":"id"},{"p":"battleship.model","c":"Ship","l":"isDrown"},{"p":"battleship.model","c":"Ship","l":"isDrown()"},{"p":"battleship.view","c":"AbstractView","l":"isPositionDrowned(Player, Pair)","u":"isPositionDrowned(battleship.model.player.Player,battleship.utils.Pair)"},{"p":"battleship.view","c":"AbstractView","l":"isPositionDrowned(Player, Ship, Pair)","u":"isPositionDrowned(battleship.model.player.Player,battleship.model.Ship,battleship.utils.Pair)"},{"p":"battleship.view","c":"AbstractView","l":"isShipPosition(Ship, Pair)","u":"isShipPosition(battleship.model.Ship,battleship.utils.Pair)"},{"p":"battleship.view","c":"Terminal","l":"keyboardComponent"},{"p":"battleship.view","c":"Window","l":"keyboardComponent"},{"p":"battleship.control","c":"TerminalKeyboardListener","l":"keyboardInput()"},{"p":"battleship.view","c":"AbstractView","l":"keyboardInput()"},{"p":"battleship.view","c":"Terminal","l":"keyboardInput()"},{"p":"battleship.view","c":"Window","l":"keyboardInput()"},{"p":"battleship.view","c":"Terminal","l":"keyboardInputInteger()"},{"p":"battleship.control","c":"WindowKeyboardListener","l":"keyPressed(KeyEvent)","u":"keyPressed(java.awt.event.KeyEvent)"},{"p":"battleship.control","c":"WindowKeyboardListener","l":"keyReleased(KeyEvent)","u":"keyReleased(java.awt.event.KeyEvent)"},{"p":"battleship.control","c":"WindowKeyboardListener","l":"keyTyped"},{"p":"battleship.control","c":"WindowKeyboardListener","l":"keyTyped(KeyEvent)","u":"keyTyped(java.awt.event.KeyEvent)"},{"p":"battleship.control","c":"WindowKeyboardListener","l":"keyTypedArrow"},{"p":"battleship.model","c":"Direction","l":"keyword"},{"p":"battleship.control","c":"WindowMouseListener","l":"lastInput"},{"p":"battleship.utils","c":"Pair","l":"left"},{"p":"battleship.utils","c":"Triplet","l":"left"},{"p":"battleship.model","c":"Direction","l":"LEFT"},{"p":"battleship","c":"Main","l":"Main()","u":"%3Cinit%3E()"},{"p":"battleship","c":"Main","l":"main(String[])","u":"main(java.lang.String[])"},{"p":"battleship.utils","c":"Triplet","l":"middle"},{"p":"battleship.control","c":"WindowMouseListener","l":"mouseClicked(MouseEvent)","u":"mouseClicked(java.awt.event.MouseEvent)"},{"p":"battleship.view","c":"WindowListener","l":"mouseClicked(MouseEvent)","u":"mouseClicked(java.awt.event.MouseEvent)"},{"p":"battleship.view","c":"Window","l":"mouseComponent"},{"p":"battleship.control","c":"WindowMouseListener","l":"mouseEntered(MouseEvent)","u":"mouseEntered(java.awt.event.MouseEvent)"},{"p":"battleship.view","c":"WindowListener","l":"mouseEntered(MouseEvent)","u":"mouseEntered(java.awt.event.MouseEvent)"},{"p":"battleship.control","c":"WindowMouseListener","l":"mouseExited(MouseEvent)","u":"mouseExited(java.awt.event.MouseEvent)"},{"p":"battleship.view","c":"WindowListener","l":"mouseExited(MouseEvent)","u":"mouseExited(java.awt.event.MouseEvent)"},{"p":"battleship.view","c":"AbstractView","l":"mouseInput(Player)","u":"mouseInput(battleship.model.player.Player)"},{"p":"battleship.view","c":"Terminal","l":"mouseInput(Player)","u":"mouseInput(battleship.model.player.Player)"},{"p":"battleship.view","c":"Window","l":"mouseInput(Player)","u":"mouseInput(battleship.model.player.Player)"},{"p":"battleship.control","c":"WindowMouseListener","l":"mousePressed(MouseEvent)","u":"mousePressed(java.awt.event.MouseEvent)"},{"p":"battleship.view","c":"WindowListener","l":"mousePressed(MouseEvent)","u":"mousePressed(java.awt.event.MouseEvent)"},{"p":"battleship.control","c":"WindowMouseListener","l":"mouseReleased(MouseEvent)","u":"mouseReleased(java.awt.event.MouseEvent)"},{"p":"battleship.view","c":"WindowListener","l":"mouseReleased(MouseEvent)","u":"mouseReleased(java.awt.event.MouseEvent)"},{"p":"battleship.model","c":"Game","l":"move(Pair)","u":"move(battleship.utils.Pair)"},{"p":"battleship.model.player","c":"AbstractPlayer","l":"moves"},{"p":"battleship.view","c":"Window","l":"openDialog(String)","u":"openDialog(java.lang.String)"},{"p":"battleship.view","c":"Window","l":"openDialog(String, boolean)","u":"openDialog(java.lang.String,boolean)"},{"p":"battleship.view","c":"Window.Draw","l":"paintComponent(Graphics)","u":"paintComponent(java.awt.Graphics)"},{"p":"battleship.utils","c":"Pair","l":"Pair(U, K)","u":"%3Cinit%3E(U,K)"},{"p":"battleship","c":"Main","l":"parseArgs(String[])","u":"parseArgs(java.lang.String[])"},{"p":"battleship.model.player","c":"Computer","l":"placeShipRandomly()"},{"p":"battleship.model.player","c":"Human","l":"placeShips()"},{"p":"battleship.model.player","c":"Player","l":"placeShips()"},{"p":"battleship.model.player","c":"Random","l":"placeShips()"},{"p":"battleship.model","c":"Game","l":"Play(View)","u":"Play(battleship.view.View)"},{"p":"battleship.control","c":"WindowMouseListener","l":"playerIdLastInput"},{"p":"battleship.model","c":"Game","l":"players"},{"p":"battleship.model.player","c":"Random","l":"Random()","u":"%3Cinit%3E()"},{"p":"battleship.model","c":"Ship","l":"recalculateFullCoords()"},{"p":"battleship.control","c":"WindowKeyboardListener","l":"requestInput"},{"p":"battleship.control","c":"WindowMouseListener","l":"requestInput"},{"p":"battleship.utils","c":"Pair","l":"right"},{"p":"battleship.utils","c":"Triplet","l":"right"},{"p":"battleship.model","c":"Direction","l":"RIGHT"},{"p":"battleship.control","c":"TerminalKeyboardListener","l":"scanner"},{"p":"battleship.view","c":"Terminal","l":"scanner"},{"p":"battleship.model","c":"Ship","l":"setCoords(Pair)","u":"setCoords(battleship.utils.Pair)"},{"p":"battleship.model","c":"Ship","l":"setDirection(Direction)","u":"setDirection(battleship.model.Direction)"},{"p":"battleship.model","c":"Ship","l":"setDrown()"},{"p":"battleship.model.player","c":"AbstractPlayer","l":"setId(int)"},{"p":"battleship.model.player","c":"Player","l":"setId(int)"},{"p":"battleship.view","c":"AbstractView","l":"setShips(Player)","u":"setShips(battleship.model.player.Player)"},{"p":"battleship.view","c":"Terminal","l":"setShips(Player)","u":"setShips(battleship.model.player.Player)"},{"p":"battleship.view","c":"View","l":"setShips(Player)","u":"setShips(battleship.model.player.Player)"},{"p":"battleship.view","c":"Window","l":"setShips(Player)","u":"setShips(battleship.model.player.Player)"},{"p":"battleship.model.player","c":"AbstractPlayer","l":"setShips(Ship)","u":"setShips(battleship.model.Ship)"},{"p":"battleship.model.player","c":"Player","l":"setShips(Ship)","u":"setShips(battleship.model.Ship)"},{"p":"battleship.view","c":"AbstractView","l":"setUpperText(String)","u":"setUpperText(java.lang.String)"},{"p":"battleship.view","c":"Terminal","l":"setUpperText(String)","u":"setUpperText(java.lang.String)"},{"p":"battleship.view","c":"Window","l":"setUpperText(String)","u":"setUpperText(java.lang.String)"},{"p":"battleship.model","c":"Ship","l":"Ship(Pair, int, Direction)","u":"%3Cinit%3E(battleship.utils.Pair,int,battleship.model.Direction)"},{"p":"battleship.model.player","c":"AbstractPlayer","l":"ships"},{"p":"battleship.model.player","c":"Player","l":"shipSize"},{"p":"battleship.view","c":"View","l":"shipsSize"},{"p":"battleship.model","c":"Ship","l":"size"},{"p":"battleship.view","c":"Terminal","l":"Terminal(Game)","u":"%3Cinit%3E(battleship.model.Game)"},{"p":"battleship.control","c":"TerminalKeyboardListener","l":"TerminalKeyboardListener(Scanner)","u":"%3Cinit%3E(java.util.Scanner)"},{"p":"battleship.model","c":"Ship","l":"toString()"},{"p":"battleship.model.player","c":"AbstractPlayer","l":"toString()"},{"p":"battleship.utils","c":"Pair","l":"toString()"},{"p":"battleship.utils","c":"Triplet","l":"toString()"},{"p":"battleship.view","c":"AbstractView","l":"toString()"},{"p":"battleship.view","c":"AbstractView","l":"toString(boolean)"},{"p":"battleship.utils","c":"Triplet","l":"Triplet(Pair, V)","u":"%3Cinit%3E(battleship.utils.Pair,V)"},{"p":"battleship.utils","c":"Triplet","l":"Triplet(U, K, V)","u":"%3Cinit%3E(U,K,V)"},{"p":"battleship.model","c":"Direction","l":"UP"},{"p":"battleship.model","c":"Ship","l":"updateIsDrown(Player)","u":"updateIsDrown(battleship.model.player.Player)"},{"p":"battleship.view","c":"Window","l":"upperSubTitle"},{"p":"battleship.view","c":"Window","l":"upperTitle"},{"p":"battleship.model.player","c":"AbstractPlayer","l":"validMoves()"},{"p":"battleship.model.player","c":"Player","l":"validMoves()"},{"p":"battleship.model","c":"Direction","l":"valueOf(String)","u":"valueOf(java.lang.String)"},{"p":"battleship.model","c":"Direction","l":"values()"},{"p":"battleship","c":"Main","l":"view"},{"p":"battleship.view","c":"Window","l":"width"},{"p":"battleship.control","c":"WindowMouseListener","l":"window"},{"p":"battleship.view","c":"Window.Draw","l":"window"},{"p":"battleship.view","c":"Window","l":"Window(Game)","u":"%3Cinit%3E(battleship.model.Game)"},{"p":"battleship.control","c":"WindowKeyboardListener","l":"WindowKeyboardListener()","u":"%3Cinit%3E()"},{"p":"battleship.view","c":"WindowListener","l":"WindowListener()","u":"%3Cinit%3E()"},{"p":"battleship.control","c":"WindowMouseListener","l":"WindowMouseListener(Window)","u":"%3Cinit%3E(battleship.view.Window)"}];updateSearchResults(); \ No newline at end of file diff --git a/livraison/doc/module-search-index.js b/livraison/doc/module-search-index.js new file mode 100644 index 0000000..0d59754 --- /dev/null +++ b/livraison/doc/module-search-index.js @@ -0,0 +1 @@ +moduleSearchIndex = [];updateSearchResults(); \ No newline at end of file diff --git a/livraison/doc/overview-summary.html b/livraison/doc/overview-summary.html new file mode 100644 index 0000000..9ca7954 --- /dev/null +++ b/livraison/doc/overview-summary.html @@ -0,0 +1,26 @@ + + + + + +Generated Documentation (Untitled) + + + + + + + + + + +
+ +

index.html

+
+ + diff --git a/livraison/doc/overview-tree.html b/livraison/doc/overview-tree.html new file mode 100644 index 0000000..a706400 --- /dev/null +++ b/livraison/doc/overview-tree.html @@ -0,0 +1,161 @@ + + + + + +Class Hierarchy + + + + + + + + + + + + + + +
+ +
+
+
+

Hierarchy For All Packages

+Package Hierarchies: + +
+
+

Class Hierarchy

+
    +
  • java.lang.Object +
      +
    • battleship.model.player.AbstractPlayer (implements battleship.model.player.Player) +
        +
      • battleship.model.player.Computer +
          +
        • battleship.model.player.Random
        • +
        +
      • +
      • battleship.model.player.Human
      • +
      +
    • +
    • battleship.view.AbstractView (implements battleship.view.View) + +
    • +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container +
          +
        • javax.swing.JComponent (implements java.io.Serializable) +
            +
          • javax.swing.JPanel (implements javax.accessibility.Accessible) + +
          • +
          +
        • +
        +
      • +
      +
    • +
    • battleship.model.Game
    • +
    • battleship.Main
    • +
    • battleship.utils.Pair<U,​K>
    • +
    • battleship.model.Ship
    • +
    • battleship.control.TerminalKeyboardListener
    • +
    • battleship.utils.Triplet<U,​K,​V>
    • +
    • battleship.control.WindowKeyboardListener (implements java.awt.event.KeyListener)
    • +
    • battleship.view.WindowListener (implements java.awt.event.MouseListener)
    • +
    • battleship.control.WindowMouseListener (implements java.awt.event.MouseListener)
    • +
    +
  • +
+
+
+

Interface Hierarchy

+
    +
  • battleship.model.player.Player
  • +
  • battleship.view.View
  • +
+
+
+

Enum Hierarchy

+
    +
  • java.lang.Object +
      +
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.lang.constant.Constable, java.io.Serializable) + +
    • +
    +
  • +
+
+
+ +
+
+ + diff --git a/livraison/doc/package-search-index.js b/livraison/doc/package-search-index.js new file mode 100644 index 0000000..ac4ea41 --- /dev/null +++ b/livraison/doc/package-search-index.js @@ -0,0 +1 @@ +packageSearchIndex = [{"l":"All Packages","u":"allpackages-index.html"},{"l":"battleship"},{"l":"battleship.control"},{"l":"battleship.model"},{"l":"battleship.model.player"},{"l":"battleship.utils"},{"l":"battleship.view"}];updateSearchResults(); \ No newline at end of file diff --git a/livraison/doc/resources/glass.png b/livraison/doc/resources/glass.png new file mode 100644 index 0000000..a7f591f Binary files /dev/null and b/livraison/doc/resources/glass.png differ diff --git a/livraison/doc/resources/x.png b/livraison/doc/resources/x.png new file mode 100644 index 0000000..30548a7 Binary files /dev/null and b/livraison/doc/resources/x.png differ diff --git a/livraison/doc/script-dir/images/ui-bg_glass_55_fbf9ee_1x400.png b/livraison/doc/script-dir/images/ui-bg_glass_55_fbf9ee_1x400.png new file mode 100644 index 0000000..34abd18 Binary files /dev/null and b/livraison/doc/script-dir/images/ui-bg_glass_55_fbf9ee_1x400.png differ diff --git a/livraison/doc/script-dir/images/ui-bg_glass_65_dadada_1x400.png b/livraison/doc/script-dir/images/ui-bg_glass_65_dadada_1x400.png new file mode 100644 index 0000000..f058a93 Binary files /dev/null and b/livraison/doc/script-dir/images/ui-bg_glass_65_dadada_1x400.png differ diff --git a/livraison/doc/script-dir/images/ui-bg_glass_75_dadada_1x400.png b/livraison/doc/script-dir/images/ui-bg_glass_75_dadada_1x400.png new file mode 100644 index 0000000..2ce04c1 Binary files /dev/null and b/livraison/doc/script-dir/images/ui-bg_glass_75_dadada_1x400.png differ diff --git a/livraison/doc/script-dir/images/ui-bg_glass_75_e6e6e6_1x400.png b/livraison/doc/script-dir/images/ui-bg_glass_75_e6e6e6_1x400.png new file mode 100644 index 0000000..a90afb8 Binary files /dev/null and b/livraison/doc/script-dir/images/ui-bg_glass_75_e6e6e6_1x400.png differ diff --git a/livraison/doc/script-dir/images/ui-bg_glass_95_fef1ec_1x400.png b/livraison/doc/script-dir/images/ui-bg_glass_95_fef1ec_1x400.png new file mode 100644 index 0000000..dbe091f Binary files /dev/null and b/livraison/doc/script-dir/images/ui-bg_glass_95_fef1ec_1x400.png differ diff --git a/livraison/doc/script-dir/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/livraison/doc/script-dir/images/ui-bg_highlight-soft_75_cccccc_1x100.png new file mode 100644 index 0000000..5dc3593 Binary files /dev/null and b/livraison/doc/script-dir/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ diff --git a/livraison/doc/script-dir/images/ui-icons_222222_256x240.png b/livraison/doc/script-dir/images/ui-icons_222222_256x240.png new file mode 100644 index 0000000..e723e17 Binary files /dev/null and b/livraison/doc/script-dir/images/ui-icons_222222_256x240.png differ diff --git a/livraison/doc/script-dir/images/ui-icons_2e83ff_256x240.png b/livraison/doc/script-dir/images/ui-icons_2e83ff_256x240.png new file mode 100644 index 0000000..1f5f497 Binary files /dev/null and b/livraison/doc/script-dir/images/ui-icons_2e83ff_256x240.png differ diff --git a/livraison/doc/script-dir/images/ui-icons_454545_256x240.png b/livraison/doc/script-dir/images/ui-icons_454545_256x240.png new file mode 100644 index 0000000..618f5b0 Binary files /dev/null and b/livraison/doc/script-dir/images/ui-icons_454545_256x240.png differ diff --git a/livraison/doc/script-dir/images/ui-icons_888888_256x240.png b/livraison/doc/script-dir/images/ui-icons_888888_256x240.png new file mode 100644 index 0000000..ee5e33f Binary files /dev/null and b/livraison/doc/script-dir/images/ui-icons_888888_256x240.png differ diff --git a/livraison/doc/script-dir/images/ui-icons_cd0a0a_256x240.png b/livraison/doc/script-dir/images/ui-icons_cd0a0a_256x240.png new file mode 100644 index 0000000..7e8ebc1 Binary files /dev/null and b/livraison/doc/script-dir/images/ui-icons_cd0a0a_256x240.png differ diff --git a/livraison/doc/script-dir/jquery-3.5.1.min.js b/livraison/doc/script-dir/jquery-3.5.1.min.js new file mode 100644 index 0000000..b061403 --- /dev/null +++ b/livraison/doc/script-dir/jquery-3.5.1.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.5.1 | (c) JS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.5.1",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||j,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,j=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function qe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Le(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function He(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Oe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):("number"==typeof f.top&&(f.top+="px"),"number"==typeof f.left&&(f.left+="px"),c.css(f))}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=$e(y.pixelPosition,function(e,t){if(t)return t=Be(e,n),Me.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0a;a++)for(s in o[a])n=o[a][s],o[a].hasOwnProperty(s)&&void 0!==n&&(e[s]=t.isPlainObject(n)?t.isPlainObject(e[s])?t.widget.extend({},e[s],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,s){var n=s.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=i.call(arguments,1),l=this;return a?this.length||"instance"!==o?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(l=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):l=void 0:(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new s(o,this))})),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
",options:{classes:{},disabled:!1,create:null},_createWidget:function(i,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=e++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),i),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.on(h,c,r):i.on(h,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,l=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("
"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.widthi?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};h>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),l.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,l=n-r,h=r+e.collisionWidth-a-n;e.collisionWidth>a?l>0&&0>=h?(i=t.left+l+e.collisionWidth-a-n,t.left+=l-i):t.left=h>0&&0>=l?n:l>h?n+a-e.collisionWidth:n:l>0?t.left+=l:h>0?t.left-=h:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,l=n-r,h=r+e.collisionHeight-a-n;e.collisionHeight>a?l>0&&0>=h?(i=t.top+l+e.collisionHeight-a-n,t.top+=l-i):t.top=h>0&&0>=l?n:l>h?n+a-e.collisionHeight:n:l>0?t.top+=l:h>0?t.top-=h:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,l=n.isWindow?n.scrollLeft:n.offset.left,h=t.left-e.collisionPosition.marginLeft,c=h-l,u=h+e.collisionWidth-r-l,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-l,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,l=n.isWindow?n.scrollTop:n.offset.top,h=t.top-e.collisionPosition.marginTop,c=h-l,u=h+e.collisionHeight-r-l,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-l,(i>0||u>a(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.widget("ui.menu",{version:"1.12.1",defaultElement:"
    ",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(e){var i=t(e.target),s=t(t.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&s.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){if(!this.previousFilter){var i=t(e.target).closest(".ui-menu-item"),s=t(e.currentTarget);i[0]===s[0]&&(this._removeClass(s.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(e,s))}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){var i=!t.contains(this.element[0],t.ui.safeActiveElement(this.document[0]));i&&this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){var e=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),i=e.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),i.children().each(function(){var e=t(this);e.data("ui-menu-submenu-caret")&&e.remove()})},_keydown:function(e){var i,s,n,o,a=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:a=!1,s=this.previousFilter||"",o=!1,n=e.keyCode>=96&&105>=e.keyCode?""+(e.keyCode-96):String.fromCharCode(e.keyCode),clearTimeout(this.filterTimer),n===s?o=!0:n=s+n,i=this._filterMenuItems(n),i=o&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(e.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(e,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}a&&e.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i,s,n,o,a=this,r=this.options.icons.submenu,l=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),s=l.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),i=e.prev(),s=t("").data("ui-menu-submenu-caret",!0);a._addClass(s,"ui-menu-icon","ui-icon "+r),i.attr("aria-haspopup","true").prepend(s),e.attr("aria-labelledby",i.attr("id"))}),this._addClass(s,"ui-menu","ui-widget ui-widget-content ui-front"),e=l.add(this.element),i=e.find(this.options.items),i.not(".ui-menu-item").each(function(){var e=t(this);a._isDivider(e)&&a._addClass(e,"ui-menu-divider","ui-widget-content")}),n=i.not(".ui-menu-item, .ui-menu-divider"),o=n.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(n,"ui-menu-item")._addClass(o,"ui-menu-item-wrapper"),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){if("icons"===t){var i=this.element.find(".ui-menu-icon");this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)}this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t+""),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i,s,n;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children(".ui-menu-item-wrapper"),this._addClass(s,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),n=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(n,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.outerHeight(),0>n?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this._removeClass(s.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(e),void 0)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items).first())),void 0):(this.next(e),void 0)},_hasScroll:function(){return this.element.outerHeight()",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n;this.isMultiLine=o||!a&&this._isContentEditable(this.element),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,void 0;e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),void 0):(this._searchTimeout(t),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(t),this._change(t),void 0)}}),this._initSource(),this.menu=t("
      ").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,this.element[0]!==t.ui.safeActiveElement(this.document[0])&&this.element.trigger("focus")})},menufocus:function(e,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",e,{item:n})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&t.trim(s).length&&(this.liveRegion.children().hide(),t("
      ").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,i){var s=i.item.data("ui-autocomplete-item"),n=this.previous;this.element[0]!==t.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=n,this._delay(function(){this.previous=n,this.selectedItem=s})),!1!==this._trigger("select",e,{item:s})&&this._value(s.value),this.term=this._value(),this.close(e),this.selectedItem=s}}),this.liveRegion=t("
      ",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(e){var i=this.menu.element[0];return e.target===this.element[0]||e.target===i||t.contains(i,e.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){var e=this.term===this._value(),i=this.menu.element.is(":visible"),s=t.altKey||t.ctrlKey||t.metaKey||t.shiftKey;(!e||e&&!i&&!s)&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length").append(t("
      ").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[t](e),void 0):(this.search(null,e),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.children().hide(),t("
      ").text(i).appendTo(this.liveRegion))}}),t.ui.autocomplete}); \ No newline at end of file diff --git a/livraison/doc/script-dir/jquery-ui.structure.min.css b/livraison/doc/script-dir/jquery-ui.structure.min.css new file mode 100644 index 0000000..e880892 --- /dev/null +++ b/livraison/doc/script-dir/jquery-ui.structure.min.css @@ -0,0 +1,5 @@ +/*! jQuery UI - v1.12.1 - 2018-12-06 +* http://jqueryui.com +* Copyright jQuery Foundation and other contributors; Licensed MIT */ + +.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0} \ No newline at end of file diff --git a/livraison/doc/script.js b/livraison/doc/script.js new file mode 100644 index 0000000..bc21e45 --- /dev/null +++ b/livraison/doc/script.js @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + +var moduleSearchIndex; +var packageSearchIndex; +var typeSearchIndex; +var memberSearchIndex; +var tagSearchIndex; +function loadScripts(doc, tag) { + createElem(doc, tag, 'search.js'); + + createElem(doc, tag, 'module-search-index.js'); + createElem(doc, tag, 'package-search-index.js'); + createElem(doc, tag, 'type-search-index.js'); + createElem(doc, tag, 'member-search-index.js'); + createElem(doc, tag, 'tag-search-index.js'); +} + +function createElem(doc, tag, path) { + var script = doc.createElement(tag); + var scriptElement = doc.getElementsByTagName(tag)[0]; + script.src = pathtoroot + path; + scriptElement.parentNode.insertBefore(script, scriptElement); +} + +function show(type) { + count = 0; + for (var key in data) { + var row = document.getElementById(key); + if ((data[key] & type) !== 0) { + row.style.display = ''; + row.className = (count++ % 2) ? rowColor : altColor; + } + else + row.style.display = 'none'; + } + updateTabs(type); +} + +function updateTabs(type) { + var firstRow = document.getElementById(Object.keys(data)[0]); + var table = firstRow.closest('table'); + for (var value in tabs) { + var tab = document.getElementById(tabs[value][0]); + if (value == type) { + tab.className = activeTableTab; + tab.innerHTML = tabs[value][1]; + tab.setAttribute('aria-selected', true); + tab.setAttribute('tabindex',0); + table.setAttribute('aria-labelledby', tabs[value][0]); + } + else { + tab.className = tableTab; + tab.setAttribute('aria-selected', false); + tab.setAttribute('tabindex',-1); + tab.setAttribute('onclick', "show("+ value + ")"); + tab.innerHTML = tabs[value][1]; + } + } +} + +function switchTab(e) { + if (e.keyCode == 37 || e.keyCode == 38) { + $("[aria-selected=true]").prev().click().focus(); + e.preventDefault(); + } + if (e.keyCode == 39 || e.keyCode == 40) { + $("[aria-selected=true]").next().click().focus(); + e.preventDefault(); + } +} + +var updateSearchResults = function() {}; + +function indexFilesLoaded() { + return moduleSearchIndex + && packageSearchIndex + && typeSearchIndex + && memberSearchIndex + && tagSearchIndex; +} diff --git a/livraison/doc/search.js b/livraison/doc/search.js new file mode 100644 index 0000000..246cfd7 --- /dev/null +++ b/livraison/doc/search.js @@ -0,0 +1,378 @@ +/* + * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + +var noResult = {l: "No results found"}; +var loading = {l: "Loading search index..."}; +var catModules = "Modules"; +var catPackages = "Packages"; +var catTypes = "Types"; +var catMembers = "Members"; +var catSearchTags = "SearchTags"; +var highlight = "$&"; +var searchPattern = ""; +var RANKING_THRESHOLD = 2; +var NO_MATCH = 0xffff; +var MAX_RESULTS_PER_CATEGORY = 500; +var UNNAMED = ""; +function escapeHtml(str) { + return str.replace(//g, ">"); +} +function getHighlightedText(item, matcher) { + var escapedItem = escapeHtml(item); + return escapedItem.replace(matcher, highlight); +} +function getURLPrefix(ui) { + var urlPrefix=""; + var slash = "/"; + if (ui.item.category === catModules) { + return ui.item.l + slash; + } else if (ui.item.category === catPackages && ui.item.m) { + return ui.item.m + slash; + } else if (ui.item.category === catTypes || ui.item.category === catMembers) { + if (ui.item.m) { + urlPrefix = ui.item.m + slash; + } else { + $.each(packageSearchIndex, function(index, item) { + if (item.m && ui.item.p === item.l) { + urlPrefix = item.m + slash; + } + }); + } + return urlPrefix; + } + return urlPrefix; +} +function makeCamelCaseRegex(term) { + var pattern = ""; + var isWordToken = false; + term.replace(/,\s*/g, ", ").trim().split(/\s+/).forEach(function(w, index) { + if (index > 0) { + // whitespace between identifiers is significant + pattern += (isWordToken && /^\w/.test(w)) ? "\\s+" : "\\s*"; + } + var tokens = w.split(/(?=[A-Z,.()<>[\/])/); + for (var i = 0; i < tokens.length; i++) { + var s = tokens[i]; + if (s === "") { + continue; + } + pattern += $.ui.autocomplete.escapeRegex(s); + isWordToken = /\w$/.test(s); + if (isWordToken) { + pattern += "([a-z0-9_$<>\\[\\]]*?)"; + } + } + }); + return pattern; +} +function createMatcher(pattern, flags) { + var isCamelCase = /[A-Z]/.test(pattern); + return new RegExp(pattern, flags + (isCamelCase ? "" : "i")); +} +var watermark = 'Search'; +$(function() { + $("#search").val(''); + $("#search").prop("disabled", false); + $("#reset").prop("disabled", false); + $("#search").val(watermark).addClass('watermark'); + $("#search").blur(function() { + if ($(this).val().length == 0) { + $(this).val(watermark).addClass('watermark'); + } + }); + $("#search").on('click keydown paste', function() { + if ($(this).val() == watermark) { + $(this).val('').removeClass('watermark'); + } + }); + $("#reset").click(function() { + $("#search").val(''); + $("#search").focus(); + }); + $("#search").focus(); + $("#search")[0].setSelectionRange(0, 0); +}); +$.widget("custom.catcomplete", $.ui.autocomplete, { + _create: function() { + this._super(); + this.widget().menu("option", "items", "> :not(.ui-autocomplete-category)"); + }, + _renderMenu: function(ul, items) { + var rMenu = this; + var currentCategory = ""; + rMenu.menu.bindings = $(); + $.each(items, function(index, item) { + var li; + if (item.category && item.category !== currentCategory) { + ul.append("
    • " + item.category + "
    • "); + currentCategory = item.category; + } + li = rMenu._renderItemData(ul, item); + if (item.category) { + li.attr("aria-label", item.category + " : " + item.l); + li.attr("class", "result-item"); + } else { + li.attr("aria-label", item.l); + li.attr("class", "result-item"); + } + }); + }, + _renderItem: function(ul, item) { + var label = ""; + var matcher = createMatcher(escapeHtml(searchPattern), "g"); + if (item.category === catModules) { + label = getHighlightedText(item.l, matcher); + } else if (item.category === catPackages) { + label = getHighlightedText(item.l, matcher); + } else if (item.category === catTypes) { + label = (item.p && item.p !== UNNAMED) + ? getHighlightedText(item.p + "." + item.l, matcher) + : getHighlightedText(item.l, matcher); + } else if (item.category === catMembers) { + label = (item.p && item.p !== UNNAMED) + ? getHighlightedText(item.p + "." + item.c + "." + item.l, matcher) + : getHighlightedText(item.c + "." + item.l, matcher); + } else if (item.category === catSearchTags) { + label = getHighlightedText(item.l, matcher); + } else { + label = item.l; + } + var li = $("
    • ").appendTo(ul); + var div = $("
      ").appendTo(li); + if (item.category === catSearchTags) { + if (item.d) { + div.html(label + " (" + item.h + ")
      " + + item.d + "
      "); + } else { + div.html(label + " (" + item.h + ")"); + } + } else { + if (item.m) { + div.html(item.m + "/" + label); + } else { + div.html(label); + } + } + return li; + } +}); +function rankMatch(match, category) { + if (!match) { + return NO_MATCH; + } + var index = match.index; + var input = match.input; + var leftBoundaryMatch = 2; + var periferalMatch = 0; + var delta = 0; + // make sure match is anchored on a left word boundary + if (index === 0 || /\W/.test(input[index - 1]) || "_" === input[index - 1] || "_" === input[index]) { + leftBoundaryMatch = 0; + } else if (input[index] === input[index].toUpperCase() && !/^[A-Z0-9_$]+$/.test(input)) { + leftBoundaryMatch = 1; + } + var matchEnd = index + match[0].length; + var leftParen = input.indexOf("("); + // exclude peripheral matches + if (category !== catModules && category !== catSearchTags) { + var endOfName = leftParen > -1 ? leftParen : input.length; + var delim = category === catPackages ? "/" : "."; + if (leftParen > -1 && leftParen < index) { + periferalMatch += 2; + } else if (input.lastIndexOf(delim, endOfName) >= matchEnd) { + periferalMatch += 2; + } + } + for (var i = 1; i < match.length; i++) { + // lower ranking if parts of the name are missing + if (match[i]) + delta += match[i].length; + } + if (category === catTypes) { + // lower ranking if a type name contains unmatched camel-case parts + if (/[A-Z]/.test(input.substring(matchEnd))) + delta += 5; + if (/[A-Z]/.test(input.substring(0, index))) + delta += 5; + } + return leftBoundaryMatch + periferalMatch + (delta / 200); + +} +function doSearch(request, response) { + var result = []; + var newResults = []; + + searchPattern = makeCamelCaseRegex(request.term); + if (searchPattern === "") { + return this.close(); + } + var camelCaseMatcher = createMatcher(searchPattern, ""); + var boundaryMatcher = createMatcher("\\b" + searchPattern, ""); + + function concatResults(a1, a2) { + a2.sort(function(e1, e2) { + return e1.ranking - e2.ranking; + }); + a1 = a1.concat(a2.map(function(e) { return e.item; })); + a2.length = 0; + return a1; + } + + if (moduleSearchIndex) { + $.each(moduleSearchIndex, function(index, item) { + item.category = catModules; + var ranking = rankMatch(boundaryMatcher.exec(item.l), catModules); + if (ranking < RANKING_THRESHOLD) { + newResults.push({ ranking: ranking, item: item }); + } + return newResults.length < MAX_RESULTS_PER_CATEGORY; + }); + result = concatResults(result, newResults); + } + if (packageSearchIndex) { + $.each(packageSearchIndex, function(index, item) { + item.category = catPackages; + var name = (item.m && request.term.indexOf("/") > -1) + ? (item.m + "/" + item.l) + : item.l; + var ranking = rankMatch(boundaryMatcher.exec(name), catPackages); + if (ranking < RANKING_THRESHOLD) { + newResults.push({ ranking: ranking, item: item }); + } + return newResults.length < MAX_RESULTS_PER_CATEGORY; + }); + result = concatResults(result, newResults); + } + if (typeSearchIndex) { + $.each(typeSearchIndex, function(index, item) { + item.category = catTypes; + var name = request.term.indexOf(".") > -1 + ? item.p + "." + item.l + : item.l; + var ranking = rankMatch(camelCaseMatcher.exec(name), catTypes); + if (ranking < RANKING_THRESHOLD) { + newResults.push({ ranking: ranking, item: item }); + } + return newResults.length < MAX_RESULTS_PER_CATEGORY; + }); + result = concatResults(result, newResults); + } + if (memberSearchIndex) { + $.each(memberSearchIndex, function(index, item) { + item.category = catMembers; + var name = request.term.indexOf(".") > -1 + ? item.p + "." + item.c + "." + item.l + : item.l; + var ranking = rankMatch(camelCaseMatcher.exec(name), catMembers); + if (ranking < RANKING_THRESHOLD) { + newResults.push({ ranking: ranking, item: item }); + } + return newResults.length < MAX_RESULTS_PER_CATEGORY; + }); + result = concatResults(result, newResults); + } + if (tagSearchIndex) { + $.each(tagSearchIndex, function(index, item) { + item.category = catSearchTags; + var ranking = rankMatch(boundaryMatcher.exec(item.l), catSearchTags); + if (ranking < RANKING_THRESHOLD) { + newResults.push({ ranking: ranking, item: item }); + } + return newResults.length < MAX_RESULTS_PER_CATEGORY; + }); + result = concatResults(result, newResults); + } + if (!indexFilesLoaded()) { + updateSearchResults = function() { + doSearch(request, response); + } + result.unshift(loading); + } else { + updateSearchResults = function() {}; + } + response(result); +} +$(function() { + $("#search").catcomplete({ + minLength: 1, + delay: 300, + source: doSearch, + response: function(event, ui) { + if (!ui.content.length) { + ui.content.push(noResult); + } else { + $("#search").empty(); + } + }, + autoFocus: true, + focus: function(event, ui) { + return false; + }, + position: { + collision: "flip" + }, + select: function(event, ui) { + if (ui.item.category) { + var url = getURLPrefix(ui); + if (ui.item.category === catModules) { + url += "module-summary.html"; + } else if (ui.item.category === catPackages) { + if (ui.item.u) { + url = ui.item.u; + } else { + url += ui.item.l.replace(/\./g, '/') + "/package-summary.html"; + } + } else if (ui.item.category === catTypes) { + if (ui.item.u) { + url = ui.item.u; + } else if (ui.item.p === UNNAMED) { + url += ui.item.l + ".html"; + } else { + url += ui.item.p.replace(/\./g, '/') + "/" + ui.item.l + ".html"; + } + } else if (ui.item.category === catMembers) { + if (ui.item.p === UNNAMED) { + url += ui.item.c + ".html" + "#"; + } else { + url += ui.item.p.replace(/\./g, '/') + "/" + ui.item.c + ".html" + "#"; + } + if (ui.item.u) { + url += ui.item.u; + } else { + url += ui.item.l; + } + } else if (ui.item.category === catSearchTags) { + url += ui.item.u; + } + if (top !== window) { + parent.classFrame.location = pathtoroot + url; + } else { + window.location.href = pathtoroot + url; + } + $("#search").focus(); + } + } + }); +}); diff --git a/livraison/doc/stylesheet.css b/livraison/doc/stylesheet.css new file mode 100644 index 0000000..79a9d97 --- /dev/null +++ b/livraison/doc/stylesheet.css @@ -0,0 +1,792 @@ +/* + * Javadoc style sheet + */ + +@import url('resources/fonts/dejavu.css'); + +/* + * Styles for individual HTML elements. + * + * These are styles that are specific to individual HTML elements. Changing them affects the style of a particular + * HTML element throughout the page. + */ + +body { + background-color:#ffffff; + color:#353833; + font-family:'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:14px; + margin:0; + padding:0; + height:100%; + width:100%; +} +iframe { + margin:0; + padding:0; + height:100%; + width:100%; + overflow-y:scroll; + border:none; +} +a:link, a:visited { + text-decoration:none; + color:#4A6782; +} +a[href]:hover, a[href]:focus { + text-decoration:none; + color:#bb7a2a; +} +a[name] { + color:#353833; +} +pre { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; +} +h1 { + font-size:20px; +} +h2 { + font-size:18px; +} +h3 { + font-size:16px; +} +h4 { + font-size:13px; +} +h5 { + font-size:12px; +} +h6 { + font-size:11px; +} +ul { + list-style-type:disc; +} +code, tt { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; + margin-top:8px; + line-height:1.4em; +} +dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + padding-top:4px; +} +table tr td dt code { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + vertical-align:top; + padding-top:4px; +} +sup { + font-size:8px; +} +button { + font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size: 14px; +} +/* + * Styles for HTML generated by javadoc. + * + * These are style classes that are used by the standard doclet to generate HTML documentation. + */ + +/* + * Styles for document title and copyright. + */ +.clear { + clear:both; + height:0px; + overflow:hidden; +} +.about-language { + float:right; + padding:0px 21px; + font-size:11px; + z-index:200; + margin-top:-9px; +} +.legal-copy { + margin-left:.5em; +} +.tab { + background-color:#0066FF; + color:#ffffff; + padding:8px; + width:5em; + font-weight:bold; +} +/* + * Styles for navigation bar. + */ +@media screen { + .flex-box { + position:fixed; + display:flex; + flex-direction:column; + height: 100%; + width: 100%; + } + .flex-header { + flex: 0 0 auto; + } + .flex-content { + flex: 1 1 auto; + overflow-y: auto; + } +} +.top-nav { + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.bottom-nav { + margin-top:10px; + background-color:#4D7A97; + color:#FFFFFF; + float:left; + padding:0; + width:100%; + clear:right; + height:2.8em; + padding-top:10px; + overflow:hidden; + font-size:12px; +} +.sub-nav { + background-color:#dee3e9; + float:left; + width:100%; + overflow:hidden; + font-size:12px; +} +.sub-nav div { + clear:left; + float:left; + padding:0 0 5px 6px; + text-transform:uppercase; +} +.sub-nav .nav-list { + padding-top:5px; +} +ul.nav-list, ul.sub-nav-list { + float:left; + margin:0 25px 0 0; + padding:0; +} +ul.nav-list li{ + list-style:none; + float:left; + padding: 5px 6px; + text-transform:uppercase; +} +.sub-nav .nav-list-search { + float:right; + margin:0 0 0 0; + padding:5px 6px; + clear:none; +} +.nav-list-search label { + position:relative; + right:-16px; +} +ul.sub-nav-list li { + list-style:none; + float:left; + padding-top:10px; +} +.top-nav a:link, .top-nav a:active, .top-nav a:visited, .bottom-nav a:link, .bottom-nav a:active, .bottom-nav a:visited { + color:#FFFFFF; + text-decoration:none; + text-transform:uppercase; +} +.top-nav a:hover, .bottom-nav a:hover { + text-decoration:none; + color:#bb7a2a; + text-transform:uppercase; +} +.nav-bar-cell1-rev { + background-color:#F8981D; + color:#253441; + margin: auto 5px; +} +.skip-nav { + position:absolute; + top:auto; + left:-9999px; + overflow:hidden; +} +/* + * Hide navigation links and search box in print layout + */ +@media print { + ul.nav-list, div.sub-nav { + display:none; + } +} +/* + * Styles for page header and footer. + */ +.title { + color:#2c4557; + margin:10px 0; +} +.sub-title { + margin:5px 0 0 0; +} +.header ul { + margin:0 0 15px 0; + padding:0; +} +.header ul li, .footer ul li { + list-style:none; + font-size:13px; +} +/* + * Styles for headings. + */ +body.class-declaration-page .summary h2, +body.class-declaration-page .details h2, +body.class-use-page h2, +body.module-declaration-page .block-list h2 { + font-style: italic; + padding:0; + margin:15px 0; +} +body.class-declaration-page .summary h3, +body.class-declaration-page .details h3, +body.class-declaration-page .summary .inherited-list h2 { + background-color:#dee3e9; + border:1px solid #d0d9e0; + margin:0 0 6px -8px; + padding:7px 5px; +} +/* + * Styles for page layout containers. + */ +main { + clear:both; + padding:10px 20px; + position:relative; +} +dl.notes > dt { + font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; + font-size:12px; + font-weight:bold; + margin:10px 0 0 0; + color:#4E4E4E; +} +dl.notes > dd { + margin:5px 0 10px 0px; + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} +dl.name-value > dt { + margin-left:1px; + font-size:1.1em; + display:inline; + font-weight:bold; +} +dl.name-value > dd { + margin:0 0 0 1px; + font-size:1.1em; + display:inline; +} +/* + * Styles for lists. + */ +li.circle { + list-style:circle; +} +ul.horizontal li { + display:inline; + font-size:0.9em; +} +div.inheritance { + margin:0; + padding:0; +} +div.inheritance div.inheritance { + margin-left:2em; +} +ul.block-list, +ul.details-list, +ul.member-list, +ul.summary-list { + margin:10px 0 10px 0; + padding:0; +} +ul.block-list > li, +ul.details-list > li, +ul.member-list > li, +ul.summary-list > li { + list-style:none; + margin-bottom:15px; + line-height:1.4; +} +table tr td dl, table tr td dl dt, table tr td dl dd { + margin-top:0; + margin-bottom:1px; +} +/* + * Styles for tables. + */ +.overview-summary table, .member-summary table, .type-summary table, .use-summary table, .constants-summary table, .deprecated-summary table, +.requires-summary table, .packages-summary table, .provides-summary table, .uses-summary table, .system-properties-summary table { + width:100%; + border-spacing:0; + border-left:1px solid #EEE; + border-right:1px solid #EEE; + border-bottom:1px solid #EEE; +} +.overview-summary table, .member-summary table, .requires-summary table, .packages-summary table, +.provides-summary table, .uses-summary table, .system-properties-summary table { + padding:0px; +} +.overview-summary caption, .member-summary caption, .type-summary caption, +.use-summary caption, .constants-summary caption, .deprecated-summary caption, +.requires-summary caption, .packages-summary caption, .provides-summary caption, +.uses-summary caption, .system-properties-summary caption { + position:relative; + text-align:left; + background-repeat:no-repeat; + color:#253441; + font-weight:bold; + clear:none; + overflow:hidden; + padding:0px; + padding-top:10px; + padding-left:1px; + margin:0px; + white-space:pre; +} +.constants-summary caption a:link, .constants-summary caption a:visited, +.use-summary caption a:link, .use-summary caption a:visited { + color:#1f389c; +} +.overview-summary caption a:link, .member-summary caption a:link, .type-summary caption a:link, +.deprecated-summary caption a:link, +.requires-summary caption a:link, .packages-summary caption a:link, .provides-summary caption a:link, +.uses-summary caption a:link, +.overview-summary caption a:hover, .member-summary caption a:hover, .type-summary caption a:hover, +.use-summary caption a:hover, .constants-summary caption a:hover, .deprecated-summary caption a:hover, +.requires-summary caption a:hover, .packages-summary caption a:hover, .provides-summary caption a:hover, +.uses-summary caption a:hover, +.overview-summary caption a:active, .member-summary caption a:active, .type-summary caption a:active, +.use-summary caption a:active, .constants-summary caption a:active, .deprecated-summary caption a:active, +.requires-summary caption a:active, .packages-summary caption a:active, .provides-summary caption a:active, +.uses-summary caption a:active, +.overview-summary caption a:visited, .member-summary caption a:visited, .type-summary caption a:visited, +.deprecated-summary caption a:visited, +.requires-summary caption a:visited, .packages-summary caption a:visited, .provides-summary caption a:visited, +.uses-summary caption a:visited { + color:#FFFFFF; +} +.overview-summary caption span, .member-summary caption span, .type-summary caption span, +.use-summary caption span, .constants-summary caption span, .deprecated-summary caption span, +.requires-summary caption span, .packages-summary caption span, .provides-summary caption span, +.uses-summary caption span, .system-properties-summary caption span { + white-space:nowrap; + padding-top:5px; + padding-left:12px; + padding-right:12px; + padding-bottom:7px; + display:inline-block; + float:left; + background-color:#F8981D; + border: none; + height:16px; +} + +div.table-tabs > button { + border: none; + cursor: pointer; + padding: 5px 12px 7px 12px; + font-weight: bold; + margin-right: 3px; +} +div.table-tabs > button.active-table-tab { + background: #F8981D; + color: #253441; +} +div.table-tabs > button.table-tab { + background: #4D7A97; + color: #FFFFFF; +} + +.row-color th, +.alt-color th { + font-weight:normal; +} +.overview-summary td, .member-summary td, .type-summary td, +.use-summary td, .constants-summary td, .deprecated-summary td, +.requires-summary td, .packages-summary td, .provides-summary td, +.uses-summary td, .system-properties-summary td { + text-align:left; + padding:0px 0px 12px 10px; +} +th.col-first, th.col-second, th.col-last, th.col-constructor-name, th.col-deprecated-item-name, .use-summary th, +.constants-summary th, .packages-summary th, td.col-first, td.col-second, td.col-last, .use-summary td, +.constants-summary td, .system-properties-summary th { + vertical-align:top; + padding-right:0px; + padding-top:8px; + padding-bottom:3px; +} +th.col-first, th.col-second, th.col-last, th.col-constructor-name, th.col-deprecated-item-name, .constants-summary th, +.packages-summary th { + background:#dee3e9; + text-align:left; + padding:8px 3px 3px 7px; +} +td.col-first, th.col-first { + font-size:13px; +} +td.col-second, th.col-second, td.col-last, th.col-constructor-name, th.col-deprecated-item-name, th.col-last { + font-size:13px; +} +.constants-summary th, .packages-summary th { + font-size:13px; +} +.provides-summary th.col-first, .provides-summary th.col-last, .provides-summary td.col-first, +.provides-summary td.col-last { + white-space:normal; + font-size:13px; +} +.overview-summary td.col-first, .overview-summary th.col-first, +.requires-summary td.col-first, .requires-summary th.col-first, +.packages-summary td.col-first, .packages-summary td.col-second, .packages-summary th.col-first, .packages-summary th, +.uses-summary td.col-first, .uses-summary th.col-first, +.provides-summary td.col-first, .provides-summary th.col-first, +.member-summary td.col-first, .member-summary th.col-first, +.member-summary td.col-second, .member-summary th.col-second, .member-summary th.col-constructor-name, +.type-summary td.col-first, .type-summary th.col-first { + vertical-align:top; +} +.packages-summary th.col-last, .packages-summary td.col-last { + white-space:normal; +} +td.col-first a:link, td.col-first a:visited, +td.col-second a:link, td.col-second a:visited, +th.col-first a:link, th.col-first a:visited, +th.col-second a:link, th.col-second a:visited, +th.col-constructor-name a:link, th.col-constructor-name a:visited, +th.col-deprecated-item-name a:link, th.col-deprecated-item-name a:visited, +.constant-values-container td a:link, .constant-values-container td a:visited, +.all-classes-container td a:link, .all-classes-container td a:visited, +.all-packages-container td a:link, .all-packages-container td a:visited { + font-weight:bold; +} +.table-sub-heading-color { + background-color:#EEEEFF; +} +.alt-color, .alt-color th { + background-color:#FFFFFF; +} +.row-color, .row-color th { + background-color:#EEEEEF; +} +/* + * Styles for contents. + */ +.description pre { + margin-top:0; +} +.deprecated-content { + margin:0; + padding:10px 0; +} +div.block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; +} +td.col-last div { + padding-top:0px; +} +td.col-last a { + padding-bottom:3px; +} +div.member-signature { + font-family:'DejaVu Sans Mono', monospace; + font-size:14px; + margin:14px 0; + white-space: pre-wrap; +} +div.member-signature span.annotations { + white-space: pre-wrap; +} +div.member-signature span.type-parameters-long, +div.member-signature span.parameters, +div.member-signature span.exceptions { + display: inline-block; + vertical-align: top; + white-space: pre; +} +div.member-signature span.type-parameters { + white-space: normal; +} +/* + * Styles for formatting effect. + */ +.source-line-no { + color:green; + padding:0 30px 0 0; +} +h1.hidden { + visibility:hidden; + overflow:hidden; + font-size:10px; +} +.block { + display:block; + margin:0 10px 5px 0; + color:#474747; +} +.deprecated-label, .descfrm-type-label, .implementation-label, .member-name-label, .member-name-link, +.module-label-in-package, .module-label-in-type, .override-specify-label, .package-label-in-type, +.package-hierarchy-label, .type-name-label, .type-name-link, .search-tag-link { + font-weight:bold; +} +.deprecation-comment, .help-footnote, .interface-name { + font-style:italic; +} +.deprecation-block { + font-size:14px; + font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif; + border-style:solid; + border-width:thin; + border-radius:10px; + padding:10px; + margin-bottom:10px; + margin-right:10px; + display:inline-block; +} +div.block div.deprecation-comment, div.block div.block span.emphasized-phrase, +div.block div.block span.interface-name { + font-style:normal; +} +/* + * Styles specific to HTML5 elements. + */ +main, nav, header, footer, section { + display:block; +} +/* + * Styles for javadoc search. + */ +.ui-autocomplete-category { + font-weight:bold; + font-size:15px; + padding:7px 0 7px 3px; + background-color:#4D7A97; + color:#FFFFFF; +} +.result-item { + font-size:13px; +} +.ui-autocomplete { + max-height:85%; + max-width:65%; + overflow-y:scroll; + overflow-x:scroll; + white-space:nowrap; + box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); +} +ul.ui-autocomplete { + position:fixed; + z-index:999999; +} +ul.ui-autocomplete li { + float:left; + clear:both; + width:100%; +} +.result-highlight { + font-weight:bold; +} +#search { + background-image:url('resources/glass.png'); + background-size:13px; + background-repeat:no-repeat; + background-position:2px 3px; + padding-left:20px; + position:relative; + right:-18px; + width:400px; +} +#reset { + background-color: rgb(255,255,255); + background-image:url('resources/x.png'); + background-position:center; + background-repeat:no-repeat; + background-size:12px; + border:0 none; + width:16px; + height:16px; + position:relative; + left:-4px; + top:-4px; + font-size:0px; +} +.watermark { + color:#545454; +} +.search-tag-desc-result { + font-style:italic; + font-size:11px; +} +.search-tag-holder-result { + font-style:italic; + font-size:12px; +} +.search-tag-result:target { + background-color:yellow; +} +.module-graph span { + display:none; + position:absolute; +} +.module-graph:hover span { + display:block; + margin: -100px 0 0 100px; + z-index: 1; +} +.inherited-list { + margin: 10px 0 10px 0; +} +section.description { + line-height: 1.4; +} +.summary section[class$="-summary"], .details section[class$="-details"], +.class-uses .detail, .serialized-class-details { + padding: 0px 20px 5px 10px; + border: 1px solid #ededed; + background-color: #f8f8f8; +} +.inherited-list, section[class$="-details"] .detail { + padding:0 0 5px 8px; + background-color:#ffffff; + border:none; +} +.vertical-separator { + padding: 0 5px; +} +ul.help-section-list { + margin: 0; +} +/* + * Indicator icon for external links. + */ +main a[href*="://"]::after { + content:""; + display:inline-block; + background-image:url('data:image/svg+xml; utf8, \ + \ + \ + '); + background-size:100% 100%; + width:7px; + height:7px; + margin-left:2px; + margin-bottom:4px; +} +main a[href*="://"]:hover::after, +main a[href*="://"]:focus::after { + background-image:url('data:image/svg+xml; utf8, \ + \ + \ + '); +} + +/* + * Styles for user-provided tables. + * + * borderless: + * No borders, vertical margins, styled caption. + * This style is provided for use with existing doc comments. + * In general, borderless tables should not be used for layout purposes. + * + * plain: + * Plain borders around table and cells, vertical margins, styled caption. + * Best for small tables or for complex tables for tables with cells that span + * rows and columns, when the "striped" style does not work well. + * + * striped: + * Borders around the table and vertical borders between cells, striped rows, + * vertical margins, styled caption. + * Best for tables that have a header row, and a body containing a series of simple rows. + */ + +table.borderless, +table.plain, +table.striped { + margin-top: 10px; + margin-bottom: 10px; +} +table.borderless > caption, +table.plain > caption, +table.striped > caption { + font-weight: bold; + font-size: smaller; +} +table.borderless th, table.borderless td, +table.plain th, table.plain td, +table.striped th, table.striped td { + padding: 2px 5px; +} +table.borderless, +table.borderless > thead > tr > th, table.borderless > tbody > tr > th, table.borderless > tr > th, +table.borderless > thead > tr > td, table.borderless > tbody > tr > td, table.borderless > tr > td { + border: none; +} +table.borderless > thead > tr, table.borderless > tbody > tr, table.borderless > tr { + background-color: transparent; +} +table.plain { + border-collapse: collapse; + border: 1px solid black; +} +table.plain > thead > tr, table.plain > tbody tr, table.plain > tr { + background-color: transparent; +} +table.plain > thead > tr > th, table.plain > tbody > tr > th, table.plain > tr > th, +table.plain > thead > tr > td, table.plain > tbody > tr > td, table.plain > tr > td { + border: 1px solid black; +} +table.striped { + border-collapse: collapse; + border: 1px solid black; +} +table.striped > thead { + background-color: #E3E3E3; +} +table.striped > thead > tr > th, table.striped > thead > tr > td { + border: 1px solid black; +} +table.striped > tbody > tr:nth-child(even) { + background-color: #EEE +} +table.striped > tbody > tr:nth-child(odd) { + background-color: #FFF +} +table.striped > tbody > tr > th, table.striped > tbody > tr > td { + border-left: 1px solid black; + border-right: 1px solid black; +} +table.striped > tbody > tr > th { + font-weight: normal; +} diff --git a/livraison/doc/tag-search-index.js b/livraison/doc/tag-search-index.js new file mode 100644 index 0000000..0367dae --- /dev/null +++ b/livraison/doc/tag-search-index.js @@ -0,0 +1 @@ +tagSearchIndex = [];updateSearchResults(); \ No newline at end of file diff --git a/livraison/doc/type-search-index.js b/livraison/doc/type-search-index.js new file mode 100644 index 0000000..d394da7 --- /dev/null +++ b/livraison/doc/type-search-index.js @@ -0,0 +1 @@ +typeSearchIndex = [{"p":"battleship.model.player","l":"AbstractPlayer"},{"p":"battleship.view","l":"AbstractView"},{"l":"All Classes","u":"allclasses-index.html"},{"p":"battleship.model.player","l":"Computer"},{"p":"battleship.model","l":"Direction"},{"p":"battleship.view","l":"Window.Draw"},{"p":"battleship.model","l":"Game"},{"p":"battleship.model.player","l":"Human"},{"p":"battleship","l":"Main"},{"p":"battleship.utils","l":"Pair"},{"p":"battleship.model.player","l":"Player"},{"p":"battleship.model.player","l":"Random"},{"p":"battleship.model","l":"Ship"},{"p":"battleship.view","l":"Terminal"},{"p":"battleship.control","l":"TerminalKeyboardListener"},{"p":"battleship.utils","l":"Triplet"},{"p":"battleship.view","l":"View"},{"p":"battleship.view","l":"Window"},{"p":"battleship.control","l":"WindowKeyboardListener"},{"p":"battleship.view","l":"WindowListener"},{"p":"battleship.control","l":"WindowMouseListener"}];updateSearchResults(); \ No newline at end of file diff --git a/livraison/rapport/rapport.pdf b/livraison/rapport/rapport.pdf new file mode 100644 index 0000000..1d8ef8f Binary files /dev/null and b/livraison/rapport/rapport.pdf differ diff --git a/livraison/src/battleship/Main.java b/livraison/src/battleship/Main.java new file mode 100644 index 0000000..76f53b6 --- /dev/null +++ b/livraison/src/battleship/Main.java @@ -0,0 +1,86 @@ +package battleship; + +import battleship.model.Game; +import battleship.model.player.AbstractPlayer; +import battleship.model.player.Human; +import battleship.model.player.Player; +import battleship.model.player.Random; +import battleship.utils.Pair; +import battleship.view.Terminal; +import battleship.view.View; +import battleship.view.Window; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.NoSuchElementException; + +/** + * Main class + * Given arguments are importants, please give attention to {@link Main#parseArgs(String[])} about this + */ +public class Main { + + public static View view; + public static Game game; + + public static void main(String[] args) { + try { + parseArgs(args); + } catch (NoSuchElementException e) { + System.out.println("Pas assez d'arguments, veuillez donner des arguments de cette forme:"); + System.out.println("java -jar battleship [nogui]"); + System.out.println(": paramètre obligatoire"); + System.out.println("[param]: paramètre optionnel"); + System.exit(2); + } catch (InstantiationException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { + e.printStackTrace(); + System.exit(1); + } + game.Play(view); + } + + /** + *

      Read and parse launch arguments.
      + * launch arguments need to follow this syntax:

      + *

      {@code [nogui]}

      + *

      <arg> -> mandatory parameter
      + * [arg] -> optional parameter
      + * player_instance values are: "Human" or "Random"
      + * nogui to launch the game in terminal or nothing to launch in graphical interface

      + * @param args launch arguments + * @throws NoSuchMethodException reflect exception + * @throws IllegalAccessException reflect exception + * @throws InvocationTargetException reflect exception + * @throws InstantiationException reflect exception + */ + private static void parseArgs(String[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { + Player[] players = new Player[2]; + ArrayList>> playerClass = new ArrayList<>(2); + playerClass.add(new Pair<>("human", Human.class)); + playerClass.add(new Pair<>("random", Random.class)); + if(args.length >= 2) { + for(int i = 0; i < 2; ++i) { + for (Pair> pair : playerClass) { + if(args[i].equalsIgnoreCase(pair.getLeft())) { + players[i] = pair.getRight().getDeclaredConstructor().newInstance(); + } + } + } + if(players[0] != null && players[1] != null) { + game = new Game(players); + } else + throw new IllegalArgumentException("Arguments incorrects: " + Arrays.toString(args)); + if(args.length >= 3) { + // arguments > 3 ignorés + if(args[2].equalsIgnoreCase("nogui")) + view = new Terminal(game); + else + view = new Window(game); + } else { + view = new Window(game); + } + } else + throw new NoSuchElementException("Pas assez d'arguments"); + } +} diff --git a/livraison/src/battleship/control/TerminalKeyboardListener.java b/livraison/src/battleship/control/TerminalKeyboardListener.java new file mode 100644 index 0000000..00e56fa --- /dev/null +++ b/livraison/src/battleship/control/TerminalKeyboardListener.java @@ -0,0 +1,16 @@ +package battleship.control; + +import java.util.Scanner; + +public class TerminalKeyboardListener { + + private final Scanner scanner; + + public TerminalKeyboardListener(Scanner scanner) { + this.scanner = scanner; + } + + public String keyboardInput() { + return scanner.next(); + } +} diff --git a/livraison/src/battleship/control/WindowKeyboardListener.java b/livraison/src/battleship/control/WindowKeyboardListener.java new file mode 100644 index 0000000..04555a9 --- /dev/null +++ b/livraison/src/battleship/control/WindowKeyboardListener.java @@ -0,0 +1,34 @@ +package battleship.control; + +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; + +public class WindowKeyboardListener implements KeyListener { + + public boolean requestInput = false; + public char keyTyped = KeyEvent.CHAR_UNDEFINED; + public int keyTypedArrow = KeyEvent.VK_UNDEFINED; + + @Override + public void keyTyped(KeyEvent e) { + if(requestInput) { + if(e.getKeyChar() != KeyEvent.CHAR_UNDEFINED) + keyTyped = e.getKeyChar(); + if(e.getKeyCode() != KeyEvent.VK_UNDEFINED) { + System.out.println(e.getKeyCode()); + keyTypedArrow = e.getKeyCode(); + } + + } + } + + @Override + public void keyPressed(KeyEvent e) { + + } + + @Override + public void keyReleased(KeyEvent e) { + + } +} diff --git a/livraison/src/battleship/control/WindowMouseListener.java b/livraison/src/battleship/control/WindowMouseListener.java new file mode 100644 index 0000000..4b1c140 --- /dev/null +++ b/livraison/src/battleship/control/WindowMouseListener.java @@ -0,0 +1,58 @@ +package battleship.control; + +import battleship.utils.Pair; +import battleship.view.Window; + +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +public class WindowMouseListener implements MouseListener { + + private final Window window; + public boolean requestInput = false; + public Pair lastInput = null; + public int playerIdLastInput = 0; + + public WindowMouseListener(Window view) { + this.window = view; + } + + @Override + public void mouseClicked(MouseEvent e) { + if(requestInput) { + int x = e.getX() - 7; + int y = e.getY() - 30; + int initialHeight = window.height / 12; + int initialWidth = window.width / 23; + if(y >= initialHeight * 2 && y <= window.height) { + y -= initialHeight * 2; + if(x >= initialWidth && x <= initialWidth * 11) { + x -= initialWidth; + lastInput = new Pair<>((y + 2) / initialHeight, (x + 2) / initialWidth); + playerIdLastInput = 1; + } else if(x >= initialHeight * 13 && x <= window.width) { + x -= initialWidth * 13; + lastInput = new Pair<>((y + 2) / initialHeight, (x + 2) / initialWidth); + playerIdLastInput = 2; + } + } + } + } + + @Override + public void mousePressed(MouseEvent e) { + + } + + @Override + public void mouseReleased(MouseEvent e) { + + } + + @Override + public void mouseEntered(MouseEvent ignored) {} + + @Override + public void mouseExited(MouseEvent ignored) {} + +} diff --git a/livraison/src/battleship/control/package-info.java b/livraison/src/battleship/control/package-info.java new file mode 100644 index 0000000..c1cc5f0 --- /dev/null +++ b/livraison/src/battleship/control/package-info.java @@ -0,0 +1,4 @@ +/** + * Contains keyboard and mouse listeners + */ +package battleship.control; \ No newline at end of file diff --git a/livraison/src/battleship/model/Direction.java b/livraison/src/battleship/model/Direction.java new file mode 100644 index 0000000..f9b63fd --- /dev/null +++ b/livraison/src/battleship/model/Direction.java @@ -0,0 +1,36 @@ +package battleship.model; + +import battleship.utils.Pair; + +import java.awt.event.KeyEvent; + +public enum Direction { + + RIGHT(new Pair<>(0, 1), "D", KeyEvent.VK_RIGHT), + LEFT(new Pair<>(0,-1), "G", KeyEvent.VK_LEFT), + UP(new Pair<>(-1,0), "H", KeyEvent.VK_UP), + DOWN(new Pair<>(1,0), "B", KeyEvent.VK_DOWN), + DEFAULT(new Pair<>(-1,-1), null, KeyEvent.VK_UNDEFINED); + + private final Pair direction; + private final String keyword; + private final int arrow; + + Direction(Pair ukPair, String keyword, int arrow) { + this.direction = ukPair; + this.keyword = keyword; + this.arrow = arrow; + } + + public Pair getDirection() { + return direction; + } + + public String getKeyword() { + return keyword; + } + + public int getArrow() { + return arrow; + } +} diff --git a/livraison/src/battleship/model/Game.java b/livraison/src/battleship/model/Game.java new file mode 100644 index 0000000..a0d52a6 --- /dev/null +++ b/livraison/src/battleship/model/Game.java @@ -0,0 +1,111 @@ +package battleship.model; + +import battleship.model.player.Player; +import battleship.utils.Pair; +import battleship.utils.Triplet; +import battleship.view.View; + +/** + * Main game class + */ +public class Game { + + public final Player[] players; + public Player currentPlayer; + + public Game(Player[] players) { + this.players = players; + this.currentPlayer = players[0]; + players[0].setId(1); + players[1].setId(2); + } + + public Player getCurrentPlayer(){ + return this.currentPlayer; + } + + public Player getOtherPlayer() { + return this.currentPlayer == players[0] ? players[1] : players[0]; + } + + public Player getOtherPlayer(Player player) { + return this.currentPlayer == player ? getOtherPlayer() : currentPlayer; + } + + public void changeCurrentPlayer(){ + currentPlayer = getOtherPlayer(); + } + + /** + * Update ship to know if they're drowned + */ + public void checkDrownedShips(){ + Player otherPlayer = getOtherPlayer(); + for(Ship ship : otherPlayer.getShips()){ + if(!ship.isDrown()) + ship.updateIsDrown(currentPlayer); + } + } + + /** + * @return player 1 if player 2' ships are drowned, or player 2 if player1' ships are drowned, null otherwise + */ + public Player getWinner(){ + Ship remainingShip = players[0].getShips().parallelStream().filter(ship -> !ship.isDrown()).findFirst().orElse(null); + if(remainingShip == null) + return players[1]; + remainingShip = players[1].getShips().parallelStream().filter(ship -> !ship.isDrown()).findFirst().orElse(null); + if(remainingShip == null) + return players[0]; + return null; + + } + + /** + * Play the selected move from current player in grid + * @param move selected player move + */ + public void move(Pair move){ + boolean bool = false; + Player otherPlayer = getOtherPlayer(); + for (Ship ship : otherPlayer.getShips()) { + for(Pair coords : ship.getFullCoords()){ + if ((coords.getRight().equals(move.getRight())) && (coords.getLeft().equals(move.getLeft()))) { + bool = true; + break; + } + } + if(bool) + break; + } + currentPlayer.addMove(new Triplet<>(move, bool)); + } + + /** + * game loop + * @param view can be {@link battleship.view.Terminal} or {@link battleship.view.Window} + */ + public void Play(View view) { + try { + view.setShips(players[0]); + changeCurrentPlayer(); + view.setShips(players[1]); + changeCurrentPlayer(); + Player winner = null; + while (winner == null) { + System.out.println("Au tour du joueur " + currentPlayer.getId()); + view.displayBoard(); + move(view.chooseMove(currentPlayer)); + checkDrownedShips(); + changeCurrentPlayer(); + winner = getWinner(); + } + view.displayWinner(winner); + } catch (InterruptedException e) { + System.out.println("Une erreur est survenue"); + e.printStackTrace(); + System.exit(1); + } + + } +} diff --git a/livraison/src/battleship/model/Ship.java b/livraison/src/battleship/model/Ship.java new file mode 100644 index 0000000..00fcf76 --- /dev/null +++ b/livraison/src/battleship/model/Ship.java @@ -0,0 +1,107 @@ +package battleship.model; + +import battleship.model.player.Player; +import battleship.utils.Pair; +import battleship.utils.Triplet; + +/** + * player's ship class + */ +public class Ship { + + /** + * base coordinates of the ship + */ + private Pair coords; + /** + * ship size + */ + private final int size; + /** + * ship full coordinates calculate thank to base coordinates, direction and size + */ + final Pair[] fullCoords; + private Direction direction; + /** + * if true the ship is destroyed + */ + private boolean isDrown; + + @SuppressWarnings("unchecked") + public Ship(Pair coords, int size, Direction direction) { + this.coords = coords; + this.size = size; + this.fullCoords = new Pair[this.size]; + this.direction = direction; + isDrown = false; + recalculateFullCoords(); + } + + public void setDirection(Direction d){ + this.direction = d; + } + + public void setCoords(Pair c){ + this.coords = c; + } + + /** + * set {@link Ship#isDrown} to true + */ + public void setDrown(){ + isDrown = true; + } + + public boolean isDrown(){ + return isDrown; + } + + public int getSize(){ + return this.size; + } + + public Direction getDirection(){ + return this.direction; + } + + public Pair getCoords(){ + return this.coords; + } + + /** + * recalculate all coords based on this base coords, direction and size + */ + public void recalculateFullCoords() { + for(int i = 0; i < size; ++i){ + fullCoords[i] = new Pair<>(coords.getLeft() + i * direction.getDirection().getLeft(),coords.getRight() + i * direction.getDirection().getRight()); + } + } + + public Pair[] getFullCoords(){ + return fullCoords; + } + + @Override + public String toString() { + return super.toString() + ", coords=" + coords.toString() + ", size=" + size + ", direction=" + direction.toString(); + } + + /** + * update value {@link Ship#isDrown} to true if {@code player} hit all of ship boxes + * @param player the opponent of this ship owner + */ + public void updateIsDrown(Player player) { + int cpt = 0; + for(Pair coords : getFullCoords()) { + for(Triplet move : player.getMoves()) { + if(move.getRight() && move.getLeft().equals(coords.getLeft()) && move.getMiddle().equals(coords.getRight())){ + ++cpt; + break; + } + } + } + if(cpt == getSize()) { + setDrown(); + } + } +} diff --git a/livraison/src/battleship/model/package-info.java b/livraison/src/battleship/model/package-info.java new file mode 100644 index 0000000..ddd86bc --- /dev/null +++ b/livraison/src/battleship/model/package-info.java @@ -0,0 +1,4 @@ +/** + * Contains all main Game classes + */ +package battleship.model; \ No newline at end of file diff --git a/livraison/src/battleship/model/player/AbstractPlayer.java b/livraison/src/battleship/model/player/AbstractPlayer.java new file mode 100644 index 0000000..11ec9c0 --- /dev/null +++ b/livraison/src/battleship/model/player/AbstractPlayer.java @@ -0,0 +1,98 @@ +package battleship.model.player; + +import battleship.model.Direction; +import battleship.model.Ship; +import battleship.utils.Pair; +import battleship.utils.Triplet; + +import java.util.ArrayList; + +/** + * Abstract player class see {@link Player} to know more about this code organisation + * @see Player + * @see Human + * @see Computer + * @see Random + */ +public abstract class AbstractPlayer implements Player { + + final ArrayList ships = new ArrayList<>(); + /** + * 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 + */ + final ArrayList> moves = new ArrayList<>(); + public int id; + + public boolean setShips(Ship ship) { + if(ship.getDirection() == Direction.DEFAULT) + return false; + for(Pair coords : ship.getFullCoords()) { + if(coords.getLeft() > 9 || coords.getLeft() < 0 || coords.getRight() > 9 || coords.getRight() < 0) + return false; + for(Ship ship1 : this.ships) { + for (Pair coords1 : ship1.getFullCoords()) { + if (coords1.getLeft().equals(coords.getLeft()) && coords1.getRight().equals(coords.getRight())) + return false; + } + } + } + this.ships.add(ship); + return true; + } + + /** + * add {@code move} to the {@link AbstractPlayer#moves} list + */ + public void addMove(Triplet move){ + moves.add(move); + } + + public ArrayList> validMoves() { + ArrayList> validMovesList = new ArrayList<>(); + for(int x = 0; x < 10; x++){ + for(int y = 0; y < 10; y++) { + Pair coords = new Pair<>(x,y); + if(!(moves.contains(new Triplet<>(coords, true)) || moves.contains(new Triplet<>(coords, false)))){ + validMovesList.add(new Pair<>(x,y)); + } + } + } + return validMovesList; + + } + + public boolean areValid(int x, int y){ + if(x < 0 || x > 10 || y < 0 || y > 10) + return false; + for(Triplet move : moves){ + if(move.getLeft() == x && move.getMiddle() == y) + return false; + } + return true; + } + + @Override + public void setId(int i) { + id = i; + } + + public int getId() { + return id; + } + + @Override + public String toString() { + return getClass().getSimpleName() + " " + id; + } + + @Override + public ArrayList getShips() { + return ships; + } + + @Override + public ArrayList> getMoves() { + return moves; + } +} diff --git a/livraison/src/battleship/model/player/Computer.java b/livraison/src/battleship/model/player/Computer.java new file mode 100644 index 0000000..ea9832a --- /dev/null +++ b/livraison/src/battleship/model/player/Computer.java @@ -0,0 +1,28 @@ +package battleship.model.player; + +import battleship.model.Direction; +import battleship.model.Ship; +import battleship.utils.Pair; + +import java.util.Random; + +/** + *

      Computer super class, all player object which use an algorithm to calculate coordinates to use should extend from + * this object.

      + *

      Random is the only algorithm include here but another algorithm can be easily implemented

      + */ +public abstract class Computer extends AbstractPlayer { + + public void placeShipRandomly() { + java.util.Random rand = new Random(); + for(int i : shipSize) { + Ship ship = new Ship(new Pair<>(-1, -1), i, Direction.DEFAULT); + while(!setShips(ship)) { + ship.setCoords(new Pair<>(rand.nextInt(10), rand.nextInt(10))); + ship.setDirection(Direction.values()[rand.nextInt(Direction.values().length)]); + ship.recalculateFullCoords(); + } + } + } + +} diff --git a/livraison/src/battleship/model/player/Human.java b/livraison/src/battleship/model/player/Human.java new file mode 100644 index 0000000..0a94e8d --- /dev/null +++ b/livraison/src/battleship/model/player/Human.java @@ -0,0 +1,19 @@ +package battleship.model.player; + +import battleship.utils.Pair; + +/** + * 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 + */ +public class Human extends AbstractPlayer { + + @Override + public Pair chooseMove() { + return null; + } + + @Override + public void placeShips() {} + +} diff --git a/livraison/src/battleship/model/player/Player.java b/livraison/src/battleship/model/player/Player.java new file mode 100644 index 0000000..f97f2c8 --- /dev/null +++ b/livraison/src/battleship/model/player/Player.java @@ -0,0 +1,73 @@ +package battleship.model.player; + +import battleship.model.Ship; +import battleship.utils.Pair; +import battleship.utils.Triplet; + +import java.util.ArrayList; + +/** + *

      Player interface, used as an API.

      + *

      This model (interface -> abstract class(es) -> concrete classes) prevent hard code.

      + *

      This is the only object which interact with other object
      + * Allows an outside person from the project to easily change the code or to add a view easily without modifying + * existing classes

      + * @see AbstractPlayer + * @see Computer + * @see Human + * @see Random + */ +public interface Player { + + int[] shipSize = { 5, 4, 3, 3, 2 }; + + /** + * Used by computer only + * @see Random#chooseMove() + * @return coords in its opponent grid to play a move + */ + Pair chooseMove(); + + /** + * check if ship position and direction are valides and does not overlap on other vessels + * add the ship to player {@link AbstractPlayer#ships} list and return {@code true} if valid + * {@code false} otherwise + * @param ship the ship instance we check + * @return {@code true} if ship data are valids, {@code false} otherwise + */ + boolean setShips(Ship ship); + + int getId(); + + /** + * Adds coordinates of the {@code move} in the {@link AbstractPlayer#moves} list + * @param move the move chosen by the player + */ + void addMove(Triplet move); + + + void setId(int i); + + /** + * give a list of the player possible moves, used in {@link Player#chooseMove()} + * @return a list of playable move + */ + ArrayList> validMoves(); + + /** + * Used by {@link Computer} instances to place ships + */ + void placeShips(); + + /** + * check if coordinates from {@link battleship.view.View#chooseMove(Player)}are in valids position + * @param x the x-axis of the coordinates + * @param y the y-axis of the coordinates + * @return {@code true} if valid, {@code false} otherwise + */ + boolean areValid(int x, int y); + + ArrayList getShips(); + + ArrayList> getMoves(); +} diff --git a/livraison/src/battleship/model/player/Random.java b/livraison/src/battleship/model/player/Random.java new file mode 100644 index 0000000..a6dfcfb --- /dev/null +++ b/livraison/src/battleship/model/player/Random.java @@ -0,0 +1,21 @@ +package battleship.model.player; + +import battleship.utils.Pair; + +/** + * place its ship and choose moves randomly + */ +public class Random extends Computer { + + @Override + public Pair chooseMove() { + java.util.Random rand = new java.util.Random(); + return validMoves().get(rand.nextInt(validMoves().size())); + } + + @Override + public void placeShips() { + placeShipRandomly(); + } + +} diff --git a/livraison/src/battleship/model/player/package-info.java b/livraison/src/battleship/model/player/package-info.java new file mode 100644 index 0000000..1ff58cc --- /dev/null +++ b/livraison/src/battleship/model/player/package-info.java @@ -0,0 +1,4 @@ +/** + * Contains all players classes instances and theirs super classes and interface + */ +package battleship.model.player; \ No newline at end of file diff --git a/livraison/src/battleship/package-info.java b/livraison/src/battleship/package-info.java new file mode 100644 index 0000000..e8d3bd2 --- /dev/null +++ b/livraison/src/battleship/package-info.java @@ -0,0 +1,4 @@ +/** + * Contains Main Class + */ +package battleship; \ No newline at end of file diff --git a/livraison/src/battleship/utils/Pair.java b/livraison/src/battleship/utils/Pair.java new file mode 100644 index 0000000..16de05f --- /dev/null +++ b/livraison/src/battleship/utils/Pair.java @@ -0,0 +1,53 @@ +package battleship.utils; + +import java.util.Objects; + +/** + * tuple containing 2 generic type elements + * + * @param left + * @param right + */ +public class Pair { + + private final U left; + private final K right; + + public Pair(U left, K right) { + this.left = left; + this.right = right; + } + + public U getLeft() { + return left; + } + + public K getRight() { + return right; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final Pair other = (Pair) obj; + return this.left.equals(other.getLeft()) && this.right.equals(other.getRight()); + } + + @Override + public int hashCode() { + return Objects.hash(left.hashCode(), right.hashCode()); + } + + @Override + public String toString() { + return "(" + left + ", " + right + ")"; + } +} diff --git a/livraison/src/battleship/utils/Triplet.java b/livraison/src/battleship/utils/Triplet.java new file mode 100644 index 0000000..961a335 --- /dev/null +++ b/livraison/src/battleship/utils/Triplet.java @@ -0,0 +1,64 @@ +package battleship.utils; + +import java.util.Objects; + +/** + * tuple containing 3 generic type elements + * + * @param left + * @param middle + * @param right + */ +public class Triplet { + + private final U left; + private final K middle; + private final V right; + + public Triplet(U left, K middle, V right) { + this.left = left; + this.middle = middle; + this.right = right; + } + + public Triplet(Pair pair, V right) { + this(pair.getLeft(), pair.getRight(), right); + } + + public U getLeft() { + return left; + } + + public K getMiddle() { + return middle; + } + + public V getRight() { + return right; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final Triplet other = (Triplet) obj; + return this.left.equals(other.getLeft()) && this.middle.equals(other.getMiddle()) && this.right.equals(other.getRight()); + } + + @Override + public int hashCode() { + return Objects.hash(left, middle, right); + } + + @Override + public String toString() { + return "(" + left + ", " + middle + ", " + right + ")"; + } +} diff --git a/livraison/src/battleship/utils/package-info.java b/livraison/src/battleship/utils/package-info.java new file mode 100644 index 0000000..abd472d --- /dev/null +++ b/livraison/src/battleship/utils/package-info.java @@ -0,0 +1,4 @@ +/** + * Utility classes + */ +package battleship.utils; \ No newline at end of file diff --git a/livraison/src/battleship/view/AbstractView.java b/livraison/src/battleship/view/AbstractView.java new file mode 100644 index 0000000..bcf2a26 --- /dev/null +++ b/livraison/src/battleship/view/AbstractView.java @@ -0,0 +1,192 @@ +package battleship.view; + +import battleship.model.Direction; +import battleship.model.Game; +import battleship.model.Ship; +import battleship.model.player.Player; +import battleship.utils.Pair; +import battleship.utils.Triplet; + +import java.util.ArrayList; + +/** + * Abstract view class + * @see View + * @see Window + * @see Terminal + */ +public abstract class AbstractView implements View { + + protected final Game game; + + public AbstractView(Game game) { + this.game = game; + } + + /** + * Used during debugging, used in terminal to display grids too + * @return all player grids + */ + @Override + public String toString() { + return toString(true); + } + + public String toString(boolean debug) { + StringBuilder chain = new StringBuilder(); + for(int u = 0; u < 2; ++u) { + Player player = game.players[u]; + ArrayList ships = game.players[u].getShips(); + chain.append("Joueur ").append(player.getId()).append(" :\n"); + chain.append("+ 0 1 2 3 4 5 6 7 8 9 +\n"); + for(int x = 0; x < 10; ++x) { + chain.append(x); + for(int y = 0; y < 10; ++y) { + Pair pair = new Pair<>(x, y); + boolean isPosition = false; + for(Ship ship : ships) { + if(isShipPosition(ship, pair)) { + isPosition = true; + int result = isPositionDrowned(game.players[u == 0 ? 1 : 0], ship, pair); + if(result == 1) { + chain.append(" X"); + } else if (result == 2){ + chain.append(" !"); + } else if(debug || game.getCurrentPlayer() == player) { + chain.append(" ."); + } else { + chain.append(" _"); + } + break; + } + } + if(!isPosition) { + if(isPositionDrowned(game.players[u == 0 ? 1 : 0], pair) == 2) { + chain.append(" ?"); + } else { + chain.append(" _"); + } + } + + } + chain.append(" |\n"); + } + chain.append("+ - - - - - - - - - - +\n"); + } + + return chain.toString(); + } + + /** + * + * @return {@code true} if {@link Ship#getFullCoords()} contains {@code boardsCoords}, {@code false} otherwise + */ + private boolean isShipPosition(Ship ship, Pair boardsCoords) { + for(Pair coords : ship.getFullCoords()) { + if(boardsCoords.equals(coords)) + return true; + } + return false; + } + + /** + * ask player for keyboard input and parse it into one of {@link Direction} value + * @return Direction depending of player input + * @throws InterruptedException caused by {@link Window#getKeyInput()} + * @see Window#getDirectionFromChar() + */ + protected Direction getDirectionFromChar() throws InterruptedException { + String dir; + while (true) { + setUpperText("Veuillez indiquer la direction de placement de votre bateau (d droite, h haut, b bas, g gauche)"); + dir = getKeyInput(); + for (Direction direction : Direction.values()) { + if (direction.getKeyword() != null && direction.getKeyword().equals(dir)) { + return direction; + } + } + } + } + + /** + * ask player for keyboard input and return result + * @return String given by player + * @throws InterruptedException see {@link Window#getKeyInput()} + */ + protected abstract String getKeyInput() throws InterruptedException; + + /** + * Display a text above the grid on {@link Window}, simply print text on {@link Terminal} + * @param s text to display + * @see Window#setUpperText(String) + * @see Terminal#setUpperText(String) + */ + protected abstract void setUpperText(String s); + + /** + * used if {@code player} instance of {@link battleship.model.player.Computer} + * @param player player we ask to set position of its ships + * @throws InterruptedException see {@link Window#setShips(Player)} + */ + @Override + public void setShips(Player player) throws InterruptedException { + player.placeShips(); + } + + /** + * @param other other than the current player + * @param ship check if this ship at this position has been hit + * @param pair coords + * @return 1 if ship fully drowned, 2 if only damaged, 0 if not + * @see AbstractView#isPositionDrowned(Player, Pair) + */ + private int isPositionDrowned(Player other, Ship ship, Pair pair) { + if(ship.isDrown()) + return 1; + return isPositionDrowned(other, pair); + } + + /** + * @param other other than the current player + * @param pair coords to check + * @return 2 if player already played here, 0 otherwise + */ + private int isPositionDrowned(Player other, Pair pair) { + for(Triplet move : other.getMoves()) { + if(pair.getLeft().equals(move.getLeft()) && pair.getRight().equals(move.getMiddle())) { + return 2; + } + } + return 0; + } + + /** + * used by {@link battleship.model.player.Computer} player to play a move in the grid depending of its algorithm + * @param player {@link battleship.model.Game#currentPlayer} + * @return a couple ({@link Pair} containing the x and y coordinate (left side store Y and right side X) + * @throws InterruptedException see {@link Window#chooseMove(Player)} + */ + @Override + public Pair chooseMove(Player player) throws InterruptedException { + return player.chooseMove(); + } + + /** + * ask {@code player} for mouse input + * @param player {@link Game#currentPlayer} + * @return coordinate of {@code player} opponent grid + * @see Window#mouseInput(Player) + * @throws InterruptedException see {@link Window#mouseInput(Player)} + */ + protected abstract Pair mouseInput(Player player) throws InterruptedException; + + /** + * ask {@link Game#currentPlayer} for keyboard input + * @return String given by player + * @throws InterruptedException see {@link Window#keyboardInput()} + * @see Window#keyboardInput() + * @see Terminal#keyboardInput() + * @see Terminal#keyboardInputInteger() + */ + protected abstract String keyboardInput() throws InterruptedException; +} diff --git a/livraison/src/battleship/view/Terminal.java b/livraison/src/battleship/view/Terminal.java new file mode 100644 index 0000000..0bd6d81 --- /dev/null +++ b/livraison/src/battleship/view/Terminal.java @@ -0,0 +1,167 @@ +package battleship.view; + +import battleship.control.TerminalKeyboardListener; +import battleship.model.Direction; +import battleship.model.Game; +import battleship.model.Ship; +import battleship.model.player.Human; +import battleship.model.player.Player; +import battleship.utils.Pair; + +import java.util.Scanner; + +/** + * Terminal view, instanced if argument 2 equals to "nogui" + * @see View + * @see AbstractView + */ +public class Terminal extends AbstractView { + + public static Scanner scanner = null; + private final TerminalKeyboardListener keyboardComponent; + + public Terminal(Game game) { + super(game); + if(scanner == null) + scanner = new Scanner(System.in); + keyboardComponent = new TerminalKeyboardListener(scanner); + } + + /** + * @return given string in terminal + */ + @Override + protected String getKeyInput() { + return scanner.next().toUpperCase(); + } + + /** + * print string + * @param s text to display + */ + @Override + protected void setUpperText(String s) { + System.out.println(s); + } + + /** + * Ask {@code player} to set position of its ships + * @param player player we ask to set position of its ships + * @throws InterruptedException see {@link AbstractView#getDirectionFromChar()} + */ + @Override + public void setShips(Player player) throws InterruptedException { + setUpperText("Joueur " + player.getId() + ", placez vos navires"); + int x, y; + if(player instanceof Human) { + for(int i : shipsSize) { + boolean valid = false; + Pair defaultPos = new Pair<>(-1, -1); + Ship ship = new Ship(defaultPos, i, Direction.DEFAULT); + while (!player.setShips(ship)) { + try { + if (valid) { + setUpperText("Erreur"); + } + valid = true; + setUpperText("Placement du bateau de longueur " + ship.getSize()); + setUpperText("Veuillez indiquer la coordonée x de votre bateau"); + x = keyboardInputInteger(); + setUpperText("Veuillez indiquer la coordonée y de votre bateau"); + y = keyboardInputInteger(); + ship.setCoords(new Pair<>(x, y)); + ship.setDirection(getDirectionFromChar()); + ship.recalculateFullCoords(); + } catch(NumberFormatException e) { + // Pour être sur qu'il ne passera pas la boucle + ship.setCoords(defaultPos); + ship.setDirection(Direction.DEFAULT); + } + + } + } + } else { + super.setShips(player); + // Computer + } + } + + /** + * print board in terminal + */ + @Override + public void displayBoard() { + System.out.println(this.toString(false)); + } + + /** + * ask player to choose a coords on its opponent grid, call {@link AbstractView#chooseMove(Player)} if instance of + * player is {@link battleship.model.player.Computer} + * if {@code player} isn't {@link Human} instance + * @param player {@link battleship.model.Game#currentPlayer} + * @return a element containing the x and y coordinate (left side store Y and right side X) + * @throws InterruptedException see {@link AbstractView#chooseMove(Player)} + */ + @Override + public Pair chooseMove(Player player) throws InterruptedException { + if(player instanceof Human) { + int x = -1, y = -1; + while(!player.areValid(x, y)) { + try { + // y correspond à l'ordonnée mais est stocké comme étant l'abscisse + // (erreur de notre part aperçu lors du passage à une fenetre swing) + setUpperText("Veuillez indiquer la coordonée x de votre coup"); + y = keyboardInputInteger(); + setUpperText("Veuillez indiquer la coordonée y de votre coup"); + x = keyboardInputInteger(); + } catch (NumberFormatException ignored) { + x = -1; + y = -1; + } + } + return new Pair<>(x,y); + } + return super.chooseMove(player); + + } + + /** + * Never call in Terminal + * @param player {@link Game#currentPlayer} + * @return {@code null} + */ + @Override + protected Pair mouseInput(Player player) { + return null; + } + + /** + * @see TerminalKeyboardListener#keyboardInput() + * @return given string in terminal + */ + @Override + protected String keyboardInput() { + return keyboardComponent.keyboardInput(); + } + + /** + * @see Terminal#keyboardInput() + * @return convert string from keyboardInput() and convert it into an integer + * @throws NumberFormatException if given string can't be parse into an integer + */ + protected int keyboardInputInteger() throws NumberFormatException { + return Integer.parseInt(keyboardComponent.keyboardInput()); + } + + /** + * print grid, winner player and close scanner, game automatically close after this + * @param winner the winner of the game. + */ + @Override + public void displayWinner(Player winner) { + displayBoard(); + setUpperText("Le joueur " + winner.getId() + " a gagné"); + scanner.close(); + } + +} diff --git a/livraison/src/battleship/view/View.java b/livraison/src/battleship/view/View.java new file mode 100644 index 0000000..12e2df2 --- /dev/null +++ b/livraison/src/battleship/view/View.java @@ -0,0 +1,46 @@ +package battleship.view; + +import battleship.model.player.Player; +import battleship.utils.Pair; + +/** + *

      View interface, used as an API

      + *

      This model (interface -> abstract class(es) -> concrete classes) prevent hard code.

      + *

      This is the only object which interact with other object
      + * Allows an outside person easily change the code or add a view easily without modifying existing classes

      + * @see AbstractView + * @see Terminal + * @see Window + */ +public interface View { + + int[] shipsSize = { 5, 4, 3, 3, 2}; + + /** + * Ask {@code player} to set position of its ships + * @param player player instance we ask + * @throws InterruptedException see {@link Window#setShips(Player)} + */ + void setShips(Player player) throws InterruptedException; + + /** + * Display all grids + */ + void displayBoard(); + + /** + * ask the player the choose a position on its opponent grid + * @param player {@link battleship.model.Game#currentPlayer} + * @return a element containing the x and y coordinate (left side store Y and right side X) + * @throws InterruptedException see {@link Window#chooseMove(Player)} + */ + Pair chooseMove(Player player) throws InterruptedException; + + /** + * Display the winner of the game and then close the game + * @param winner the winner of the game. + * @see Window#displayWinner(Player) + * @see Terminal#displayWinner(Player) + */ + void displayWinner(Player winner); +} diff --git a/livraison/src/battleship/view/Window.java b/livraison/src/battleship/view/Window.java new file mode 100644 index 0000000..b2cdfde --- /dev/null +++ b/livraison/src/battleship/view/Window.java @@ -0,0 +1,304 @@ +package battleship.view; + +import battleship.control.WindowKeyboardListener; +import battleship.control.WindowMouseListener; +import battleship.model.Direction; +import battleship.model.Game; +import battleship.model.Ship; +import battleship.model.player.Human; +import battleship.model.player.Player; +import battleship.utils.Pair; +import battleship.utils.Triplet; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.KeyEvent; +import java.awt.geom.RoundRectangle2D; + +/** + * Window view, instanced if argument 2 equals to "nogui" + * @see View + * @see AbstractView + */ +public class Window extends AbstractView { + + final JFrame frame; + + /** + * grids height, do no represent frame size + */ + public final int height = 600; + /** + * grids width, do no represent frame size + */ + public final int width = 1200; + private final WindowMouseListener mouseComponent; + private final WindowKeyboardListener keyboardComponent; + String upperTitle = ""; + String upperSubTitle = ""; + + public Window(Game game) { + super(game); + this.frame = new JFrame("Battleship"); + frame.setSize(width + width / 13, height + height / 4); + frame.setResizable(false); + frame.setContentPane(new Draw(this)); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + frame.setVisible(true); + this.mouseComponent = new WindowMouseListener(this); + frame.addMouseListener(mouseComponent); + this.keyboardComponent = new WindowKeyboardListener(); + frame.addKeyListener(keyboardComponent); + + } + + @Override + protected String getKeyInput() throws InterruptedException { + return keyboardInput(); + } + + /** + * Display a text above the grid + * @param s text to display + */ + @Override + protected void setUpperText(String s) { + upperTitle = s; + } + + /** + * Ask {@code player} to set position of its ships + * @param player player we ask + * @throws InterruptedException see {@link Window#mouseInput(Player)} and {@link Window#getDirectionFromChar()} + */ + @Override + public void setShips(Player player) throws InterruptedException { + if(player instanceof Human) { + for(int i : shipsSize) { + Ship ship = new Ship(new Pair<>(-1, -1), i, Direction.DEFAULT); + boolean valid = false; + while(!player.setShips(ship)) { + frame.repaint(); + if(valid) + openDialog("Erreur de placement, votre navire se superpose avec un autre, ou la direction donnée n'est pas valide"); + + upperTitle = "joueur " + player.getId() + ", Placez votre premier navire de taille " + i + " à l'aide de la souris"; + ship.setCoords(mouseInput(player)); + upperTitle = "joueur " + player.getId() + ", Choisissez la direction de votre navire avec le clavier"; + upperSubTitle = "H, B, G, D pour respectivement Haut, Bas, Gauche, Droite"; + frame.repaint(); + ship.setDirection(getDirectionFromChar()); + ship.recalculateFullCoords(); + valid = true; + } + + } + upperTitle = ""; + upperSubTitle = ""; + } else { + super.setShips(player); + } + } + + /** + * ask {@link Game#currentPlayer} for keyboard input + * @return String given by player + * @throws InterruptedException throw if this Thread is interrupted while {@link Thread#sleep(long) sleeping} + */ + @Override + protected String keyboardInput() throws InterruptedException { + keyboardComponent.requestInput = true; + while(true) { + Thread.sleep(25); + if(keyboardComponent.keyTyped != KeyEvent.CHAR_UNDEFINED) { + keyboardComponent.requestInput = false; + String value = String.valueOf(keyboardComponent.keyTyped).toUpperCase(); + keyboardComponent.keyTyped = KeyEvent.CHAR_UNDEFINED; + return value; + } + } + } + + /** + * ask {@code player} for mouse input + * @param player {@link Game#currentPlayer} + * @return coordinate of {@code player} opponent grid + * @throws InterruptedException throw if this Thread is interrupted while {@link Thread#sleep(long) sleeping} + */ + @Override + protected Pair mouseInput(Player player) throws InterruptedException { + mouseComponent.requestInput = true; + while(true) { + Thread.sleep(25); + if(mouseComponent.playerIdLastInput != 0) { + if(player.getId() == mouseComponent.playerIdLastInput) { + mouseComponent.requestInput = false; + mouseComponent.playerIdLastInput = 0; + Pair value = mouseComponent.lastInput; + mouseComponent.lastInput = null; + return value; + } else { + openDialog("Vous avez cliqué sur une zone de jeu qui n'est pas la votre"); + mouseComponent.playerIdLastInput = 0; + } + } + + } + } + + /** + * Open a window with {@code message} as content and with a "OK" button + * @param message message to display + * @param exitOnClose {@code true} if when user close this window, the program exit, {@code false} otherwise + */ + public void openDialog(String message, boolean exitOnClose) { + JOptionPane.showMessageDialog(frame, message); + if(exitOnClose) + System.exit(0); + } + + /** + * Open a window with {@code message} as content and with a "OK" button + * @param message message to display + * @see Window#openDialog(String, boolean) + */ + public void openDialog(String message) { + openDialog(message, false); + } + + /** + * refresh windows to display updated content + */ + @Override + public void displayBoard() { + frame.paintComponents(frame.getGraphics()); + } + + /** + * ask player to choose a position in its opponent grid + * @param player {@link battleship.model.Game#currentPlayer} + * @return a couple ({@link Pair} containing the x and y coordinate (left side store Y and right side X) + * @throws InterruptedException see {@link Window#mouseInput(Player)} + */ + @Override + public Pair chooseMove(Player player) throws InterruptedException { + setUpperText("Joueur " + player.getId() + " cliquez sur l'emplacement où vous souhaitez tirer"); + frame.repaint(); + if(player instanceof Human) { + Pair coords = new Pair<>(-1, -1); + boolean valid = false; + while(!player.areValid(coords.getLeft(), coords.getRight())) { + if(valid) + openDialog("Erreur de placement, ce coup a déjà été effectué"); + valid = true; + coords = mouseInput(game.getOtherPlayer(player)); + } + return coords; + } + return super.chooseMove(player); + + } + + /** + * open a dialog to display the winner and exit the program when window is closed + * @param winner the winner of the game. + */ + @Override + public void displayWinner(Player winner) { + openDialog("Le joueur " + winner.getId() + " a gagné", true); + } + + /** + * Panel where we paint the board + * @see JPanel + */ + class Draw extends JPanel { + + private final Window window; + + public Draw(Window window) { + this.window = window; + } + + public void paintComponent(Graphics g) { + super.paintComponent(g); + Graphics2D g2d = (Graphics2D)g; + g2d.drawString(upperTitle, (int) (window.width /2 - (upperTitle.length() * 2.5)), 50); + g2d.drawString(upperSubTitle, (int) (window.width / 2 - (upperSubTitle.length() * 2.5)), 65); + int width = window.width; + int height = window.height; + int initialHeight = height / 12; + int initialWidth = width / 23; + for(int abscisse = initialWidth; abscisse < width; abscisse += initialWidth) { + g2d.drawLine(abscisse, initialHeight * 2, abscisse, height); + if(abscisse == initialWidth * 11) + abscisse += initialWidth; + } + for(int ordonnee = initialHeight * 2; ordonnee < height + 1; ordonnee += initialHeight) { + g2d.drawLine(initialWidth, ordonnee, initialWidth * 11, ordonnee); + g2d.drawLine(initialWidth * 13, ordonnee, width - 4, ordonnee); + } + + for(int i = 1; i < 3; ++i) { + Player player = game.players[i-1]; + for(Ship ship : player.getShips()) { + if(player == game.getCurrentPlayer() ||ship.isDrown()) { + int x1 = i == 1 ? initialWidth : initialWidth * 13; + int y1 = initialHeight * 2; + int shipWidth = initialWidth; + int shipHeight = initialHeight; + switch(ship.getDirection()) { + case DOWN: + x1 += initialWidth * ship.getCoords().getRight(); + y1 += initialHeight * ship.getCoords().getLeft(); + shipHeight = initialHeight * ship.getSize(); + g.setColor(new Color(0, 255, 255)); + break; + case UP: + x1 += initialWidth * ship.getCoords().getRight(); + shipHeight = initialHeight * ship.getSize(); + y1 += initialHeight * ship.getCoords().getLeft() - shipHeight + initialHeight; + g.setColor(new Color(255, 255, 0)); + break; + case RIGHT: + x1 += initialWidth * ship.getCoords().getRight(); + y1 += initialHeight * ship.getCoords().getLeft(); + shipWidth = initialWidth * ship.getSize(); + g.setColor(new Color(0, 255, 0)); + break; + case LEFT: + shipWidth = initialWidth * ship.getSize(); + x1 += initialWidth * ship.getCoords().getRight() - shipWidth + initialWidth; + y1 += initialHeight * ship.getCoords().getLeft(); + g.setColor(new Color(0, 0, 255)); + break; + } + g2d.fillRoundRect(x1 + 1, y1 + 1, shipWidth - 1, shipHeight - 1, 25, 25); + } + } + } + for(int i = 1; i < 3; ++i) { + Player player = game.players[i-1]; + float rectangleSize = initialWidth / 4f; + int sqrt = (int) Math.sqrt(initialHeight * initialHeight + initialWidth * initialWidth) - 10; + for(Triplet move : player.getMoves()) { + int x1 = (i == 1 ? initialWidth * 13 : initialWidth) + initialWidth * move.getMiddle(); + int y1 = initialHeight * 2 + initialHeight * move.getLeft() + 8; + RoundRectangle2D cross1 = new RoundRectangle2D.Float(x1, y1, rectangleSize, sqrt, 15, 15); + RoundRectangle2D cross2 = new RoundRectangle2D.Float(x1 + initialWidth - 9, y1 - 9, rectangleSize, sqrt, 15, 15); + if(move.getRight()) { + g.setColor(new Color(255, 0, 0)); + } else { + g.setColor(new Color(0, 123, 255)); + } + g2d.rotate(Math.toRadians(-45), x1, y1); + g2d.fill(cross1); + g2d.rotate(Math.toRadians(45), x1, y1); + g2d.rotate(Math.toRadians(45), x1 + initialWidth - 9, y1 - 9); + g2d.fill(cross2); + g2d.rotate(Math.toRadians(-45), x1 + initialWidth - 9, y1 - 9); + } + } + } + } +} diff --git a/livraison/src/battleship/view/WindowListener.java b/livraison/src/battleship/view/WindowListener.java new file mode 100644 index 0000000..428082f --- /dev/null +++ b/livraison/src/battleship/view/WindowListener.java @@ -0,0 +1,32 @@ +package battleship.view; + +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +public class WindowListener implements MouseListener { + + @Override + public void mouseClicked(MouseEvent e) { + + } + + @Override + public void mousePressed(MouseEvent e) { + + } + + @Override + public void mouseReleased(MouseEvent e) { + + } + + @Override + public void mouseEntered(MouseEvent e) { + + } + + @Override + public void mouseExited(MouseEvent e) { + + } +} diff --git a/livraison/src/battleship/view/package-info.java b/livraison/src/battleship/view/package-info.java new file mode 100644 index 0000000..b104f2e --- /dev/null +++ b/livraison/src/battleship/view/package-info.java @@ -0,0 +1,4 @@ +/** + * Contains terminal and windows view classes and theirs super class and interface + */ +package battleship.view; \ No newline at end of file diff --git a/src/META-INF/MANIFEST.MF b/src/META-INF/MANIFEST.MF new file mode 100644 index 0000000..e0f1fa4 --- /dev/null +++ b/src/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: battleship.Main +