Class Foul
java.lang.Object
edu.ntnu.idatt1002.k01g08.fta.objects.events.GameEvent
edu.ntnu.idatt1002.k01g08.fta.objects.events.Foul
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetEvent()GetEvent method to return a string description of this Foul eventAccessor method to get the tag of this foulintAccessor method to get the amount of red cards given with this foulintAccessor method to get the amount of yellow cards given with this foulvoidsetFoulTag(String foulTag) Mutator method to alter the tag of this foultoString()Returns a string representation of a GameEvent objectMethods inherited from class edu.ntnu.idatt1002.k01g08.fta.objects.events.GameEvent
getPlayer, getTeam, getTimeStampOfMatchTime, setPlayer, setTeam, setTimeStampOfMatchTime
-
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 blanktimeStampOfMatchTime- , is a String which cannot have value zero or be a blank stringplayer- , is a Playerteam- , is a TeamgiveCard- , 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
Accessor method to get the tag of this foul- Returns:
- String foulTag
-
setFoulTag
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
GetEvent method to return a string description of this Foul event -
toString
Description copied from class:GameEventReturns a string representation of a GameEvent object
-