java.lang.Object
view.data.ViewSharedData
- All Implemented Interfaces:
Observer
-
Constructor Summary
ConstructorsConstructorDescriptionViewSharedData(ViewModel viewModel) The ViewSharedData function is a constructor for the ViewSharedData class. -
Method Summary
Modifier and TypeMethodDescriptionThe getCalculationServer function returns the calculationServer object.booleangetHost()The getHost function returns the boolean value of isHost.The getHostIp function returns the hostIp variable.intThe getHostPort function returns the port number of the host.The getPlayer function returns the player object.The getViewModel function returns the viewModel object.voidsetCalculationServer(MyServer calculationServer) The setCalculationServer function sets the calculationServer variable to a new MyServer object.voidsetGameModelReceiver(GameModelReceiver gameModelReceiver) The setGameModelReceiver function is used to set the gameModelReceiver variable.voidsetHost(boolean host) The setHost function sets the isHost variable to true or false.voidThe setHostIp function sets the hostIp variable to a new value.voidsetHostPort(int hostPort) The setHostPort function sets the hostPort variable to the value of its parameter.voidThe setPlayer function sets the player variable to a new Client object.voidsetPlayerName(String playerName) The setPlayerName function sets the player's name to a new value.voidupdate(Observable o, Object arg) The update function is called by the Observable object when it has changed.
-
Constructor Details
-
ViewSharedData
The ViewSharedData function is a constructor for the ViewSharedData class. It takes in a ViewModel object and sets it to be the viewModel of this instance of ViewSharedData. It also initializes all other fields to null or false, depending on their type.- Parameters:
viewModel- viewModel Update the view
-
-
Method Details
-
getViewModel
The getViewModel function returns the viewModel object.- Returns:
- The viewModel
-
setPlayer
The setPlayer function sets the player variable to a new Client object.- Parameters:
player- player Set the player variable to the client object that is passed in
-
getPlayer
The getPlayer function returns the player object.- Returns:
- The player variable
-
setHostIp
The setHostIp function sets the hostIp variable to a new value.- Parameters:
hostIp- hostIp Set the host ip address
-
getHostIp
The getHostIp function returns the hostIp variable.- Returns:
- The hostIp
-
setHost
public void setHost(boolean host) The setHost function sets the isHost variable to true or false.- Parameters:
host- host Determine whether the user is a host or not
-
getHost
public boolean getHost()The getHost function returns the boolean value of isHost.- Returns:
- The value of the isHost variable
-
setCalculationServer
The setCalculationServer function sets the calculationServer variable to a new MyServer object.- Parameters:
calculationServer- calculationServer Set the calculationServer variable in this class
-
getCalculationServer
The getCalculationServer function returns the calculationServer object.- Returns:
- The calculationServer object
-
setPlayerName
The setPlayerName function sets the player's name to a new value.- Parameters:
playerName- playerName Set the playerName variable
-
setHostPort
public void setHostPort(int hostPort) The setHostPort function sets the hostPort variable to the value of its parameter.- Parameters:
hostPort- hostPort Set the hostPort variable
-
getHostPort
public int getHostPort()The getHostPort function returns the port number of the host.- Returns:
- The hostPort variable
-
setGameModelReceiver
The setGameModelReceiver function is used to set the gameModelReceiver variable.- Parameters:
gameModelReceiver- gameModelReceiver Set the gameModelReceiver variable to the parameter
-
update
The update function is called by the Observable object when it has changed. The update function then updates the viewModel with a new model from the gameModelReceiver.
-