DOD, and added javadocs/fixed javadocs #story[1087]

main
Fan-Wu Yang 9 years ago
parent 9eaf24e699
commit 442920f9f6

@ -58,7 +58,8 @@ public class MockOutput implements Runnable
/**
* Ctor.
*
* @param latestMessages Latests Messages that the Mock is to send out
* @param outToVisualiser DataStream to output to Visualisers
* @throws IOException if server socket cannot be opened.
*/
public MockOutput(LatestMessages latestMessages, DataOutputStream outToVisualiser) throws IOException {

@ -19,7 +19,7 @@ import java.net.UnknownHostException;
import java.util.ResourceBundle;
/**
* Created by zwu18 on 25/07/17.
* Controller for Hosting a game.
*/
public class HostController extends Controller {
@ -38,6 +38,10 @@ public class HostController extends Controller {
public void initialize(URL location, ResourceBundle resources) {
}
/**
* Hosts a game
* @throws IOException if socket cannot be connected to
*/
public void hostGamePressed() throws IOException{
try {
Event game = Event.getEvent();
@ -54,6 +58,11 @@ public class HostController extends Controller {
}
}
/**
* Connect to a socket
* @param address address of the server
* @param port port that the server is run off
*/
public void connectSocket(String address, int port) {
try{
Socket socket = new Socket(address, port);
@ -66,6 +75,9 @@ public class HostController extends Controller {
return hostWrapper;
}
/**
* Hosts a game.
*/
public void hostGame(){
hostWrapper.setVisible(true);
System.out.println("Reacted hostGame");

@ -17,7 +17,7 @@ import java.net.URL;
import java.util.ResourceBundle;
/**
* Created by zwu18 on 25/07/17.
* Controller for the Lobby for entering games
*/
public class LobbyController extends Controller {
@ -64,6 +64,9 @@ public class LobbyController extends Controller {
joinGameBtn.setDisable(true);
}
/**
* Refreshes the connections in the lobby
*/
public void refreshBtnPressed(){
for(RaceConnection connection: connections) {
connection.check();
@ -82,6 +85,9 @@ public class LobbyController extends Controller {
} catch (Exception e){}
}
/**
* Connect to a connection.
*/
public void connectSocket() {
try{
RaceConnection connection = lobbyTable.getSelectionModel().getSelectedItem();
@ -113,6 +119,9 @@ public class LobbyController extends Controller {
return lobbyWrapper;
}
/**
* Enter the lobby page.
*/
public void enterLobby(){
lobbyWrapper.setVisible(true);
}

@ -38,6 +38,7 @@ public class MainController extends Controller {
* Transitions from the StartController screen (displays pre-race information) to the RaceController (displays the actual race).
* @param visualiserInput The object used to read packets from the race server.
* @param visualiserRace The object modelling the race.
* @param controllerClient Socket Client that manipulates the controller.
*/
public void beginRace(VisualiserInput visualiserInput, VisualiserRace visualiserRace, ControllerClient controllerClient) {
raceController.startRace(visualiserInput, visualiserRace, controllerClient);

@ -338,6 +338,7 @@ public class RaceController extends Controller {
* Displays a specified race.
* @param visualiserInput Object used to read packets from server.
* @param visualiserRace Object modelling the race.
* @param controllerClient Socket Client that manipulates the controller.
*/
public void startRace(VisualiserInput visualiserInput, VisualiserRace visualiserRace, ControllerClient controllerClient) {

@ -43,6 +43,9 @@ public class TitleController extends Controller {
App.getStage().setResizable(true);
}
/**
* Switch the scene to the title page.
*/
public void enterTitle(){
titleWrapper.setVisible(true);
}
@ -57,12 +60,18 @@ public class TitleController extends Controller {
App.getStage().setResizable(true);
}
/**
* Switches the css of the program to day mode theme
*/
public void setDayMode(){
dayModeRD.getScene().getStylesheets().clear();
dayModeRD.getScene().getStylesheets().add("/css/dayMode.css");
nightModeRD.setSelected(false);
}
/**
* Switches the css of the program to night mode theme
*/
public void setNightMode(){
nightModeRD.getScene().getStylesheets().clear();
nightModeRD.getScene().getStylesheets().add("/css/nightMode.css");

@ -8,7 +8,7 @@ import java.net.InetSocketAddress;
import java.net.Socket;
/**
* Created by cbt24 on 3/05/17.
* Connection for Races
*/
public class RaceConnection {
private final StringProperty hostname;
@ -21,6 +21,7 @@ public class RaceConnection {
* Constructor for remote host connections.
* @param hostname URL for remote host
* @param port port for game feed
* @param gamename Name of the game
*/
public RaceConnection(String hostname, int port, String gamename) {
this.hostname = new SimpleStringProperty(hostname);

Loading…
Cancel
Save