Class QualificationRound
java.lang.Object
edu.ntnu.idatt1002.k2g05.models.rounds.Round
edu.ntnu.idatt1002.k2g05.models.rounds.QualificationRound
- All Implemented Interfaces:
Serializable
Round where each player plays an amount given amount of
Game
, and an accumulative sum of all rounds are
created.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionQualificationRound
(String name) Constructor for creating an instance of the given class.QualificationRound
(String name, int playsPerPlayer) Constructor for creating an instance of the class. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Method for adding game to the round.void
clear()
Method for clearing the round of games.Method for getting all the games in the roundgetGameByPlayer
(Player player) Method for getting a Game given the player that has played it.getGamesByNameSearch
(String search, int threshold) Method for returning a list over results given a search query by name.int
getTopGames
(int n) Method for getting the top n games in the round, "top" is defined by the sum that the game has If the n-th player and the n+1-th player has the same point score it will be up to the previous sorted arrangement of the games.boolean
removeGame
(Game game) Removes the first occurrence of a game from this round, if it is present.void
Method for sorting the games in the round given a sort typevoid
Method for sorting the games in the round given a sort type, and if it should be reversed.
-
Constructor Details
-
QualificationRound
Constructor for creating an instance of the given class. Plays per player will be defaulted to 6.- Parameters:
name
- of the round, can not be null
-
QualificationRound
Constructor for creating an instance of the class.- Parameters:
name
- of the round.playsPerPlayer
- amount of games a player is going to play.
-
-
Method Details
-
addGame
Method for adding game to the round.- Parameters:
game
- to be added ot the list- Returns:
true
(as specified byCollection.add(E)
)- Throws:
NullPointerException
- if the specified game is null
-
removeGame
Removes the first occurrence of a game from this round, if it is present. If this round does not contain the game, it is unchanged. Returnstrue
if this list contained the specified game (or equivalently, if this round changed as a result of the call).- Parameters:
game
- to be removed- Returns:
true
if this round contained the specified game
-
getAllGames
Method for getting all the games in the round- Returns:
-
getGamesByNameSearch
Method for returning a list over results given a search query by name. A fuzzy search algorithm is used so the user does not have to write the exact player name.- Parameters:
search
- to be filtered bythreshold
- of the fuzzy search, the higher the value the more specific a search has to be. Threshold must be between 0 and 100- Returns:
- the results of the search.
-
getGameByPlayer
Method for getting a Game given the player that has played it.- Parameters:
player
-- Returns:
-
getTopGames
Method for getting the top n games in the round, "top" is defined by the sum that the game has If the n-th player and the n+1-th player has the same point score it will be up to the previous sorted arrangement of the games.- Parameters:
n
- amount of top players to get- Returns:
- n top players
-
getPlaysPerPlayer
public int getPlaysPerPlayer() -
sort
Method for sorting the games in the round given a sort type- Parameters:
sortType
- to sort by.
-
sort
Method for sorting the games in the round given a sort type, and if it should be reversed.- Parameters:
sortType
- to be sorted by.reversed
- true if yes,
-
clear
public void clear()Description copied from class:Round
Method for clearing the round of games.
-