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

public class Foul extends GameEvent
Class representing a specific type of GameEvent called Foul The Foul has a String for a foulTag, this can be a brief description, for example: 'Hands' The Foul contains information about at what point in match time occurred, this information is stored as a String timeStampOfMatchTime. It also stores information about which player committed the foul. This attribute is of class Player. A foul is also done by one of the two teams, and therefore the foul has information about Team teamCommittingFoul.
  • Constructor Details

    • Foul

      public Foul(String foulTag, String timeStampOfMatchTime, Player player, Team team, int giveCard) throws IllegalArgumentException
      Constructor of the Foul class The constructor takes parameters for all attributes of the class
      Parameters:
      foulTag - , is a String that is given the value 'null' if the string is blank
      timeStampOfMatchTime - , is a String which cannot have value zero or be a blank string
      player - , is a Player
      team - , is a Team
      giveCard - , is an integer deciding if the foul gives a card
      Throws:
      IllegalArgumentException - if the parameter timeStampOfMatchTime is either of null-value or is a blank string
  • Method Details

    • getFoulTag

      public String getFoulTag()
      Accessor method to get the tag of this foul
      Returns:
      String foulTag
    • setFoulTag

      public void setFoulTag(String foulTag)
      Mutator method to alter the tag of this foul
      Parameters:
      foulTag - is a String
    • getYellowCard

      public int getYellowCard()
      Accessor method to get the amount of yellow cards given with this foul
      Returns:
      integer yellowCard
    • getRedCard

      public int getRedCard()
      Accessor method to get the amount of red cards given with this foul
      Returns:
      integer redCard
    • getEvent

      public String getEvent()
      GetEvent method to return a string description of this Foul event
      Specified by:
      getEvent in class GameEvent
      Returns:
      String foul 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.