Package controller

Class ScoreController

java.lang.Object
controller.ScoreController
All Implemented Interfaces:
IScoreController

public class ScoreController extends Object implements IScoreController
ScoreController handles communication between the Scoreboards and the GUI
  • Constructor Details

    • ScoreController

      public ScoreController()
      Constructor for ScoreController
  • Method Details

    • fetchScores

      public void fetchScores(ModeType difficulty)
      fetches scores form db, and stores them in the correct scoreboard
      Specified by:
      fetchScores in interface IScoreController
      Parameters:
      difficulty - the difficulty to fetch scores for
    • getTopFiveScores

      public ArrayList<String> getTopFiveScores(ModeType difficulty)
      returns the scores for the given difficulty formatted for gui
      Specified by:
      getTopFiveScores in interface IScoreController
      Parameters:
      difficulty - the difficulty to get scores for
      Returns:
      the scores
    • getScoresRaw

      public ArrayList<Score> getScoresRaw(ModeType difficulty)
      get raw Score-objects. use with temperance
      Specified by:
      getScoresRaw in interface IScoreController
      Parameters:
      difficulty - the difficulty to get scores for
      Returns:
      the scores
    • formatScore

      public String formatScore(Score score)
      converts score-object to a string that will be displayed in GUI.
      Specified by:
      formatScore in interface IScoreController
      Parameters:
      score - the score to format
      Returns:
      the formatted score
    • formatScoreVerbose

      public String formatScoreVerbose(Score score)
      converts score-object to a string that will be displayed in GUI.
      Specified by:
      formatScoreVerbose in interface IScoreController
      Parameters:
      score - the score to format
      Returns:
      the formatted score
    • formatScores

      public ArrayList<String> formatScores(ArrayList<Score> scores)
      Scores formatted for in game view. Ex: '2. EET 3000'
      Specified by:
      formatScores in interface IScoreController
      Parameters:
      scores - the scores to format
      Returns:
      the formatted scores
    • fetchPersonalScores

      public void fetchPersonalScores()
      fetches the personal scores for the logged in user and stores them in the correct scoreboard
      Specified by:
      fetchPersonalScores in interface IScoreController
    • getTopFivePersonalScores

      public ArrayList<String> getTopFivePersonalScores(ModeType difficulty)
      returns the personal scores for the given difficulty formatted for gui
      Specified by:
      getTopFivePersonalScores in interface IScoreController
      Parameters:
      difficulty - the difficulty to get scores for
      Returns:
      the personal scores for the given difficulty formatted for gui
    • getUserScoresRaw

      public ArrayList<Score> getUserScoresRaw(ModeType difficulty)
      Description copied from interface: IScoreController
      get raw Score-objects. use with temperance
      Specified by:
      getUserScoresRaw in interface IScoreController
      Parameters:
      difficulty - the difficulty to get scores for
      Returns:
      the scores