Class DElim

java.lang.Object
toDesk.src.tournament.formats.DElim

public class DElim extends Object
Since:
4/01/2024 purpose: This class simulates a double elimination bracket. Each match contains 2 players, and every player starts on the upper bracket. Winners advance through the upper bracket, and losers are sent to the lower bracket.
Version:
1.0
Author:
Calvin Ocampo
  • Method Details

    • getInstance

      public static DElim getInstance()
    • createUpperBracket

      public void createUpperBracket(ArrayList<PlayerEntry> playerEntries)
      Creates the upper bracket
      Parameters:
      playerEntries - is an existing list of players
    • updateMatchScore

      public void updateMatchScore(int matchIndex, int player1Score, int player2Score)
      Updates the score of a match object
      Parameters:
      matchIndex - the index of a match in the bracket
      player1Score - is the score of the 1st player
      player2Score - is the score of the 2nd player
    • advancePlayer

      public void advancePlayer(int matchIndex, PlayerEntry winner)
      Advances a player through the bracket by sending the winning player to the next available match in the list and the losing player to the lower bracket OR eliminating them
      Parameters:
      matchIndex - is the index of the match to be modified
      winner - is the player who won the match
    • displayUpperBracket

      public void displayUpperBracket()
      Prints the upper bracket.
    • displayLowerBracket

      public void displayLowerBracket()
      Prints the lower bracket.