java.lang.Object
edu.ntnu.idatt1002.k01g08.fta.objects.tournaments.Tournament
Direct Known Subclasses:
KnockOut

public abstract class Tournament extends Object
Class representing a Tournament The Tournament's main function is to add, remove and modify matches which take place during the tournament. It contains information about all teams and matches in the tournament in ArrayLists, as well as it's name and start date as strings, the winning prize as an integer, the winning team and the expected match length as an int representing minutes.
  • Field Details

    • previousRoundMatches

      protected ArrayList<Match> previousRoundMatches
  • Constructor Details

  • Method Details

    • setUpcomingMatch

      public void setUpcomingMatch(Team team1, Team team2)
      Method for planning a new match
      Parameters:
      team1 - first team competing in the match
      team2 - second team competing in the match
    • startNextMatch

      public void startNextMatch()
      Method for initiating the next match
    • endMatch

      public void endMatch()
      Method for ending a match, will remove match from list of future matches and set the current match to empty
    • getCurrentMatch

      public Match getCurrentMatch()
      Method for finding the match currently being played
      Returns:
      the match currently being played
    • getMatchLength

      public int getMatchLength()
      Method for finding the planned match time This is the length of the match in its entirety, so halftime starts at the middle of the inputted time
      Returns:
      int showing how many minutes a match should last
    • findUpcomingMatches

      public abstract void findUpcomingMatches()
      Abstract method for generating the next set of matches Will be called if there are no planned matches yet more teams left
    • getWinner

      public Team getWinner()
      Method for finding the team which won the tournament
      Returns:
      the team who won the tournament
    • setWinner

      public void setWinner(Team winner)
      Method for changing match winner
      Parameters:
      winner - which team who should win the tournament
    • getTeams

      public ArrayList<Team> getTeams()
      Method for finding all teams in the tournament
      Returns:
      a list of teams
    • getMatches

      public ArrayList<Match> getMatches()
      Method for finding all finished matches
      Returns:
      a list of matches
    • getUpcomingMatches

      public ArrayList<Match> getUpcomingMatches()
      Method for finding all planned matches
      Returns:
      a list of matches
    • getTournamentName

      public String getTournamentName()
      Method for finding the name of the tournament
      Returns:
      Name of the tournament
    • getFirstPrize

      public int getFirstPrize()
      Method for finding the prize which the winner will receive
      Returns:
      a number representing the first price value in kr
    • getStartDate

      public String getStartDate()
      Method for finding the date of the tournament
      Returns:
      a String representing the date of the tournament
    • getNumberOfTeams

      public int getNumberOfTeams()
      Method for finding how many teams who will participate in the tournament
      Returns:
      a number representing the number of teams
    • addTeam

      public void addTeam(Team team)
      Method for adding a team into the tournament
      Parameters:
      team - to add
    • addAllTeams

      public void addAllTeams(List<Team> newTeams)
      Method for adding all teams in a list
      Parameters:
      newTeams - to add
    • toString

      public String toString()
      Method for acquiring information about the tournament
      Overrides:
      toString in class Object
      Returns:
      a string representing various tournament information
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object