Commit f9634016 authored by JING LI's avatar JING LI
Browse files

Javadoc

parent 3279dff7
...@@ -78,7 +78,7 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain { ...@@ -78,7 +78,7 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain {
/** /**
* Set the test mode * Set the test mode
* *
* @param boolean the value to set to testMode parameter * @param testMode if test mode or not
*/ */
public void setTestMode(boolean testMode) { public void setTestMode(boolean testMode) {
this.testMode = testMode; this.testMode = testMode;
...@@ -391,6 +391,7 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain { ...@@ -391,6 +391,7 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain {
* *
* @return my owner profile * @return my owner profile
*/ */
@Override
public Owner getMyOwnerProfile() { public Owner getMyOwnerProfile() {
return this.userMediator.getMyOwnerProfile(); return this.userMediator.getMyOwnerProfile();
...@@ -418,6 +419,7 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain { ...@@ -418,6 +419,7 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain {
* @param user the new user who has joined * @param user the new user who has joined
* @param id id of the stat game * @param id id of the stat game
* @param role role of the new user * @param role role of the new user
* @throws com.utclo23.data.module.DataException
*/ */
@Override @Override
public void updateGameList(LightPublicUser user, String id, String role) throws DataException { public void updateGameList(LightPublicUser user, String id, String role) throws DataException {
...@@ -429,6 +431,7 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain { ...@@ -429,6 +431,7 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain {
* Get ships to place * Get ships to place
* *
* @return the list of ships to place * @return the list of ships to place
* @throws com.utclo23.data.module.DataException
* *
*/ */
@Override @Override
...@@ -446,8 +449,10 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain { ...@@ -446,8 +449,10 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain {
* Set a given ship * Set a given ship
* *
* @param ship the ship to set * @param ship the ship to set
* @throws com.utclo23.data.module.DataException
* *
*/ */
@Override
public void setShip(Ship ship) throws DataException { public void setShip(Ship ship) throws DataException {
Logger.getLogger(DataFacade.class.getName()).log(Level.INFO, null, "data | set ship"); Logger.getLogger(DataFacade.class.getName()).log(Level.INFO, null, "data | set ship");
...@@ -459,8 +464,7 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain { ...@@ -459,8 +464,7 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain {
* Attack a given location * Attack a given location
* *
* @param coords the location to attack * @param coords the location to attack
* @param isTrueAttack true = this is a true attack ; false = this is just a * @param isAttack
* test
* @return Pair<Integer, Ship> * @return Pair<Integer, Ship>
* Integer = 0 if the mine is not in a right place ; Integer = 1 if the mine * Integer = 0 if the mine is not in a right place ; Integer = 1 if the mine
* is in the place of a ship. Ship = null if the ship isn't destroyed ; ship * is in the place of a ship. Ship = null if the ship isn't destroyed ; ship
...@@ -573,7 +577,6 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain { ...@@ -573,7 +577,6 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain {
* Get a user profile * Get a user profile
* *
* @param id the id of the user to get his profile * @param id the id of the user to get his profile
* @return the public user
* *
*/ */
@Override @Override
...@@ -596,9 +599,12 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain { ...@@ -596,9 +599,12 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain {
* Create a game * Create a game
* *
* @param name the name of the game created * @param name the name of the game created
* @param computerMode mode of game is computer
* @param spectator are spectators allowed or not * @param spectator are spectators allowed or not
* @param spectatorChat are spectators allowed to chat or not * @param spectatorChat are spectators allowed to chat or not
* @param type type of the game created * @param type type of the game created
* @return
* @throws com.utclo23.data.module.DataException
*/ */
@Override @Override
public Game createGame(String name, boolean computerMode, boolean spectator, boolean spectatorChat, GameType type) throws DataException { public Game createGame(String name, boolean computerMode, boolean spectator, boolean spectatorChat, GameType type) throws DataException {
...@@ -666,6 +672,11 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain { ...@@ -666,6 +672,11 @@ public class DataFacade implements IDataCom, IDataIHMTable, IDataIHMMain {
this.userMediator.setIPDiscovery(discoveryNodes); this.userMediator.setIPDiscovery(discoveryNodes);
} }
/**
*
* @param profile
*/
@Override
public void receivePublicUserProfile(PublicUser profile) { public void receivePublicUserProfile(PublicUser profile) {
try { try {
this.ihmMainFacade.recievePublicUserProfile(profile); this.ihmMainFacade.recievePublicUserProfile(profile);
......
...@@ -7,8 +7,6 @@ package com.utclo23.data.facade; ...@@ -7,8 +7,6 @@ package com.utclo23.data.facade;
import com.utclo23.data.module.DataException; import com.utclo23.data.module.DataException;
import com.utclo23.data.structure.*; import com.utclo23.data.structure.*;
import java.net.NetworkInterface;
import java.rmi.server.UID;
import java.util.List; import java.util.List;
/** /**
......
...@@ -8,7 +8,6 @@ package com.utclo23.data.facade; ...@@ -8,7 +8,6 @@ package com.utclo23.data.facade;
import com.utclo23.data.module.DataException; import com.utclo23.data.module.DataException;
import com.utclo23.data.structure.*; import com.utclo23.data.structure.*;
import java.net.InterfaceAddress; import java.net.InterfaceAddress;
import java.rmi.server.UID;
import java.util.List; import java.util.List;
import java.util.Date; import java.util.Date;
......
...@@ -7,11 +7,9 @@ package com.utclo23.data.facade; ...@@ -7,11 +7,9 @@ package com.utclo23.data.facade;
import com.utclo23.data.module.DataException; import com.utclo23.data.module.DataException;
import com.utclo23.data.structure.*; import com.utclo23.data.structure.*;
import java.rmi.server.UID;
import java.util.List; import java.util.List;
import javafx.util.Pair; import javafx.util.Pair;
import java.io.IOException;
/** /**
* *
......
...@@ -26,7 +26,6 @@ public class Caretaker extends SerializableEntity{ ...@@ -26,7 +26,6 @@ public class Caretaker extends SerializableEntity{
/** /**
* constructor * constructor
* @param mementoList
*/ */
public Caretaker() { public Caretaker() {
this.mementoList = new ArrayList<>(); this.mementoList = new ArrayList<>();
......
package com.utclo23.data.module; package com.utclo23.data.module;
import com.utclo23.com.ComFacade; import com.utclo23.com.ComFacade;
import com.utclo23.data.configuration.Configuration;
import com.utclo23.data.facade.DataFacade; import com.utclo23.data.facade.DataFacade;
import com.utclo23.data.structure.ComputerPlayer;
import com.utclo23.data.structure.Coordinate; import com.utclo23.data.structure.Coordinate;
import com.utclo23.data.structure.Event; import com.utclo23.data.structure.Event;
import com.utclo23.data.structure.Game; import com.utclo23.data.structure.Game;
...@@ -44,6 +42,7 @@ public class GameMediator { ...@@ -44,6 +42,7 @@ public class GameMediator {
/** /**
* Constructor * Constructor
* @param dataFacade
*/ */
public GameMediator(DataFacade dataFacade) { public GameMediator(DataFacade dataFacade) {
...@@ -68,9 +67,12 @@ public class GameMediator { ...@@ -68,9 +67,12 @@ public class GameMediator {
* Create a game * Create a game
* *
* @param name * @param name
* @param computerMode if the game is played with computer
* @param spectator * @param spectator
* @param spectatorChat * @param spectatorChat
* @param type * @param type
* @return
* @throws com.utclo23.data.module.DataException
*/ */
public Game createGame(String name, boolean computerMode, boolean spectator, boolean spectatorChat, GameType type) throws DataException { public Game createGame(String name, boolean computerMode, boolean spectator, boolean spectatorChat, GameType type) throws DataException {
//empty game name //empty game name
...@@ -106,7 +108,7 @@ public class GameMediator { ...@@ -106,7 +108,7 @@ public class GameMediator {
/** /**
* add a new game * add a new game
* *
* @param game * @param statgame state of new game
*/ */
public void addNewGame(StatGame statgame) { public void addNewGame(StatGame statgame) {
if (!this.gamesMap.containsKey(statgame.getId())) { if (!this.gamesMap.containsKey(statgame.getId())) {
...@@ -264,6 +266,8 @@ public class GameMediator { ...@@ -264,6 +266,8 @@ public class GameMediator {
* @param isTrueAttack * @param isTrueAttack
* @return * @return
* @throws DataException * @throws DataException
* @throws java.io.IOException
* @throws java.lang.ClassNotFoundException
*/ */
public Pair<Integer, Ship> attack(Coordinate coordinate, boolean isTrueAttack) throws DataException, IOException, ClassNotFoundException { public Pair<Integer, Ship> attack(Coordinate coordinate, boolean isTrueAttack) throws DataException, IOException, ClassNotFoundException {
...@@ -371,6 +375,7 @@ public class GameMediator { ...@@ -371,6 +375,7 @@ public class GameMediator {
* @param user the new user who has joined * @param user the new user who has joined
* @param id id of the stat game * @param id id of the stat game
* @param role role of the new user * @param role role of the new user
* @throws com.utclo23.data.module.DataException
*/ */
public void updateGameList(LightPublicUser user, String id, String role) throws DataException { public void updateGameList(LightPublicUser user, String id, String role) throws DataException {
System.out.println("id " + id); System.out.println("id " + id);
...@@ -557,6 +562,7 @@ public class GameMediator { ...@@ -557,6 +562,7 @@ public class GameMediator {
/** /**
* Win if the game has no winner yet. * Win if the game has no winner yet.
* @throws com.utclo23.data.module.DataException
*/ */
public void defWin() throws DataException { public void defWin() throws DataException {
if (this.currentGame == null) { if (this.currentGame == null) {
......
...@@ -11,14 +11,10 @@ import java.awt.Graphics2D; ...@@ -11,14 +11,10 @@ import java.awt.Graphics2D;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte;
import java.awt.image.WritableRaster;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.Inet4Address;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException;
import java.rmi.server.UID; import java.rmi.server.UID;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -107,6 +103,7 @@ public class UserMediator { ...@@ -107,6 +103,7 @@ public class UserMediator {
/** /**
* set facade * set facade
* @param dataFacade
*/ */
public void setDataFacade(DataFacade dataFacade) { public void setDataFacade(DataFacade dataFacade) {
this.dataFacade = dataFacade; this.dataFacade = dataFacade;
...@@ -313,7 +310,7 @@ public class UserMediator { ...@@ -313,7 +310,7 @@ public class UserMediator {
* *
* @param username * @param username
* @param password * @param password
* @throws Exception * @throws com.utclo23.data.module.DataException
*/ */
public void signIn(String username, String password) throws DataException { public void signIn(String username, String password) throws DataException {
...@@ -376,6 +373,7 @@ public class UserMediator { ...@@ -376,6 +373,7 @@ public class UserMediator {
/** /**
* disconnection * disconnection
* @throws com.utclo23.data.module.DataException
*/ */
public void signOut() throws DataException { public void signOut() throws DataException {
if (this.owner != null) { if (this.owner != null) {
...@@ -536,7 +534,7 @@ public class UserMediator { ...@@ -536,7 +534,7 @@ public class UserMediator {
save(); save();
// Create the Inet4Address list // Create the Inet4Address list
List<Inet4Address> ips = new ArrayList<Inet4Address>(); List<Inet4Address> ips = new ArrayList<>();
for (String stringIp : discoveryNodes) { for (String stringIp : discoveryNodes) {
Inet4Address inetIp = (Inet4Address) InetAddress.getByName(stringIp); Inet4Address inetIp = (Inet4Address) InetAddress.getByName(stringIp);
......
...@@ -27,8 +27,9 @@ public class BelgianGame extends Game { ...@@ -27,8 +27,9 @@ public class BelgianGame extends Game {
* get templates of ships for belgian game * get templates of ships for belgian game
* @return * @return
*/ */
@Override
public List<Ship> getTemplateShips() { public List<Ship> getTemplateShips() {
List<Ship> ships = new ArrayList<Ship>(); List<Ship> ships = new ArrayList<>();
ships.add(new Ship(ShipType.BATTLESHIP, 4)); ships.add(new Ship(ShipType.BATTLESHIP, 4));
......
...@@ -28,9 +28,10 @@ public class ClassicGame extends Game{ ...@@ -28,9 +28,10 @@ public class ClassicGame extends Game{
* @return * @return
*/ */
@Override
public List<Ship> getTemplateShips() public List<Ship> getTemplateShips()
{ {
List<Ship> ships = new ArrayList<Ship>(); List<Ship> ships = new ArrayList<>();
ships.add(new Ship(ShipType.CARRIER, 5)); ships.add(new Ship(ShipType.CARRIER, 5));
ships.add(new Ship(ShipType.BATTLESHIP, 4)); ships.add(new Ship(ShipType.BATTLESHIP, 4));
ships.add(new Ship(ShipType.CRUISER, 3)); ships.add(new Ship(ShipType.CRUISER, 3));
......
...@@ -6,10 +6,8 @@ ...@@ -6,10 +6,8 @@
package com.utclo23.data.structure; package com.utclo23.data.structure;
import com.utclo23.data.configuration.Configuration; import com.utclo23.data.configuration.Configuration;
import java.rmi.server.UID;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import javafx.util.Pair;
/** /**
* *
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
* and open the template in the editor. * and open the template in the editor.
*/ */
package com.utclo23.data.structure; package com.utclo23.data.structure;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
*/ */
package com.utclo23.data.structure; package com.utclo23.data.structure;
import java.util.Comparator;
import java.util.Date; import java.util.Date;
/** /**
......
...@@ -14,8 +14,6 @@ import java.io.IOException; ...@@ -14,8 +14,6 @@ import java.io.IOException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List; import java.util.List;
import javafx.util.Pair; import javafx.util.Pair;
...@@ -315,7 +313,7 @@ public abstract class Game extends SerializableEntity { ...@@ -315,7 +313,7 @@ public abstract class Game extends SerializableEntity {
//reset //reset
this.messages.clear(); this.messages.clear();
for (Player p : players) { for (Player p : players) {
p.getMines().clear();; p.getMines().clear();
} }
List<Event> events = memento.getState(); List<Event> events = memento.getState();
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
*/ */
package com.utclo23.data.structure; package com.utclo23.data.structure;
import java.rmi.server.UID;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
package com.utclo23.data.structure; package com.utclo23.data.structure;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import java.rmi.server.UID;
import java.util.Date; import java.util.Date;
/** /**
......
...@@ -133,7 +133,7 @@ public class StatGame extends SerializableEntity{ ...@@ -133,7 +133,7 @@ public class StatGame extends SerializableEntity{
this.name = name; this.name = name;
this.spectator = spectator; this.spectator = spectator;
this.spectatorChat = spectatorChat; this.spectatorChat = spectatorChat;
this.players = new ArrayList<>();; this.players = new ArrayList<>();
this.winner = null; this.winner = null;
this.creator = creator; this.creator = creator;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment