Class QRCode
- java.lang.Object
-
- com.cmput301w23t09.qrhunter.qrcode.QRCode
-
- All Implemented Interfaces:
java.io.Serializable
public class QRCode extends java.lang.Object implements java.io.SerializableThis 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 valueQRCode(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 voidaddComment(Comment comment)This adds a comment to the QR codevoidaddLocation(QRLocation loc)Adds a new location to the list of locations, as long as it's farther than 100m from any existing location.voidaddPhoto(LocationPhoto locationPhoto)This adds a photo taken of the QR codevoidaddPlayer(java.lang.String player)This adds a player that has scanned the QR codevoiddeleteComment(Comment comment)This deletes a comment from the QR codevoiddeletePhoto(LocationPhoto locationPhoto)This deletes a photo taken of the QR codevoiddeletePlayer(java.lang.String player)This removes a player that has scanned the QR codejava.util.ArrayList<Comment>getComments()This returns the comments on the QR codejava.lang.StringgetHash()This returns the hash of the QR codeQRLocationgetLoc()This returns the location of the QR codejava.util.ArrayList<QRLocation>getLocations()Returns all locations of the QR codejava.lang.StringgetName()This returns the name of the QR codejava.util.List<LocationPhoto>getPhotos()This returns the photos taken of the QR codejava.util.List<java.lang.String>getPlayers()This returns the players who have scanned the QR codejava.lang.IntegergetScore()This returns the score of the QR codeandroid.graphics.BitmapgetVisualRepresentation()This returns the visual representation of the QR codejava.lang.StringgetVisualRepresentationUrl()Retrieve the URL of the QRCode of the visual representationvoidremoveLocation(QRLocation loc)Removes a location from the list of locations.voidsetComments(java.util.ArrayList<Comment> comments)This sets the comments on the QR codevoidsetLoc(QRLocation loc)This sets the location of the QR codevoidsetLocations(java.util.ArrayList<QRLocation> locations)Sets the locations of the QR codevoidsetPhotos(java.util.ArrayList<LocationPhoto> photos)This sets the photos of the QR codevoidsetPlayers(java.util.ArrayList<java.lang.String> players)This sets the players who have scanned the QR code
-
-
-
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 codename- This is the name of the QR codescore- This is the score of the QR codeloc- This is the location of the QR codelocations- This is the list of locations the QR was found inlocationPhotos- This is the list of photos of the QR codecomments- This is the list of comments on the QR codeplayers- 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.ExecutionExceptionThis 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 visualjava.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
-
-