java.lang.Object
edu.ntnu.idatt1002.k01g08.fta.controllers.Admin

public class Admin extends Object
Admin class. Used to link GUI controllers with the other class
  • Constructor Details

    • Admin

      public Admin()
  • Method Details

    • addTeam

      public static void addTeam(String teamName, int numOfPlayers) throws IllegalArgumentException
      Method for adding a team
      Parameters:
      teamName - is the team name as a String
      numOfPlayers - is the amount of players in the team
      Throws:
      IllegalArgumentException - if the team is already existing
    • getNumOfPlayersToCreate

      public static int getNumOfPlayersToCreate()
      Method for returning the amount of players to create
      Returns:
      the amount as an int
    • addPlayerToNewestTeam

      public static boolean addPlayerToNewestTeam(String name, int number)
      Method for adding a player to the newest team
      Parameters:
      name - is the name of the player as a String
      number - is players shirt number as an int
      Returns:
      true or false
    • addPlayerToTeam

      public static boolean addPlayerToTeam(String playerName, int number, String teamName)
      Method for adding a player to a team
      Parameters:
      playerName - is the players name as a String
      number - is the players shirt number as an int
      teamName - is the teams name as a String
      Returns:
      true or false
    • addPlayerToExistingTeam

      public static boolean addPlayerToExistingTeam(String playerName, int number, String teamName) throws IOException
      Method for adding a player to an existing team
      Parameters:
      playerName - is the players name as a String
      number - is the players shirt number as an int
      teamName - is the teams name as a String
      Returns:
      true or false
      Throws:
      IOException - if there is an error
    • saveTeams

      public static void saveTeams() throws IOException
      Method for saving a team to the register
      Throws:
      IOException - if there is an error
    • loadTeams

      public static void loadTeams()
      Method for loading teams from a file
    • loadTournaments

      public static void loadTournaments()
      Method for loading tournaments from a file
    • saveTournament

      public static void saveTournament(Tournament tournament) throws IOException
      Method for saving a tournament
      Parameters:
      tournament - is the tournament being saved
      Throws:
      IOException - if there was an error when saving the tournament
    • getTeamNames

      public static List<String> getTeamNames()
      Method for retrieving the names of every team in the register
      Returns:
      the team names as an ArrayList
    • getPlayerStrings

      public static List<String> getPlayerStrings(String teamName)
      Method for retrieving every player in a team
      Parameters:
      teamName - is the name of the team as a String
      Returns:
      the players in the team as an ArrayList
    • editTeamName

      public static void editTeamName(String teamName, String newTeamName) throws IOException, IllegalArgumentException
      Method for editing a teams name
      Parameters:
      teamName - is the current name of the team as a String
      newTeamName - is the teams new name as a String
      Throws:
      IOException - if there was an error
      IllegalArgumentException - if there already is a team with the same name
    • deleteTeam

      public static void deleteTeam(String teamName) throws IOException
      Method for deleting a team
      Parameters:
      teamName - is the name of the team being deleted as a String
      Throws:
      IOException - if there was an error when deleting the team
    • editPlayer

      public static void editPlayer(String teamName, int oldPlayerNumber, int newPlayerNumber, String playerName) throws IOException
      Method for editing a player
      Parameters:
      teamName - is the name of the team the player plays for
      oldPlayerNumber - is the old shirt number of the player as an int
      newPlayerNumber - is the new shirt number of the player as an int
      playerName - is the players name as a String
      Throws:
      IOException - if there was an error when editing the player
    • deletePlayer

      public static void deletePlayer(String teamName, int playerNumber) throws IOException
      Method for deleting a player
      Parameters:
      teamName - is the name of the team the player plays for
      playerNumber - is the players shirt number as an int
      Throws:
      IOException - if there was an error when deleting the player
    • numberOfTeamsInvalid

      public static boolean numberOfTeamsInvalid(int num)
      Method for determine whether the number of teams is invalid
      Parameters:
      num - is the amount of teams
      Returns:
      true or false
    • setTournamentToCreateName

      public static void setTournamentToCreateName(String name)
      Temporary storage of the tournament name when creating a tournament
      Parameters:
      name - is the temporary name of the tournament
    • setNumOfTeamsToAdd

      public static void setNumOfTeamsToAdd(int num)
      Method for setting the amount of teams to add
      Parameters:
      num - is the amount as an int
    • getNumOfTeamsToAdd

      public static int getNumOfTeamsToAdd()
      Method for retrieving the amount of teams to add to a tournamnt
      Returns:
      the amount as an int
    • createTournament

      public static void createTournament(ArrayList<String> teams) throws IOException
      Method for creating a tournament
      Parameters:
      teams - is the teams in the tournament
      Throws:
      IOException - if there was an error when creating the tournament
    • getTeams

      public static ArrayList<Team> getTeams(ArrayList<String> teams)
      Method for retrieving the teams when creating a tournament
      Parameters:
      teams - is the list of the teams
      Returns:
      the list of teams
    • getTournamentNames

      public static ArrayList<String> getTournamentNames()
      Method for retrieving the teams names in a tournament
      Returns:
      the names of teams in a tournament as an ArrayList
    • getActiveTournament

      public static Tournament getActiveTournament()
      Method for retrieving the active tournament
      Returns:
      the tournament
    • getNextMatch

      public static Match getNextMatch()
      Method for retrieving the next scheduled match
      Returns:
      the next match
    • selectActiveTournament

      public static void selectActiveTournament(int n)
      Method for setting the active tournament
      Parameters:
      n - is the index of the tournament in the register as an int
    • loadActiveMatch

      public static void loadActiveMatch()
      Method for loading the active match
    • setCurrentReportedMatch

      public static void setCurrentReportedMatch(int n)
      Method for setting the current reported match
      Parameters:
      n - is the index of the match in the register
    • getCurrentReportedMatch

      public static Match getCurrentReportedMatch()
      Method for retrieving the current reported match
      Returns:
      the current reported match
    • getActiveMatch

      public static Match getActiveMatch()
      Method for retrieving the current active match
      Returns:
      the active match
    • getActiveStyle

      public static String getActiveStyle()
      Method for retrieving the active style
      Returns:
      the active style as a String
    • setActiveStyle

      public static void setActiveStyle(String style)
      Method for setting the active style
      Parameters:
      style - is the new style
    • changeContrast

      public static void changeContrast()
      Method for changing the contrast-style
    • isHighContrast

      public static boolean isHighContrast()
      Checks if it's high contrast mode
      Returns:
      true if is high contrast mode