javadoc fixes

#story[1188]
main
hba56 8 years ago
parent e4dbebfcac
commit 4c52673fc1

@ -7,12 +7,11 @@ import mock.model.Polars;
import mock.model.RaceLogic; import mock.model.RaceLogic;
import mock.model.SourceIdAllocator; import mock.model.SourceIdAllocator;
import mock.model.commandFactory.CompositeCommand; import mock.model.commandFactory.CompositeCommand;
import mock.model.wind.ShiftingWindGenerator;
import mock.model.wind.WindGenerator;
import mock.xml.RaceXMLCreator; import mock.xml.RaceXMLCreator;
import network.Messages.Enums.RaceStatusEnum; import network.Messages.Enums.RaceStatusEnum;
import network.Messages.HostGame; import network.Messages.HostGame;
import mock.model.wind.RandomWindGenerator;
import mock.model.wind.ShiftingWindGenerator;
import mock.model.wind.WindGenerator;
import network.Messages.LatestMessages; import network.Messages.LatestMessages;
import shared.dataInput.*; import shared.dataInput.*;
import shared.enums.XMLFileType; import shared.enums.XMLFileType;
@ -25,8 +24,6 @@ import shared.model.Constants;
import java.io.IOException; import java.io.IOException;
import java.net.Inet4Address; import java.net.Inet4Address;
import java.net.InetAddress;
import java.io.*;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
@ -234,6 +231,7 @@ public class Event {
/** /**
* Creates the needed data type for a network packet * Creates the needed data type for a network packet
* @return hostGame Ac35DataType * @return hostGame Ac35DataType
* @throws IOException Inet4Address issue
*/ */
public HostGame getHostedGameData() throws IOException{ public HostGame getHostedGameData() throws IOException{
String ip = Inet4Address.getLocalHost().getHostAddress(); String ip = Inet4Address.getLocalHost().getHostAddress();

@ -10,6 +10,7 @@ public class HostGamesRequest extends AC35Data{
/** /**
* Constructor * Constructor
* @param knownGames games known by sender
*/ */
public HostGamesRequest(List knownGames) { public HostGamesRequest(List knownGames) {
super(MessageType.HOSTED_GAMES_REQUEST); super(MessageType.HOSTED_GAMES_REQUEST);

@ -90,6 +90,7 @@ public class HostGameController extends Controller {
* Connect to a socket * Connect to a socket
* @param address address of the server * @param address address of the server
* @param port port that the server is run off * @param port port that the server is run off
* @throws IOException socket error
*/ */
public void connectSocket(String address, int port) throws IOException { public void connectSocket(String address, int port) throws IOException {
Socket socket = new Socket(address, port); Socket socket = new Socket(address, port);
@ -99,6 +100,7 @@ public class HostGameController extends Controller {
/** /**
* Menu button pressed. Prompt alert then return to menu * Menu button pressed. Prompt alert then return to menu
* @throws IOException socket error
*/ */
public void menuBtnPressed() throws Exception { public void menuBtnPressed() throws Exception {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION); Alert alert = new Alert(Alert.AlertType.CONFIRMATION);

@ -262,9 +262,6 @@ public class InGameLobbyController extends Controller {
}.start(); }.start();
} }
/**
* Hosts a game.
*/
public void enterGameLobby(Socket socket, boolean isHost){ public void enterGameLobby(Socket socket, boolean isHost){
try { try {
@ -283,6 +280,7 @@ public class InGameLobbyController extends Controller {
/** /**
* Menu button pressed. Prompt alert then return to menu * Menu button pressed. Prompt alert then return to menu
* @throws IOException socket erro
*/ */
public void menuBtnPressed() throws IOException { public void menuBtnPressed() throws IOException {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION); Alert alert = new Alert(Alert.AlertType.CONFIRMATION);

@ -7,22 +7,17 @@ import javafx.scene.control.Button;
import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import network.Messages.HostGame; import network.Messages.HostGame;
import visualiser.app.MatchBrowserSingleton; import visualiser.app.MatchBrowserSingleton;
import visualiser.model.RaceConnection; import visualiser.model.RaceConnection;
import visualiser.network.MatchBrowserClientRunnable;
import visualiser.network.MatchBrowserInterface;
import visualiser.network.MatchBrowserLobbyInterface; import visualiser.network.MatchBrowserLobbyInterface;
import java.io.IOException; import java.io.IOException;
import java.net.DatagramSocket; import java.net.DatagramSocket;
import java.net.Socket; import java.net.Socket;
import java.net.SocketException; import java.net.SocketException;
import java.net.URL;
import java.util.Observable; import java.util.Observable;
import java.util.Observer; import java.util.Observer;
import java.util.ResourceBundle;
/** /**
* Controller for the Lobby for entering games * Controller for the Lobby for entering games
@ -87,6 +82,7 @@ public class LobbyController extends Controller {
/** /**
* Connect to a connection. * Connect to a connection.
* @throws IOException socket error
*/ */
public void connectSocket() throws IOException { public void connectSocket() throws IOException {
RaceConnection connection = lobbyTable.getSelectionModel().getSelectedItem(); RaceConnection connection = lobbyTable.getSelectionModel().getSelectedItem();

@ -38,6 +38,7 @@ public class TitleController extends Controller {
/** /**
* To be implemented at a later date- will open the next scene displaying * To be implemented at a later date- will open the next scene displaying
* games a player can join. Place holder method for now! * games a player can join. Place holder method for now!
* @throws IOException socket error
*/ */
public void joinAGame() throws IOException { public void joinAGame() throws IOException {
loadScene("lobby.fxml"); loadScene("lobby.fxml");

@ -20,6 +20,7 @@ public class SeaSurface {
* @param size size of the sea surface (has to be square for simplicity's sake) * @param size size of the sea surface (has to be square for simplicity's sake)
* @param freq frequency the perlin noise is to be generated at * @param freq frequency the perlin noise is to be generated at
* @param x offset that the sea should be set at position-wise * @param x offset that the sea should be set at position-wise
* @param y offset that the sea should be set at position-wise
* @param z offset that the sea should be set at position-wise * @param z offset that the sea should be set at position-wise
*/ */
public SeaSurface(int size, double freq, double x, double y, double z){ public SeaSurface(int size, double freq, double x, double y, double z){

@ -2,20 +2,18 @@ package visualiser.network;
import network.BinaryMessageEncoder; import network.BinaryMessageEncoder;
import network.Exceptions.InvalidMessageException; import network.Exceptions.InvalidMessageException;
import network.MessageDecoders.HostedGamesRequestDecoder;
import network.MessageEncoders.HostGameMessageEncoder; import network.MessageEncoders.HostGameMessageEncoder;
import network.MessageEncoders.HostedGamesRequestEncoder; import network.MessageEncoders.HostedGamesRequestEncoder;
import network.Messages.AC35Data; import network.Messages.AC35Data;
import network.Messages.Enums.MessageType; import network.Messages.Enums.MessageType;
import network.Messages.HostGamesRequest; import network.Messages.HostGamesRequest;
import shared.model.RunnableWithFramePeriod;
import java.io.IOException; import java.io.IOException;
import java.net.*; import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Enumeration;
import java.util.logging.Level;
import java.util.logging.Logger;
/** /**
* UDP interface for the matchBrowser to send out hosted game info and get in other hosts info * UDP interface for the matchBrowser to send out hosted game info and get in other hosts info
@ -40,6 +38,7 @@ public class MatchBrowserInterface {
* Used by host to send out race information to the server * Used by host to send out race information to the server
* @param gameInfo the hostGame info for message * @param gameInfo the hostGame info for message
* @param socket the udp socket assigned on startup * @param socket the udp socket assigned on startup
* @throws IOException socket error
*/ */
protected void sendOutGameInfo(AC35Data gameInfo, DatagramSocket socket) throws IOException{ protected void sendOutGameInfo(AC35Data gameInfo, DatagramSocket socket) throws IOException{
byte[] fullMessageToSend; byte[] fullMessageToSend;
@ -59,6 +58,8 @@ public class MatchBrowserInterface {
/** /**
* start to send these messages on repeat until game stopped * start to send these messages on repeat until game stopped
* @param gameInfo hostgame data
* @param socket socket to send to
*/ */
public void startSendingHostData(AC35Data gameInfo, DatagramSocket socket){ public void startSendingHostData(AC35Data gameInfo, DatagramSocket socket){
MatchBrowserHostRunnable hostRunnable = new MatchBrowserHostRunnable(this, socket, gameInfo); MatchBrowserHostRunnable hostRunnable = new MatchBrowserHostRunnable(this, socket, gameInfo);
@ -69,6 +70,7 @@ public class MatchBrowserInterface {
/** /**
* Used by a client to setup a connection with the match browser server * Used by a client to setup a connection with the match browser server
* @return the socket created for this connection * @return the socket created for this connection
* @throws IOException socket error
*/ */
public DatagramSocket setupMatchBrowserConnection() throws IOException{ public DatagramSocket setupMatchBrowserConnection() throws IOException{
DatagramSocket clientSocket = new DatagramSocket(); DatagramSocket clientSocket = new DatagramSocket();

@ -27,6 +27,7 @@ public class MatchBrowserLobbyInterface extends Observable {
/** /**
* start receiving game info * start receiving game info
* @param socket to receive from
*/ */
public void startReceivingHostData(DatagramSocket socket) { public void startReceivingHostData(DatagramSocket socket) {
this.socket = socket; this.socket = socket;
@ -37,6 +38,8 @@ public class MatchBrowserLobbyInterface extends Observable {
/** /**
* Used by client to received race information from the server * Used by client to received race information from the server
* @param socket socket to read from
* @throws IOException socket error
*/ */
protected void receiveGameInfo(DatagramSocket socket) throws IOException { protected void receiveGameInfo(DatagramSocket socket) throws IOException {
byte[] data = new byte[64]; byte[] data = new byte[64];
@ -47,7 +50,7 @@ public class MatchBrowserLobbyInterface extends Observable {
try { try {
HostGamesRequest message = (HostGamesRequest) hostedGamesRequestDecoder.decode(data); HostGamesRequest message = (HostGamesRequest) hostedGamesRequestDecoder.decode(data);
games = message.getKnownGames(); games = message.getKnownGames();
System.out.println(games.get(0).getIp()); // System.out.println(games.get(0).getIp());
setChanged(); setChanged();
notifyObservers(); notifyObservers();
} catch (InvalidMessageException e) { } catch (InvalidMessageException e) {
@ -57,6 +60,7 @@ public class MatchBrowserLobbyInterface extends Observable {
/** /**
* Gets the host games * Gets the host games
* @return games to be returned in list
*/ */
public List<HostGame> getGames() { public List<HostGame> getGames() {
return games; return games;

Loading…
Cancel
Save