Class QRCode

  • All Implemented Interfaces:
    java.io.Serializable

    public class QRCode
    extends java.lang.Object
    implements java.io.Serializable
    This class defines a QR code
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      QRCode​(java.lang.String hash)
      Initializes a *newly-scanned* QRCode using only its hash value
      QRCode​(java.lang.String hash, java.lang.String name, java.lang.Integer score, QRLocation loc, java.util.ArrayList<QRLocation> locations, java.util.ArrayList<LocationPhoto> locationPhotos, java.util.ArrayList<Comment> comments, java.util.ArrayList<java.lang.String> players)
      This initializes a QR code with its hash, name, visual representation, score, location, photo, comments, and players who have scanned it
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addComment​(Comment comment)
      This adds a comment to the QR code
      void addLocation​(QRLocation loc)
      Adds a new location to the list of locations, as long as it's farther than 100m from any existing location.
      void addPhoto​(LocationPhoto locationPhoto)
      This adds a photo taken of the QR code
      void addPlayer​(java.lang.String player)
      This adds a player that has scanned the QR code
      void deleteComment​(Comment comment)
      This deletes a comment from the QR code
      void deletePhoto​(LocationPhoto locationPhoto)
      This deletes a photo taken of the QR code
      void deletePlayer​(java.lang.String player)
      This removes a player that has scanned the QR code
      java.util.ArrayList<Comment> getComments()
      This returns the comments on the QR code
      java.lang.String getHash()
      This returns the hash of the QR code
      QRLocation getLoc()
      This returns the location of the QR code
      java.util.ArrayList<QRLocation> getLocations()
      Returns all locations of the QR code
      java.lang.String getName()
      This returns the name of the QR code
      java.util.List<LocationPhoto> getPhotos()
      This returns the photos taken of the QR code
      java.util.List<java.lang.String> getPlayers()
      This returns the players who have scanned the QR code
      java.lang.Integer getScore()
      This returns the score of the QR code
      android.graphics.Bitmap getVisualRepresentation()
      This returns the visual representation of the QR code
      java.lang.String getVisualRepresentationUrl()
      Retrieve the URL of the QRCode of the visual representation
      void removeLocation​(QRLocation loc)
      Removes a location from the list of locations.
      void setComments​(java.util.ArrayList<Comment> comments)
      This sets the comments on the QR code
      void setLoc​(QRLocation loc)
      This sets the location of the QR code
      void setLocations​(java.util.ArrayList<QRLocation> locations)
      Sets the locations of the QR code
      void setPhotos​(java.util.ArrayList<LocationPhoto> photos)
      This sets the photos of the QR code
      void setPlayers​(java.util.ArrayList<java.lang.String> players)
      This sets the players who have scanned the QR code
      • Methods inherited from class java.lang.Object

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

      • QRCode

        public QRCode​(java.lang.String hash)
        Initializes a *newly-scanned* QRCode using only its hash value
        Parameters:
        hash - The hash of the newly-scanned QRCode
      • QRCode

        public QRCode​(java.lang.String hash,
                      java.lang.String name,
                      java.lang.Integer score,
                      QRLocation loc,
                      java.util.ArrayList<QRLocation> locations,
                      java.util.ArrayList<LocationPhoto> locationPhotos,
                      java.util.ArrayList<Comment> comments,
                      java.util.ArrayList<java.lang.String> players)
        This initializes a QR code with its hash, name, visual representation, score, location, photo, comments, and players who have scanned it
        Parameters:
        hash - This is the hash of the QR code
        name - This is the name of the QR code
        score - This is the score of the QR code
        loc - This is the location of the QR code
        locations - This is the list of locations the QR was found in
        locationPhotos - This is the list of photos of the QR code
        comments - This is the list of comments on the QR code
        players - This is the list of players (documentIDs) that have scanned the QR code
    • Method Detail

      • getHash

        public java.lang.String getHash()
        This returns the hash of the QR code
        Returns:
        Return the hash of the QR code
      • getName

        public java.lang.String getName()
        This returns the name of the QR code
        Returns:
        Return the name of the QR code
      • getScore

        public java.lang.Integer getScore()
        This returns the score of the QR code
        Returns:
        Return the score of the QR code
      • getVisualRepresentation

        public android.graphics.Bitmap getVisualRepresentation()
                                                        throws java.lang.InterruptedException,
                                                               java.util.concurrent.ExecutionException
        This returns the visual representation of the QR code
        Returns:
        Return the visual representation of the QR code
        Throws:
        java.lang.InterruptedException - if failed to retrieve visual
        java.util.concurrent.ExecutionException - if failed to retrieve visual
      • getVisualRepresentationUrl

        public java.lang.String getVisualRepresentationUrl()
        Retrieve the URL of the QRCode of the visual representation
        Returns:
        The URL of the QRCode's visual representation
      • getLoc

        public QRLocation getLoc()
        This returns the location of the QR code
        Returns:
        Return the location of the QR code
      • setLoc

        public void setLoc​(QRLocation loc)
        This sets the location of the QR code
        Parameters:
        loc - This is the location to set to
      • getLocations

        public java.util.ArrayList<QRLocation> getLocations()
        Returns all locations of the QR code
        Returns:
        An ArrayList of this QR code's locations
      • setLocations

        public void setLocations​(java.util.ArrayList<QRLocation> locations)
        Sets the locations of the QR code
        Parameters:
        locations - The locations of the QRCode
      • addLocation

        public void addLocation​(QRLocation loc)
        Adds a new location to the list of locations, as long as it's farther than 100m from any existing location.
        Parameters:
        loc - New location to add
      • removeLocation

        public void removeLocation​(QRLocation loc)
        Removes a location from the list of locations.
        Parameters:
        loc - Location to remove
      • getPhotos

        public java.util.List<LocationPhoto> getPhotos()
        This returns the photos taken of the QR code
        Returns:
        Return the photos taken of the QR code
      • getPlayers

        public java.util.List<java.lang.String> getPlayers()
        This returns the players who have scanned the QR code
        Returns:
        Return the player who have scanned the QR code
      • setPlayers

        public void setPlayers​(java.util.ArrayList<java.lang.String> players)
        This sets the players who have scanned the QR code
        Parameters:
        players - The players that have scanned the QR code
      • addPlayer

        public void addPlayer​(java.lang.String player)
        This adds a player that has scanned the QR code
        Parameters:
        player - This is the player to add
      • deletePlayer

        public void deletePlayer​(java.lang.String player)
        This removes a player that has scanned the QR code
        Parameters:
        player - This is the player to delete
      • getComments

        public java.util.ArrayList<Comment> getComments()
        This returns the comments on the QR code
        Returns:
        Return the comments on the QR code
      • setComments

        public void setComments​(java.util.ArrayList<Comment> comments)
        This sets the comments on the QR code
        Parameters:
        comments - The comments on the QR code
      • addComment

        public void addComment​(Comment comment)
        This adds a comment to the QR code
        Parameters:
        comment - This is the comment to add
      • deleteComment

        public void deleteComment​(Comment comment)
        This deletes a comment from the QR code
        Parameters:
        comment - This is the comment to delete
      • setPhotos

        public void setPhotos​(java.util.ArrayList<LocationPhoto> photos)
        This sets the photos of the QR code
        Parameters:
        photos - The photos on the QR code
      • addPhoto

        public void addPhoto​(LocationPhoto locationPhoto)
        This adds a photo taken of the QR code
        Parameters:
        locationPhoto - This is the photo to add
      • deletePhoto

        public void deletePhoto​(LocationPhoto locationPhoto)
        This deletes a photo taken of the QR code
        Parameters:
        locationPhoto - This is the photo to delete