public class ServerController
extends java.lang.Object
implements java.lang.Runnable
| Modifier and Type | Field and Description |
|---|---|
DataStorage |
data |
(package private) NetworkConnectorForServer |
network |
(package private) java.lang.Thread |
thread |
| Constructor and Description |
|---|
ServerController()
The Constructor It starts this class in a new thread
|
| Modifier and Type | Method and Description |
|---|---|
java.util.ArrayList<java.lang.Integer> |
getStartCore() |
java.lang.Integer |
getWinner() |
void |
renderGame(java.util.ArrayList<Warrior> warriors,
java.util.Queue<CoreChange> queue)
if you want to compute a game call this method
only give it a queue and the code of the players
|
void |
run()
This method is running all the time and keeps the system working and
changes the data on the website on witch everyone sets up his server
|
void |
setCodeForPlayerName(java.lang.String playerName,
java.lang.String code)
if an client send you code, you can set it up for a specific player
you only should give me the name of the player
|
void |
setConfig(java.lang.String std,
java.lang.Integer coreSize,
java.lang.Integer maxInstructions,
java.lang.Integer gameCycles)
With this method the Core would be configured if the server sends the
config-data
|
void |
setFirstFrame(java.util.ArrayList<java.lang.Integer> core)
If the first frame of the core has been received the data will be saved
with this method
|
java.lang.Boolean |
setNewConnectedPerson(java.lang.String name,
GameMode role)
It saves a clients' data and looks for the name usage
if the name already exists you can't set up a new player with this method
|
void |
startServerConnection(int serverPort)
This method is for binding the Client to the Server
|
java.lang.Thread thread
NetworkConnectorForServer network
public DataStorage data
public ServerController()
public void run()
run in interface java.lang.Runnablepublic void startServerConnection(int serverPort)
serverPort - This parameter has to be the Port of the Server you want to
connect topublic void setFirstFrame(java.util.ArrayList<java.lang.Integer> core)
core - This parameter keeps the information at which position
someones code is writtenplayers - This is a List of all players wo are playing at the momentpublic void setConfig(java.lang.String std,
java.lang.Integer coreSize,
java.lang.Integer maxInstructions,
java.lang.Integer gameCycles)
std - -->GamestandartcoreSize - -->The size of the CoremaxInstructions - -->The maximum commands of the codegameCycles - --> The number of game cyclespublic java.lang.Boolean setNewConnectedPerson(java.lang.String name,
GameMode role)
name - role - public void setCodeForPlayerName(java.lang.String playerName,
java.lang.String code)
playerName - code - public void renderGame(java.util.ArrayList<Warrior> warriors, java.util.Queue<CoreChange> queue)
warriors - the warriors you have to send to the server have to be of kind Warriorqueue - it is call by reference so the queue you set up into is changed for youpublic java.util.ArrayList<java.lang.Integer> getStartCore()
public java.lang.Integer getWinner()