Package org.swtpra1

Class 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.
    • Constructor Detail

      • Leaderboard

        public Leaderboard()
    • 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