Class Wallet


  • public class Wallet
    extends java.lang.Object
    Class to model a Player's Wallet in the game. Purpose of the Wallet is to hold the QRCodes that the player has collected throughout. Issues: Pending integration for some of the methods
    • Constructor Summary

      Constructors 
      Constructor Description
      Wallet​(java.lang.String user, java.util.ArrayList<QRCode> qrCodes, int score, com.google.firebase.firestore.FirebaseFirestore db)
      Constructor for the Wallet class
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addQRCode​(QRCode qr, java.lang.String lat, java.lang.String lon, java.lang.String comment)
      Adds a QR code to the wallet
      void deleteQRCode​(QRCode qr)
      Deletes a QR code from the users wallet, updates relevant info afterwards
      int getInitialQRCodeCount()
      Allows us to get the users total QR codes scanned from previous runs of the app
      int getInitialScore()
      Allows us to get the total score of the QR codes scanned from previous runs of the app by the player
      java.util.ArrayList<QRCode> getQrCodes()
      getter for the player's scanned QR codes
      int getQrCodesCount()
      getter for the player's scanned QR codes count
      int getScore()
      getter for the player score
      java.lang.String getUsername()  
      boolean haveQRCode​(QRCode qr)
      Checks whether the user has already scanned the QR code
      • Methods inherited from class java.lang.Object

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

      • Wallet

        public Wallet​(java.lang.String user,
                      java.util.ArrayList<QRCode> qrCodes,
                      int score,
                      com.google.firebase.firestore.FirebaseFirestore db)
        Constructor for the Wallet class
        Parameters:
        user - the username of the user
        qrCodes - the list of QR codes that the user has collected
        score - the score of the user
    • Method Detail

      • getUsername

        public java.lang.String getUsername()
      • addQRCode

        public void addQRCode​(QRCode qr,
                              java.lang.String lat,
                              java.lang.String lon,
                              java.lang.String comment)
        Adds a QR code to the wallet
        Parameters:
        qr - the QRCode Object to be added
        lat - the latitude of the location where the QR code was scanned
        lon - the longitude of the location where the QR code was scanned
      • deleteQRCode

        public void deleteQRCode​(QRCode qr)
        Deletes a QR code from the users wallet, updates relevant info afterwards
        Parameters:
        qr - the QR code object that is to be deleted
      • getInitialQRCodeCount

        public int getInitialQRCodeCount()
        Allows us to get the users total QR codes scanned from previous runs of the app
        Returns:
        the total number of QR codes the player has scanned
      • getInitialScore

        public int getInitialScore()
        Allows us to get the total score of the QR codes scanned from previous runs of the app by the player
        Returns:
        the total score of the QR codes the player has scanned
      • getScore

        public int getScore()
        getter for the player score
        Returns:
        the players score
      • getQrCodesCount

        public int getQrCodesCount()
        getter for the player's scanned QR codes count
        Returns:
        the number of scanned QRCodes
      • getQrCodes

        public java.util.ArrayList<QRCode> getQrCodes()
        getter for the player's scanned QR codes
        Returns:
        list of scanned QRCode objects
      • haveQRCode

        public boolean haveQRCode​(QRCode qr)
        Checks whether the user has already scanned the QR code
        Parameters:
        qr - the QR object to verify
        Returns:
        boolean based on result