Commit 29470c3d authored by Winfried Lötzsch's avatar Winfried Lötzsch

Merge branch 'more-javadoccccc' into 'master'

More javadoccccc



See merge request !18
parents 2e23f489 e6ad1616
......@@ -7,7 +7,6 @@ import java.net.InetAddress;
/**
* dataType which represents all configurable parameters for the client/ui
*
* @author matthias
*/
public class ClientConfig extends ConfigParameters {
......
......@@ -78,7 +78,7 @@ public class CwClient implements IClient, ITcpListener {
} else if (type == CwMessageType.GameStatus) {
callback.receiveGameStatusTelegram(interpreter.parseGameStatusMessage(data));
} else if (type == CwMessageType.GameResult) {
callback.receiveGameResultTelegram(interpreter.parseGameResultMessage(data));
callback.receiveGameResultTelegram(interpreter.parseGameResultMessage(data));
} else {
// TODO: print that to log file
System.out.print("unknown or invalid message type");
......
package gone.lib.network.json;
/**
* Created by winfr on 30.09.2016.
* message type the clients receive if the game ends
*
* @author winfried
*/
public class CwGameResultContent {
public String state;
......
package gone.lib.network.json;
/**
* Created by winfr on 26.08.2016.
* message type that will be sent regularly from the server
* to the client, which represents the game update of one
* single game step at the server
*
* @author winfried
*/
public class CwGameStatusContent {
public int indexOfChangedCoreElement;
......
......@@ -3,7 +3,10 @@ package gone.lib.network.json;
import gone.lib.common.ClientRole;
/**
* Created by winfr on 23.08.2016.
* message type that will be sent from the client to
* the server to establish a login on the server
*
* @author winfried
*/
public class CwLoginContent {
public String name;
......
......@@ -3,7 +3,10 @@ package gone.lib.network.json;
import gone.lib.common.RcStandard;
/**
* Created by winfr on 27.09.2016.
* message type that receives the client from the server
* if the previous login of the client was successful
*
* @author winfried
*/
public class CwLoginOkContent {
public boolean clientMustWait;
......
package gone.lib.network.json;
/**
* Created by winfr on 23.08.2016.
*/
public class CwMessageBase {
public String packageType;
public int version;
}
package gone.lib.network.json;
/**
* Created by winfr on 26.08.2016.
* collection of the different message types including an
* unknown message type to deal with errors
*
* @author winfried
*/
public enum CwMessageType {
Login,
......
......@@ -3,7 +3,10 @@ package gone.lib.network.json;
import java.util.List;
/**
* Created by Winfried on 22.09.2016.
* message type to send the warrior code from the client
* to the server
*
* @author Winfried
*/
public class CwReadyContent {
public List<String> warriorRedcode;
......
......@@ -3,7 +3,11 @@ package gone.lib.network.json;
import java.util.List;
/**
* Created by winfr on 26.08.2016.
* message type to send the changes of the
* server core initiation and the count of the competing players
* from the server to the client
*
* @author winfried
*/
public class CwStartContent {
public int players;
......
......@@ -23,9 +23,17 @@ import java.util.LinkedList;
import java.util.List;
/**
* Created by winfr on 23.08.2016.
* this class
*
* @author winfried
*/
public class IncomingMessagesInterpreter {
/**
*
* @param data
* @return
*/
public CwMessageType getMessageType(String data) {
JSONObject object = new JSONObject(data);
......@@ -42,7 +50,6 @@ public class IncomingMessagesInterpreter {
} else if (object.getString("packageType").equals("finish")) {
return CwMessageType.GameResult;
}
return CwMessageType.Unknown;
}
......@@ -58,7 +65,6 @@ public class IncomingMessagesInterpreter {
} else if (object.getJSONObject("content").getString("standard").equals("Viewer")) {
result.role = ClientRole.Viewer;
}
return result;
}
......@@ -68,7 +74,6 @@ public class IncomingMessagesInterpreter {
CwStartContent result = new CwStartContent();
String[] fullStateArray = object.getJSONObject("content")
.getString("fullState").split(NetworkConstants.FULLSTATESEPARATOR);
List<String> fullStateList = new LinkedList<>();
......@@ -95,7 +100,6 @@ public class IncomingMessagesInterpreter {
} else if (object.getJSONObject("content").getString("standard").equals("ICWS94")) {
result.standard = RcStandard.ICWS94;
}
return result;
}
......
......@@ -20,6 +20,11 @@ public class TcpClientModule implements ITcpClientModule, ITcpListener {
private Socket clientSocket;
private List<ITcpListener> listeners = new LinkedList<>();
/**
* connects to a remote server
* @param address
* @param port
*/
@Override
public void connect(String address, int port) {
try {
......
......@@ -27,6 +27,9 @@ public class TcpReceiveMessage implements Runnable {
listeners.add(listener);
}
/**
* Asynchronously receives incoming messages
*/
@Override
public void run() {
try {
......
......@@ -28,6 +28,9 @@ public class TcpServerAccept implements Runnable {
this.accepted = accepted;
}
/**
* Asynchronously wait for incoming clients
*/
@Override
public void run() {
try {
......
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