Package edu.wisc.game.rest
Class PlayerResponse
java.lang.Object
edu.wisc.game.rest.ResponseBase
edu.wisc.game.rest.PlayerResponse
The object returned by the /player call. This is the call that's
used at the beginning (or resumption) of a series, to create
a new player entry in the database or find an existing one.
-
Method Summary
Modifier and TypeMethodDescriptionstatic PlayerInfo
findPlayerInfo
(javax.persistence.EntityManager em, String pid) Find the matching record for a player, in the cache of the database.boolean
True if this player has finished all episodes he could play.boolean
Are we playing an adversarial 2PG?boolean
Are we playing a cooperative two-player game (2PG)?boolean
Are we playing a 2PG? (A 2PG may be adversarial or cooperative)boolean
Do we need a between-player chat element in the GUI? (In 2PG only, based on para.chatboolean
static void
Handy testingvoid
setPlayerId
(String _playerId)
-
Method Details
-
getNewlyRegistered
public boolean getNewlyRegistered() -
getTrialListId
-
getTrialList
-
getPlayerId
-
setPlayerId
-
getPlayerInfo
-
getAlreadyFinished
public boolean getAlreadyFinished()True if this player has finished all episodes he could play. This means that the most recent episode has been completed, and no more new episodes can be created. -
getCompletionCode
-
getExperimentPlan
-
getIsCoopGame
public boolean getIsCoopGame()Are we playing a cooperative two-player game (2PG)? -
getIsAdveGame
public boolean getIsAdveGame()Are we playing an adversarial 2PG? -
getIsTwoPlayerGame
public boolean getIsTwoPlayerGame()Are we playing a 2PG? (A 2PG may be adversarial or cooperative) -
getNeedChat
public boolean getNeedChat()Do we need a between-player chat element in the GUI? (In 2PG only, based on para.chat -
findPlayerInfo
public static PlayerInfo findPlayerInfo(javax.persistence.EntityManager em, String pid) throws IOException, IllegalInputException, ReflectiveOperationException, RuleParseException Find the matching record for a player, in the cache of the database. First looks it up in the local cache; then, if not found, in the SQL database. The main block is synchronized, to ensure that we don't put duplicate copies of a database entry into the cache.- Parameters:
em
- The EntityManager to use, if needed. If null is given, the EM will be created when needed, and then closed, so that the returned object will be detached.- Returns:
- The PlayerInfo object with the matching name, or null if none is found
- Throws:
IOException
IllegalInputException
ReflectiveOperationException
RuleParseException
-
main
Handy testing- Throws:
Exception
-