Class GameEvent
java.lang.Object
edu.ntnu.idatt1002.k01g08.fta.objects.events.GameEvent
- Direct Known Subclasses:
Foul,Goal,Substitution
Represents a game event which occurs during match-time
Is an abstract superclass describing the commonalities of all
subclasses.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract StringgetEvent()Forces subclasses to define an implementation of a string describing the eventReturns the player who is associated with this game eventgetTeam()Returns the team that is associated with this game eventReturns the string of a timestamp referring to when the game event occurred during a matchvoidSetter to alter the player who is associated with this game eventvoidSetter to alter which team that is associated with this game eventvoidsetTimeStampOfMatchTime(String timeStampOfMatchTime) Setter to alter the timestamp associated with this eventtoString()Returns a string representation of a GameEvent object
-
Constructor Details
-
GameEvent
public GameEvent(Player player, Team team, String timeStamp) throws IllegalArgumentException, NullPointerException Constructor to instantiate an object of a subclass of the 'GameEvent'- Parameters:
player- is an object of the class 'Player'team- is an object of the class 'Team'timeStamp- is a string representation of the time of which- Throws:
IllegalArgumentException- if the timeStamp string .isBlank()NullPointerException- if the timeStamp, player or team has the value 'null'
-
-
Method Details
-
getTimeStampOfMatchTime
Returns the string of a timestamp referring to when the game event occurred during a match- Returns:
- string timeStamp which
-
setTimeStampOfMatchTime
public void setTimeStampOfMatchTime(String timeStampOfMatchTime) throws IllegalArgumentException, NullPointerException Setter to alter the timestamp associated with this event- Parameters:
timeStampOfMatchTime- is a string representation of the time of which- Throws:
IllegalArgumentException- if the timeStamp string .isBlank()NullPointerException- if the timeStamp string has the value 'null'
-
getEvent
Forces subclasses to define an implementation of a string describing the event- Returns:
- GameEvent value
-
getPlayer
Returns the player who is associated with this game event- Returns:
- Player player
-
setPlayer
Setter to alter the player who is associated with this game event- Parameters:
player- is a Player
-
getTeam
Returns the team that is associated with this game event- Returns:
- an object of the Team class
-
setTeam
Setter to alter which team that is associated with this game event- Parameters:
team- is a team
-
toString
Returns a string representation of a GameEvent object
-