java.lang.Object
edu.ntnu.idatt1002.k01g08.fta.objects.events.GameEvent
edu.ntnu.idatt1002.k01g08.fta.objects.events.Substitution

public class Substitution extends GameEvent
Class representing a specific type of GameEvent called Substitution The Substitution holds information on when during a match that the action has happened in a form of a String timeStampOfMatchTime. It also stores information about the team exercising the substitution, and which players that switch playing in the match The class has two constructors The first takes parameters for all attributes and understands which team that is making a substitution based on the players switched
  • Constructor Details

    • Substitution

      public Substitution(String timeStampOfMatchTime, Team teamSwitchingPlayers, Player playerIn, Player playerOut) throws IllegalArgumentException
      First constructor for a Substitution which requires all parameters under to instantiate a new Substitution
      Parameters:
      timeStampOfMatchTime - , is a String which cannot have value zero or be a blank string
      teamSwitchingPlayers - , is of class Team and is the team making the substitution
      playerIn - , is of class Player and is the player being subbed in
      playerOut - , is of class Player and is the player being subbed out
      Throws:
      IllegalArgumentException - if the parameter timeStampOfMatchTime is either of null-value or is a blank string
  • Method Details

    • getPlayerIn

      public Player getPlayerIn()
      Accessor method to get the player that is substituted in this Substitution
      Returns:
      Player playerIn
    • setPlayerIn

      public void setPlayerIn(Player playerIn)
      Mutator method to alter the player that is substituted in this Substitution
      Parameters:
      playerIn - is the player being subbed on
    • getPlayerOut

      public Player getPlayerOut()
      Accessor method to get the player that is subbed out in this Substitution
      Returns:
      Player playerOut
    • setPlayerOut

      public void setPlayerOut(Player playerOut)
      Mutator method to alter the player that is switched out in this Substitution
      Parameters:
      playerOut - is the player being subbed out
    • getEvent

      public String getEvent()
      GetEvent method to get a string description of the event
      Specified by:
      getEvent in class GameEvent
      Returns:
      String substitution description
    • toString

      public String toString()
      Description copied from class: GameEvent
      Returns a string representation of a GameEvent object
      Overrides:
      toString in class GameEvent
      Returns:
      a string representing an object of the class GameEvent.