com.TeamHEC.LocomotionCommotion.Goal
Class Goal

java.lang.Object
  extended by com.TeamHEC.LocomotionCommotion.Goal.Goal
All Implemented Interfaces:
RouteListener
Direct Known Subclasses:
SpecialGoal

public class Goal
extends java.lang.Object
implements RouteListener

Author:
Sam Watkins , Eashan Maheshwari , Sam Anderson , Matthew Taylor

Field Summary
static GoalActor goalActor
           
 
Constructor Summary
Goal(Station startStation, Station finalStation, Station stationVia, java.lang.String cargo, int reward)
          Initialises a standard goal.
Goal(Station startStation, Station finalStation, Station stationVia, java.lang.String cargo, int reward, int turnLimit)
          Initialises a turn-limited goal.
 
Method Summary
 void assignTrain(Train train)
          Assigns a goal to a train and registers listeners
 java.lang.String getCargo()
           
 java.lang.String getFStation()
          Gets the finish station for the goal
 int getReward()
          Gets the reward for the goal
 java.lang.String getSStation()
          Gets the start station
 int getStartTurn()
          Gets the start turn for the station
 Train getTrain()
          Gets the train assigned to the goal
 int getTurnLimit()
          Gets the turn limit for the goal
 java.lang.String getVia()
          Returns the name of the viaStation.
 void goalComplete()
          Called when the goal is successfully complete, giving the player the appropriate amount of Gold and Score.
 void goalFailed()
          Called when the goal has been failed
 boolean isSpecial()
          Gets if the goal is a special goal
 void setActor(GoalActor actor)
          Sets the goal actor for the goal
 void setSpecial(boolean special)
          Sets the special flag for the goal
 void stationPassed(Station station, Train train)
          Listener trigger when a train passes a station
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

goalActor

public static GoalActor goalActor
Constructor Detail

Goal

public Goal(Station startStation,
            Station finalStation,
            Station stationVia,
            java.lang.String cargo,
            int reward)
Initialises a standard goal.

Parameters:
startStation - The Station the goal starts from
finalStation - The Station the goal ends at
stationVia - The Station the goal wants you to travel via
cargo - The type of cargo the train is carrying
reward - The reward (currently Gold) you get for completing the Goal

Goal

public Goal(Station startStation,
            Station finalStation,
            Station stationVia,
            java.lang.String cargo,
            int reward,
            int turnLimit)
Initialises a turn-limited goal.

Parameters:
startStation - The Station the goal starts from
finalStation - The Station the goal ends at
stationVia - The Station the goal wants you to travel via
cargo - The type of cargo the train is carrying
reward - The reward (currently Gold) you get for completing the Goal
turnLimit - The number of turns allowed to complete the goal
Method Detail

isSpecial

public boolean isSpecial()
Gets if the goal is a special goal

Returns:
Boolean special

getSStation

public java.lang.String getSStation()
Gets the start station

Returns:
Station

getFStation

public java.lang.String getFStation()
Gets the finish station for the goal

Returns:
Station

getReward

public int getReward()
Gets the reward for the goal

Returns:
Int reward

getStartTurn

public int getStartTurn()
Gets the start turn for the station

Returns:
Int start turn

getTurnLimit

public int getTurnLimit()
Gets the turn limit for the goal

Returns:
turnLimit

setActor

public void setActor(GoalActor actor)
Sets the goal actor for the goal

Parameters:
actor - the actor for this goal

getVia

public java.lang.String getVia()
Returns the name of the viaStation. Returns "Any" if StationVia is null.

Returns:
The name of the viaStation. Returns "Any" if StationVia is null.

getCargo

public java.lang.String getCargo()

assignTrain

public void assignTrain(Train train)
Assigns a goal to a train and registers listeners

Parameters:
train - The train to assign to

getTrain

public Train getTrain()
Gets the train assigned to the goal

Returns:
Train

goalComplete

public void goalComplete()
Called when the goal is successfully complete, giving the player the appropriate amount of Gold and Score.


goalFailed

public void goalFailed()
Called when the goal has been failed


stationPassed

public void stationPassed(Station station,
                          Train train)
Listener trigger when a train passes a station

Specified by:
stationPassed in interface RouteListener

setSpecial

public void setSpecial(boolean special)
Sets the special flag for the goal

Parameters:
special - A boolean value for the special flag to be set to