Class Goal
java.lang.Object
edu.ntnu.idatt1002.k01g08.fta.objects.events.GameEvent
edu.ntnu.idatt1002.k01g08.fta.objects.events.Goal
Class representing a goal scored in a match. This is a specific game event and is therefore represented as being a
subclass of the abstract class 'GameEvent'.
Additional information associated with a Goal is 'assistingPlayer', another player, which is the player who
assisted the goal. This player does not have to be specified as some Goals happen without any given player assisting
the player who scores To circumvent this, the class has two constructors, with and without a parameter for
assistingPlayer.
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class edu.ntnu.idatt1002.k01g08.fta.objects.events.GameEvent
getPlayer, getTeam, getTimeStampOfMatchTime, setPlayer, setTeam, setTimeStampOfMatchTime
-
Constructor Details
-
Goal
public Goal(Player goalScorer, Team team, String timeStamp, Player assistingPlayer) throws IllegalArgumentException First constructor to instantiate specific Goals- Parameters:
goalScorer
- is the player scoring the goalteam
- is the team scoring the goaltimeStamp
- is a String with the time of the goalassistingPlayer
- is the player assisting the goal- Throws:
IllegalArgumentException
- specified in the GameEvent class
-
Goal
Second constructor to instantiate a Goal without an assistingPlayer- Parameters:
goalScorer
- is the player scoring the goalteam
- is a TeamtimeStamp
- is String- Throws:
IllegalArgumentException
- specified in the GameEvent class
-
-
Method Details
-
getAssistingPlayer
Accessor method to get the assisting player of this goal- Returns:
- Player assistingPlayer
-
getEvent
GetEvent method to get a full description of the Goal event -
toString
Description copied from class:GameEvent
Returns a string representation of a GameEvent object
-