Package it.polimi.ingsw.view
Class Player
java.lang.Object
java.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
it.polimi.ingsw.view.Player
- All Implemented Interfaces:
Serializable
,Remote
class which represent the parent of PlayerGUI and PlayerTUI. Immutable
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionthe name of the player currently having his turnthe board seen and used by this playerthe name of the chairman of the gameprotected boolean
protected boolean
protected boolean
protected boolean
protected String
protected ObjectInputStream
boolean
true iff the player is the chairman of this gamelist of the libraries of all the players in the gamethe personal library of this playerprotected Socket
protected String
the network mode chosen by the userint
number of players in this current gameprotected PrivateObjective
protected ObjectOutputStream
static final int
timer for pinging the socket from client to serverpoints achieved until now with the common objectives by all the other players: (name, points)int
points achieved until now with the common objectivesstatic final boolean
variable that chooses from debugging or runningprotected Thread
the UI mode chosen by the user - not sure if necessaryFields inherited from class java.rmi.server.RemoteObject
ref
-
Constructor Summary
ConstructorsConstructorDescriptionPlayer()
constructor used by the server to initializer a base Player objectcopy constructor for the Player objectPlayer
(PlayerSend p) constructor that built a Player object from an old PlayerSend Object (used for persistence) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
checkRawCoords
(String[] s) Check if the input by the user is correctvoid
Clone the player on the client in the player on the serverprotected boolean
doesPlayerExists
(String name) check if the name of a player exists in the game (used by the chat)boolean
getter for the first common objectiveboolean
getter for the second common objectiveboolean
getter for the endGamegetter for the full chatgetter for the socket input stream (from the server)boolean
getter for the isChairMangetName()
getter for the nameGetter for the private objectiveprotected void
take the cards from the board and transfer them in the player libraryvoid
setIsChairMan
(boolean b) setter for the attribute isChairManvoid
setter for the attribute namevoid
setter for the POMethods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObject
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
-
Field Details
-
pingTimeout
public static final int pingTimeouttimer for pinging the socket from client to server- See Also:
-
showErrors
public static final boolean showErrorsvariable that chooses from debugging or running- See Also:
-
name
-
objective
-
librariesOfOtherPlayers
list of the libraries of all the players in the game -
board
the board seen and used by this player -
library
the personal library of this player -
isChairMan
public boolean isChairMantrue iff the player is the chairman of this game -
inStream
-
outStream
-
mySocket
-
fullChat
-
chairmanName
the name of the chairman of the game -
netMode
the network mode chosen by the user -
uiMode
the UI mode chosen by the user - not sure if necessary -
numPlayers
public int numPlayersnumber of players in this current game -
CO_1_Done
protected boolean CO_1_Done -
CO_2_Done
protected boolean CO_2_Done -
activeName
the name of the player currently having his turn -
pointsUntilNow
public int pointsUntilNowpoints achieved until now with the common objectives -
endGame
protected boolean endGame -
pointsMap
points achieved until now with the common objectives by all the other players: (name, points) -
closed
protected boolean closed -
turnThread
-
-
Constructor Details
-
Player
constructor used by the server to initializer a base Player object- Throws:
RemoteException
- exc
-
Player
copy constructor for the Player object- Parameters:
p
- the Player object to copy- Throws:
RemoteException
- exc
-
Player
constructor that built a Player object from an old PlayerSend Object (used for persistence)- Parameters:
p
- the old PlayerObject that was saved on the server- Throws:
RemoteException
- exc
-
-
Method Details
-
clone
Clone the player on the client in the player on the server- Parameters:
p
- the Player that will be cloned in the current Object
-
checkRawCoords
Check if the input by the user is correct- Parameters:
s
- array of the coordinates- Returns:
- true if the input is correct
-
doesPlayerExists
check if the name of a player exists in the game (used by the chat)- Parameters:
name
- the name to check in this game- Returns:
- true iff that player actually exists in the current game
-
pickCards
take the cards from the board and transfer them in the player library- Parameters:
coord
- the list of coupled coordinates of the cards that the player want to take from the board
-
setPrivateObjective
setter for the PO- Parameters:
obj
- the PO that needs to be set
-
setName
setter for the attribute name- Parameters:
n
- the name to set
-
setIsChairMan
public void setIsChairMan(boolean b) setter for the attribute isChairMan- Parameters:
b
- the boolean to set
-
getInStream
getter for the socket input stream (from the server)- Returns:
- the input stream of this player
-
getName
getter for the name- Returns:
- the name of the player
-
getIsChairMan
public boolean getIsChairMan()getter for the isChairMan- Returns:
- if is chairman
-
getCO_1_Done
public boolean getCO_1_Done()getter for the first common objective- Returns:
- the first common objective
-
getCO_2_Done
public boolean getCO_2_Done()getter for the second common objective- Returns:
- the second common objective
-
getFullChat
getter for the full chat- Returns:
- the full chat until now
-
getEndGame
public boolean getEndGame()getter for the endGame- Returns:
- if the game is in endGame
-
getPrivateObjective
Getter for the private objective- Returns:
- the private objective of the player
-