Class Player

  • All Implemented Interfaces:
    java.io.Serializable

    public class Player
    extends java.lang.Object
    implements java.io.Serializable
    Represents a Player of QRHunter
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Player​(java.lang.String documentId, java.util.UUID deviceId, java.lang.String username, java.lang.String phoneNo, java.lang.String email, java.util.List<java.lang.String> qrCodeHashes, java.util.List<java.util.UUID> following, java.util.List<java.util.UUID> followers)
      This initializes a Player with the firebase document id, deviceId, username, phoneNo, and email.
      Player​(java.util.UUID deviceId, java.lang.String username, java.lang.String phoneNo, java.lang.String email, java.util.List<java.lang.String> qrCodeHashes, java.util.List<java.util.UUID> following, java.util.List<java.util.UUID> followers)
      This initializes a Player with the deviceId, username, phoneNo, and email.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.UUID getDeviceId()
      Get the device id associated with this player
      java.lang.String getDocumentId()
      Get the firebase document id associated with this player
      java.lang.String getEmail()
      Get the email associated with this player
      java.util.List<java.util.UUID> getFollowers()
      Retrieve the device ids of the players this player is being followed by
      java.util.List<java.util.UUID> getFollowing()
      Retrieve the device ids of the players this player is following
      java.lang.String getPhoneNo()
      Get the phone number associated with this player
      android.graphics.Bitmap getProfilePic()
      Generates the user's profile picture using Dicebear
      java.lang.String getProfilePicUrl()  
      java.util.List<java.lang.String> getQRCodeHashes()
      Returns a set of QR code hashes that have been scanned by player
      java.lang.String getUsername()
      Get the username associated with this player
      void setDeviceId​(java.util.UUID deviceId)
      Set the device id associated with this player
      void setDocumentId​(java.lang.String documentId)
      Change the firebase document id associated with this player
      void setEmail​(java.lang.String email)
      Change the email associated with this player
      void setFollowers​(java.util.List<java.util.UUID> followers)
      Set the device ids that this player is being followed by
      void setFollowing​(java.util.List<java.util.UUID> following)
      Set the device ids that this player is following
      void setPhoneNo​(java.lang.String phoneNo)
      Change the phone number associated with this player
      void setQRCodeHashes​(java.util.List<java.lang.String> scannedQRHashes)
      Sets the list of QR code hashes that have been scanned by player
      void setUsername​(java.lang.String username)
      Change the username associated with this player
      • Methods inherited from class java.lang.Object

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

      • Player

        public Player​(java.util.UUID deviceId,
                      java.lang.String username,
                      java.lang.String phoneNo,
                      java.lang.String email,
                      java.util.List<java.lang.String> qrCodeHashes,
                      java.util.List<java.util.UUID> following,
                      java.util.List<java.util.UUID> followers)
        This initializes a Player with the deviceId, username, phoneNo, and email.
        Parameters:
        deviceId - device id
        username - username
        phoneNo - phone no
        email - email
        qrCodeHashes - QRCodes the player has scanned
        following - list of player device ids the player is following
        followers - list of player devicc ids the player is being followed by
      • Player

        public Player​(java.lang.String documentId,
                      java.util.UUID deviceId,
                      java.lang.String username,
                      java.lang.String phoneNo,
                      java.lang.String email,
                      java.util.List<java.lang.String> qrCodeHashes,
                      java.util.List<java.util.UUID> following,
                      java.util.List<java.util.UUID> followers)
        This initializes a Player with the firebase document id, deviceId, username, phoneNo, and email.
        Parameters:
        documentId - firebase document id of the player
        deviceId - device id of the player
        username - username of the player
        phoneNo - phone number of the player
        email - email of the player
        qrCodeHashes - QRCodes the player has scanned
        following - device ids the player is following
        followers - device ids the player is being followed by
    • Method Detail

      • getDocumentId

        public java.lang.String getDocumentId()
        Get the firebase document id associated with this player
        Returns:
        document id
      • setDocumentId

        public void setDocumentId​(java.lang.String documentId)
        Change the firebase document id associated with this player
        Parameters:
        documentId - document id
      • getDeviceId

        public java.util.UUID getDeviceId()
        Get the device id associated with this player
        Returns:
        device id
      • setDeviceId

        public void setDeviceId​(java.util.UUID deviceId)
        Set the device id associated with this player
        Parameters:
        deviceId - device id
      • getUsername

        public java.lang.String getUsername()
        Get the username associated with this player
        Returns:
        username of this player
      • setUsername

        public void setUsername​(java.lang.String username)
        Change the username associated with this player
        Parameters:
        username - username
        Throws:
        java.lang.IllegalArgumentException - if username is not valid
      • getPhoneNo

        public java.lang.String getPhoneNo()
        Get the phone number associated with this player
        Returns:
        phone number
      • setPhoneNo

        public void setPhoneNo​(java.lang.String phoneNo)
        Change the phone number associated with this player
        Parameters:
        phoneNo - phone number of this player
        Throws:
        java.lang.IllegalArgumentException - if phone number is not valid
      • getEmail

        public java.lang.String getEmail()
        Get the email associated with this player
        Returns:
        email
      • setEmail

        public void setEmail​(java.lang.String email)
        Change the email associated with this player
        Parameters:
        email - email associated with this player
      • getQRCodeHashes

        public java.util.List<java.lang.String> getQRCodeHashes()
        Returns a set of QR code hashes that have been scanned by player
        Returns:
        a set of qr code hashes scanned by player
      • setQRCodeHashes

        public void setQRCodeHashes​(java.util.List<java.lang.String> scannedQRHashes)
        Sets the list of QR code hashes that have been scanned by player
        Parameters:
        scannedQRHashes - a list of scanned QR code Hashes associated with player
      • getFollowing

        public java.util.List<java.util.UUID> getFollowing()
        Retrieve the device ids of the players this player is following
        Returns:
        player ids
      • setFollowing

        public void setFollowing​(java.util.List<java.util.UUID> following)
        Set the device ids that this player is following
        Parameters:
        following - new following list
      • getFollowers

        public java.util.List<java.util.UUID> getFollowers()
        Retrieve the device ids of the players this player is being followed by
        Returns:
        player ids
      • setFollowers

        public void setFollowers​(java.util.List<java.util.UUID> followers)
        Set the device ids that this player is being followed by
        Parameters:
        followers - new followers list
      • getProfilePic

        public android.graphics.Bitmap getProfilePic()
                                              throws java.lang.InterruptedException,
                                                     java.util.concurrent.ExecutionException
        Generates the user's profile picture using Dicebear
        Returns:
        A Bitmap of the user's profile picture.
        Throws:
        java.lang.InterruptedException - if failed to retrieve profile picture
        java.util.concurrent.ExecutionException - if failed to retrieve profile picture
      • getProfilePicUrl

        public java.lang.String getProfilePicUrl()
        Returns:
        The profile picture URL of the player