com.TeamHEC.LocomotionCommotion.Map
Class Station

java.lang.Object
  extended by com.TeamHEC.LocomotionCommotion.Map.MapObj
      extended by com.TeamHEC.LocomotionCommotion.Map.Station

public class Station
extends MapObj

Author:
Matthew Taylor , Elliot Bray , Oliver Binns

Field Summary
 double mindistance
           
 
Fields inherited from class com.TeamHEC.LocomotionCommotion.Map.MapObj
actor, connections, x, y
 
Constructor Summary
Station(java.lang.String name, int baseValue, Resource resourceType, int baseFuelOut, Line[] line, int rentValue, float x, float y)
           
 
Method Summary
 void addRentValueMod(int add)
          Add to the rent value modifier
 void addResourceOutMod(int add)
          Adds to the value of the resource out mod
 void addValueMod(int add)
          Adds to the value mod
 void fixFault()
          fixes the fault on a station
 int getBaseRentValue()
           
 int getBaseResourceOut()
           
 int getBaseValue()
           
 double getFaultRate()
          Gets the fault rate of a station
 Line[] getLineType()
           
 java.lang.String getName()
          Returns the name of the station or junction the MapObj represents
 Player getOwner()
           
 int getRentValueMod()
           
 boolean getRepairable()
           
 int getResourceOutMod()
           
 java.lang.String getResourceString()
           
 Resource getResourceType()
           
 Station getStation()
           
 Game_Map_Station getStationActor()
          Gets the station Actor
 int getStationLevel()
          gets the stations upgrade level
 int getTotalRent()
           
 int getTotalResourceOut()
           
 int getTotalValue()
           
 int getValueMod()
           
 boolean isFaulty()
           
 void makeFaulty()
          makes a station faulty
 void notifyStationPurchased(Station station, Player player)
          Called when you want to notify listeners that a station has changed ownership, such as changing the texture on the map or setting the text of the players gold
 void register(StationListener newListener)
          Registers an object implementing the StationListener by adding it to the listeners array
 void setOwner(Player newOwner)
          Changes the owner of this station and notifies listeners
 void setRentValueMod(int value)
          Sets the rent value modifier
 void setResourceOutMod(int mod)
           
 void setValueMod(int value)
          Sets the value mod
 void subRentValueMod(int sub)
          Subtracts from the rent value modifier
 void subResourceOutMod(int sub)
          Subtracts from the resources out mod
 void subValueMod(int sub)
          Subtracts from the value mod
 void unregister(StationListener s)
          Removes object implementing StationListener so it no longer receives updates
 void upgradeStation()
          Upgrades a stations reliability
 
Methods inherited from class com.TeamHEC.LocomotionCommotion.Map.MapObj
getActor
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mindistance

public double mindistance
Constructor Detail

Station

public Station(java.lang.String name,
               int baseValue,
               Resource resourceType,
               int baseFuelOut,
               Line[] line,
               int rentValue,
               float x,
               float y)
Parameters:
name -
baseValue - The value of the station
resourceType - The type of resource the station produces
baseFuelOut - The amount of resource the station produces each turn, without up line bonuses
line - Array of lines the station belongs to
rentValue - How much it costs to rent
x - Coordinate of position x on map
y - Coordinate of position y on map
Method Detail

getStation

public Station getStation()
Overrides:
getStation in class MapObj
Returns:
station instance, used in MapObj and overwritten here

getStationActor

public Game_Map_Station getStationActor()
Gets the station Actor

Returns:
GameMapStation

getName

public java.lang.String getName()
Description copied from class: MapObj
Returns the name of the station or junction the MapObj represents

Overrides:
getName in class MapObj
Returns:
the name of the station

getResourceString

public java.lang.String getResourceString()
Returns:
The string of the fuelType used, can be used in player to deduct resources

getBaseValue

public int getBaseValue()
Returns:
the value of the station without mods

getValueMod

public int getValueMod()
Returns:
the value added onto baseValue from bonuses

setValueMod

public void setValueMod(int value)
Sets the value mod

Parameters:
value -

addValueMod

public void addValueMod(int add)
Adds to the value mod

Parameters:
add -

subValueMod

public void subValueMod(int sub)
Subtracts from the value mod

Parameters:
sub -

getTotalValue

public int getTotalValue()
Returns:
the total value of the station with mods (Base + Mod)

getResourceType

public Resource getResourceType()
Returns:
returns the resource Type as a type

getBaseResourceOut

public int getBaseResourceOut()
Returns:
returns the base amount of resources produced by the station

getResourceOutMod

public int getResourceOutMod()
Returns:
the amount of resources added to base from bonuses

setResourceOutMod

public void setResourceOutMod(int mod)
Parameters:
mod - the amount resourceOut will be increased by, Total = Base + Mod

addResourceOutMod

public void addResourceOutMod(int add)
Adds to the value of the resource out mod

Parameters:
add -

subResourceOutMod

public void subResourceOutMod(int sub)
Subtracts from the resources out mod

Parameters:
sub -

getTotalResourceOut

public int getTotalResourceOut()
Returns:
the total output of fuel or gold resources the station produces

getBaseRentValue

public int getBaseRentValue()
Returns:
the base amount of rent a player will receive for owning a station

getRentValueMod

public int getRentValueMod()
Returns:
the amount the base rent value is increased by

setRentValueMod

public void setRentValueMod(int value)
Sets the rent value modifier

Parameters:
value -

addRentValueMod

public void addRentValueMod(int add)
Add to the rent value modifier

Parameters:
add -

subRentValueMod

public void subRentValueMod(int sub)
Subtracts from the rent value modifier

Parameters:
sub -

getTotalRent

public int getTotalRent()
Returns:
the total rent value of the station with bonuses

getOwner

public Player getOwner()
Returns:
The current owner of the station

setOwner

public void setOwner(Player newOwner)
Changes the owner of this station and notifies listeners

Parameters:
newOwner -

getLineType

public Line[] getLineType()
Returns:
the array of lines the station is on

register

public void register(StationListener newListener)
Registers an object implementing the StationListener by adding it to the listeners array

Parameters:
newListener - the object to be added

unregister

public void unregister(StationListener s)
Removes object implementing StationListener so it no longer receives updates

Parameters:
s - the object to be removed

notifyStationPurchased

public void notifyStationPurchased(Station station,
                                   Player player)
Called when you want to notify listeners that a station has changed ownership, such as changing the texture on the map or setting the text of the players gold

Parameters:
station -
player -

isFaulty

public boolean isFaulty()
Returns:
is the station broken?

getRepairable

public boolean getRepairable()
Returns:
false if the station is beyond repair

fixFault

public void fixFault()
fixes the fault on a station


makeFaulty

public void makeFaulty()
makes a station faulty


upgradeStation

public void upgradeStation()
Upgrades a stations reliability


getStationLevel

public int getStationLevel()
gets the stations upgrade level

Returns:
Int upgrade level

getFaultRate

public double getFaultRate()
Gets the fault rate of a station

Returns:
double fault rate