Package org.swtpra1
Class Leaderboard
- java.lang.Object
-
- org.swtpra1.Leaderboard
-
public class Leaderboard extends java.lang.Object
Generates a leaderboard of players from a list of active games and sorts it after different criteria. Always keeps a leaderboard statically.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Leaderboard.LeaderboardEntry
Represents a single player and his score in the currently running tournament.
-
Constructor Summary
Constructors Constructor Description Leaderboard()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<Leaderboard.LeaderboardEntry>
getLeaderboard()
Returns the Leaderboard entries in arbitrary order.static java.util.List<Leaderboard.LeaderboardEntry>
getLeaderboardSortedByName()
Returns the Leaderboard entries sorted by players name.static java.util.List<Leaderboard.LeaderboardEntry>
getLeaderboardSortedByWins()
Returns the leaderboard entries sorted by their wins.static void
refresh(Game[] games)
Refresh the leaderboard given the current state of all active games.
-
-
-
Method Detail
-
refresh
public static void refresh(Game[] games)
Refresh the leaderboard given the current state of all active games.- Parameters:
games
- the current state of all running games
-
getLeaderboard
public static java.util.List<Leaderboard.LeaderboardEntry> getLeaderboard()
Returns the Leaderboard entries in arbitrary order.- Returns:
- unsorted list
-
getLeaderboardSortedByName
public static java.util.List<Leaderboard.LeaderboardEntry> getLeaderboardSortedByName()
Returns the Leaderboard entries sorted by players name.- Returns:
- list sorted by name
-
getLeaderboardSortedByWins
public static java.util.List<Leaderboard.LeaderboardEntry> getLeaderboardSortedByWins()
Returns the leaderboard entries sorted by their wins.- Returns:
- list sorted by wins
-
-