Class Player


  • public class Player
    extends java.lang.Object
    Class to model the users playing the game. Known Issues: N/A
    • Constructor Summary

      Constructors 
      Constructor Description
      Player​(java.lang.String userName)
      Secondary constructor to instantiate a known player object from the database
      Player​(java.lang.String userName, java.lang.String email, java.lang.String firstName, java.lang.String lastName)
      Constructor made to test the player class
      Player​(java.lang.String userName, java.lang.String email, java.lang.String firstName, java.lang.String lastName, com.google.firebase.firestore.FirebaseFirestore db)
      Primary constructor to instantiate a new player during sign up
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.concurrent.CompletableFuture<java.lang.Boolean> checkIfUserExists​(java.lang.String userName, com.google.firebase.firestore.FirebaseFirestore db)
      Checks if a user exists in the database asynchronously
      java.lang.String getEmail()  
      java.lang.String getFirstName()  
      java.lang.String getLastName()  
      int getNumOfQRCode()  
      int getScore()  
      java.lang.String getUserName()  
      void setEmail​(java.lang.String email)  
      void setFirstName​(java.lang.String firstName)  
      void setLastName​(java.lang.String lastName)  
      void setUserName​(java.lang.String newUserName)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Player

        public Player​(java.lang.String userName,
                      java.lang.String email,
                      java.lang.String firstName,
                      java.lang.String lastName,
                      com.google.firebase.firestore.FirebaseFirestore db)
               throws java.lang.Exception
        Primary constructor to instantiate a new player during sign up
        Parameters:
        userName - username of the player
        email - email of the player
        firstName - first name of the player
        lastName - last name of the player
        db - database reference
        Throws:
        java.lang.Exception - if the username already exists
      • Player

        public Player​(java.lang.String userName)
               throws java.lang.Exception
        Secondary constructor to instantiate a known player object from the database
        Parameters:
        userName - username of the player (already exists)
        Throws:
        java.lang.Exception - if the username does not exist
      • Player

        public Player​(java.lang.String userName,
                      java.lang.String email,
                      java.lang.String firstName,
                      java.lang.String lastName)
        Constructor made to test the player class
        Parameters:
        userName - username of the player (already exists)
        email - email of the player
        firstName - first name of the player
        lastName - last name of the player NOTE: This constructor is only used for testing purposes
    • Method Detail

      • checkIfUserExists

        public java.util.concurrent.CompletableFuture<java.lang.Boolean> checkIfUserExists​(java.lang.String userName,
                                                                                           com.google.firebase.firestore.FirebaseFirestore db)
        Checks if a user exists in the database asynchronously
        Parameters:
        userName - username of the player
        db - database reference
        Returns:
        a future boolean value based on the query
      • getScore

        public int getScore()
      • getNumOfQRCode

        public int getNumOfQRCode()
      • setEmail

        public void setEmail​(java.lang.String email)
      • getEmail

        public java.lang.String getEmail()
      • setLastName

        public void setLastName​(java.lang.String lastName)
      • setFirstName

        public void setFirstName​(java.lang.String firstName)
      • getUserName

        public java.lang.String getUserName()
      • setUserName

        public void setUserName​(java.lang.String newUserName)
      • getFirstName

        public java.lang.String getFirstName()
      • getLastName

        public java.lang.String getLastName()