Class TeamRegister
java.lang.Object
edu.ntnu.idatt1002.k01g08.fta.registers.TeamRegister
Represents a register of football teams
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a team to the registervoid
Method for clearing the registerint
Find the number of teams in the registerMethod for retrieving a specific team from the registergetTeams()
Method for retrieving the teams in the registerboolean
hasTeams()
Checks if the team-register has any teams registerediterator()
boolean
removeTeam
(Team team) Remove a team from the registertoString()
toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
TeamRegister
public TeamRegister()Creates a team register
-
-
Method Details
-
addTeam
Add a team to the register- Parameters:
team
- is the team getting added to the register- Throws:
IllegalArgumentException
- if the team is the team is already in the register
-
removeTeam
Remove a team from the register- Parameters:
team
- is the team getting removed from the register- Returns:
- true or false
-
clearRegister
public void clearRegister()Method for clearing the register -
getTeams
Method for retrieving the teams in the register- Returns:
- a copy of the register as an ArrayList
-
getTeam
Method for retrieving a specific team from the register- Parameters:
teamName
- is the name of the team- Returns:
- the Team
- Throws:
IllegalArgumentException
- if the team isn't in the register
-
getNumberOfTeams
public int getNumberOfTeams()Find the number of teams in the register- Returns:
- the number of teams in the register as an int
-
hasTeams
public boolean hasTeams()Checks if the team-register has any teams registered- Returns:
- true if it contains any teams
-
toString
toString -
iterator
-