ch.sahits.game.openpatrician.model
Class Player

java.lang.Object
  extended by ch.sahits.game.openpatrician.model.Player
All Implemented Interfaces:
IPlayer
Direct Known Subclasses:
AIPlayer

 class Player
extends Object
implements IPlayer


Field Summary
private  ICareer careerLevel
           
private  ICompany company
           
private  LinkedList<IShip> fleet
           
private  IPersonalData personalData
           
private  ESocialRank rank
           
private  ISpouseData spouse
           
 
Constructor Summary
Player(ICity homeTown, IPersonalData personalData, long cash, ESocialRank rank)
           
 
Method Summary
 void addShip(IShip ship)
          Add a new ship for the player
 boolean equals(Object obj)
           
 List<IBuilding> findBuildings(ICity city)
          Find all buildings of the player in the city
 List<IBuilding> findBuildings(ICity city, Class<? extends IBuilding> buildingClass)
          Find all buildings in the city that are some subtype of the indicated class
 ITradingOffice findTradingOffice(ICity city)
          Find the trading office of the player in the city.
 ICareer getCareerLevel()
          Retrieve the career level, which is either defined by EMilitantCareer or EEconomicCareer.
 long getCash()
          Retrieve the amount of money of the player
 ICompany getCompany()
          Retrieve the company data
 List<IShip> getFleet()
          Get a list of all ships
 ICity getHometown()
          Retrieve the players hometown
 String getLastName()
          Get a players last name
 String getName()
          Retrieve the players name
 IPersonalData getPersonalData()
          Retrieve the personal data of the player
 ESocialRank getRank()
          Retrieve the social rank of the player
 ISpouseData getSpouseData()
          Retrieve the personal data of the players spouse.
 int hashCode()
           
 boolean isMale()
          Check if the player is male
 void marry(ISpouseData spouse)
          Marry a spouse
 void removeShip(IShip ship)
          Remove a ship for the player
 void updateCash(int diff)
          Add or subtract some cash
 void updateRank(ESocialRank rank)
          Update to the new social rank
 void widow()
          Widow and become unmarried again
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fleet

private final LinkedList<IShip> fleet

rank

private ESocialRank rank

careerLevel

private ICareer careerLevel

personalData

private IPersonalData personalData

spouse

private ISpouseData spouse

company

private final ICompany company
Constructor Detail

Player

public Player(ICity homeTown,
              IPersonalData personalData,
              long cash,
              ESocialRank rank)
Method Detail

getName

public String getName()
Description copied from interface: IPlayer
Retrieve the players name

Specified by:
getName in interface IPlayer
Returns:

getLastName

public String getLastName()
Description copied from interface: IPlayer
Get a players last name

Specified by:
getLastName in interface IPlayer
Returns:

getHometown

public ICity getHometown()
Description copied from interface: IPlayer
Retrieve the players hometown

Specified by:
getHometown in interface IPlayer
Returns:

getFleet

public List<IShip> getFleet()
Description copied from interface: IPlayer
Get a list of all ships

Specified by:
getFleet in interface IPlayer
Returns:

isMale

public boolean isMale()
Description copied from interface: IPlayer
Check if the player is male

Specified by:
isMale in interface IPlayer
Returns:

addShip

public void addShip(IShip ship)
Description copied from interface: IPlayer
Add a new ship for the player

Specified by:
addShip in interface IPlayer

removeShip

public void removeShip(IShip ship)
Description copied from interface: IPlayer
Remove a ship for the player

Specified by:
removeShip in interface IPlayer

getCash

public long getCash()
Description copied from interface: IPlayer
Retrieve the amount of money of the player

Specified by:
getCash in interface IPlayer
Returns:

updateCash

public void updateCash(int diff)
Add or subtract some cash

Specified by:
updateCash in interface IPlayer
Parameters:
diff - amount of money that is transferred

findBuildings

public List<IBuilding> findBuildings(ICity city)
Description copied from interface: IPlayer
Find all buildings of the player in the city

Specified by:
findBuildings in interface IPlayer
Returns:

findTradingOffice

public ITradingOffice findTradingOffice(ICity city)
Description copied from interface: IPlayer
Find the trading office of the player in the city. If there is no trading office null will be returned.

Specified by:
findTradingOffice in interface IPlayer
Returns:

findBuildings

public List<IBuilding> findBuildings(ICity city,
                                     Class<? extends IBuilding> buildingClass)
Description copied from interface: IPlayer
Find all buildings in the city that are some subtype of the indicated class

Specified by:
findBuildings in interface IPlayer
Returns:

getRank

public ESocialRank getRank()
Description copied from interface: IPlayer
Retrieve the social rank of the player

Specified by:
getRank in interface IPlayer
Returns:

getCareerLevel

public ICareer getCareerLevel()
Description copied from interface: IPlayer
Retrieve the career level, which is either defined by EMilitantCareer or EEconomicCareer.

Specified by:
getCareerLevel in interface IPlayer
Returns:

marry

public void marry(ISpouseData spouse)
Marry a spouse

Parameters:
spouse -

widow

public void widow()
Widow and become unmarried again


getPersonalData

public IPersonalData getPersonalData()
Description copied from interface: IPlayer
Retrieve the personal data of the player

Specified by:
getPersonalData in interface IPlayer
Returns:

getSpouseData

public ISpouseData getSpouseData()
Description copied from interface: IPlayer
Retrieve the personal data of the players spouse.

Specified by:
getSpouseData in interface IPlayer
Returns:

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getCompany

public ICompany getCompany()
Description copied from interface: IPlayer
Retrieve the company data

Specified by:
getCompany in interface IPlayer
Returns:

updateRank

public void updateRank(ESocialRank rank)
Description copied from interface: IPlayer
Update to the new social rank

Specified by:
updateRank in interface IPlayer


Copyright © 2011-2012 Sahits GmbH. All Rights Reserved.