Class TournamentRegister
java.lang.Object
edu.ntnu.idatt1002.k01g08.fta.registers.TournamentRegister
Class for a tournament register storing tournaments of class 'Tournament'
This is stored in a list holding Tournaments
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor for a tournament register which assigns a new arraylist to the 'tournamentList' that can store elements of Tournament-class -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAllTournaments
(List<Tournament> addList) Method to add an array of tournaments to the registervoid
addTournament
(Tournament tournament) Add-method to register a tournament uses .add-method of arraylist to add an object of class Tournament to the registervoid
Clear-method for removing all elements of the tournamentListint
Accessor method that to get the number of tournaments in the registerAccessor method to get the tournamentListvoid
removeTournament
(Tournament tournament) Remove-method that removes a tournament from the registertoString()
-
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
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
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
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
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
-