Class Leaderboard


  • public class Leaderboard
    extends java.lang.Object
    Represents a leaderboard for after each race.
    • Constructor Summary

      Constructors 
      Constructor Description
      Leaderboard​(Player player, Opponent[] opponents)
      Creates a leaderboard with an array of all boats.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Boat[] getFinalists​(int places)
      Gets top boats, in order of fastest race time.
      Boat[] getPodium()
      Gets the top 3 boats, in order of fastest times.
      com.badlogic.gdx.graphics.Texture getTexture()
      Gets the leaderboard texture.
      java.lang.String[] getTimes​(int places)
      Gets the names of the boats and their fastest times, in order of fastest time.
      void UpdateOrder()
      Sorts the array of boats by fastest race time, increasing.
      • Methods inherited from class java.lang.Object

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

      • Leaderboard

        public Leaderboard​(Player player,
                           Opponent[] opponents)
        Creates a leaderboard with an array of all boats.
        Parameters:
        player - Player object.
        opponents - Array of opponent boats.
    • Method Detail

      • UpdateOrder

        public void UpdateOrder()
        Sorts the array of boats by fastest race time, increasing.
      • getTimes

        public java.lang.String[] getTimes​(int places)
        Gets the names of the boats and their fastest times, in order of fastest time.
        Parameters:
        places - Number of boats to get.
        Returns:
        Array representing boats.
      • getTexture

        public com.badlogic.gdx.graphics.Texture getTexture()
        Gets the leaderboard texture.
        Returns:
        A Texture representing the sprite.
      • getFinalists

        public Boat[] getFinalists​(int places)
        Gets top boats, in order of fastest race time.
        Parameters:
        places - Number of boats to get.
        Returns:
        Array representing the boats.
      • getPodium

        public Boat[] getPodium()
        Gets the top 3 boats, in order of fastest times.
        Returns:
        Array representing boats.