java.lang.Object
edu.ntnu.idatt1002.k01g08.fta.registers.TournamentRegister

public class TournamentRegister extends Object
Class for a tournament register storing tournaments of class 'Tournament' This is stored in a list holding Tournaments
  • Constructor Details

    • TournamentRegister

      public TournamentRegister()
      Constructor for a tournament register which assigns a new arraylist to the 'tournamentList' that can store elements of Tournament-class
  • Method Details

    • addTournament

      public void addTournament(Tournament tournament) throws IllegalArgumentException
      Add-method to register a tournament uses .add-method of arraylist to add an object of class Tournament to the register
      Parameters:
      tournament - is the parameter which must be of class Tournament
      Throws:
      IllegalArgumentException - if the tournament has value 'null' or already is registered
    • removeTournament

      public void removeTournament(Tournament tournament) throws IllegalArgumentException
      Remove-method that removes a tournament from the register
      Parameters:
      tournament - is the parameter which must be of the class Tournament
      Throws:
      IllegalArgumentException - if the tournament which is tried for removal from the register is not registered
    • addAllTournaments

      public void addAllTournaments(List<Tournament> addList) throws IllegalArgumentException
      Method to add an array of tournaments to the register
      Parameters:
      addList - is the list that of which all elements that are not already registered are added to the tournamentList
      Throws:
      IllegalArgumentException - if the parameter-list 'addlist' is an empty list, or if the
    • clearRegister

      public void clearRegister()
      Clear-method for removing all elements of the tournamentList
    • getTournamentList

      public List<Tournament> getTournamentList()
      Accessor method to get the tournamentList
      Returns:
      List with Tournaments 'tournamentList'
    • getNumberOfTournaments

      public int getNumberOfTournaments()
      Accessor method that to get the number of tournaments in the register
      Returns:
      int tournamentList.size()
    • toString

      public String toString()
      Overrides:
      toString in class Object