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