Class Player
- java.lang.Object
-
- com.cmput301w23t09.qrhunter.player.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 playerjava.lang.String
getDocumentId()
Get the firebase document id associated with this playerjava.lang.String
getEmail()
Get the email associated with this playerjava.util.List<java.util.UUID>
getFollowers()
Retrieve the device ids of the players this player is being followed byjava.util.List<java.util.UUID>
getFollowing()
Retrieve the device ids of the players this player is followingjava.lang.String
getPhoneNo()
Get the phone number associated with this playerandroid.graphics.Bitmap
getProfilePic()
Generates the user's profile picture using Dicebearjava.lang.String
getProfilePicUrl()
java.util.List<java.lang.String>
getQRCodeHashes()
Returns a set of QR code hashes that have been scanned by playerjava.lang.String
getUsername()
Get the username associated with this playervoid
setDeviceId(java.util.UUID deviceId)
Set the device id associated with this playervoid
setDocumentId(java.lang.String documentId)
Change the firebase document id associated with this playervoid
setEmail(java.lang.String email)
Change the email associated with this playervoid
setFollowers(java.util.List<java.util.UUID> followers)
Set the device ids that this player is being followed byvoid
setFollowing(java.util.List<java.util.UUID> following)
Set the device ids that this player is followingvoid
setPhoneNo(java.lang.String phoneNo)
Change the phone number associated with this playervoid
setQRCodeHashes(java.util.List<java.lang.String> scannedQRHashes)
Sets the list of QR code hashes that have been scanned by playervoid
setUsername(java.lang.String username)
Change the username associated with this player
-
-
-
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 idusername
- usernamephoneNo
- phone noemail
- emailqrCodeHashes
- QRCodes the player has scannedfollowing
- list of player device ids the player is followingfollowers
- 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 playerdeviceId
- device id of the playerusername
- username of the playerphoneNo
- phone number of the playeremail
- email of the playerqrCodeHashes
- QRCodes the player has scannedfollowing
- device ids the player is followingfollowers
- 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:
-
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 picturejava.util.concurrent.ExecutionException
- if failed to retrieve profile picture
-
getProfilePicUrl
public java.lang.String getProfilePicUrl()
- Returns:
- The profile picture URL of the player
-
-