Class Player
- java.lang.Object
-
- ch.sahits.game.openpatrician.model.impl.Player
-
- All Implemented Interfaces:
ICreditor,ICitizen,IPlayer,IShipOwner
- Direct Known Subclasses:
AIPlayer,HumanPlayer
public abstract class Player extends java.lang.Object implements IPlayer
-
-
Constructor Summary
Constructors Constructor Description Player(ICity homeTown, IPersonalData personalData, ESocialRank rank, ICompany company)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSelectableVessel(INavigableVessel vessel)Add a selectable vessel to the list.voidaddShip(IShip ship)Add a new ship for the playerbooleanequals(java.lang.Object o)java.util.List<IBuilding>findBuildings(ICity city)Find all buildings of the player in the city<T extends IBuilding>
java.util.List<T>findBuildings(ICity city, java.lang.Class<T> buildingClass)Find all buildings in the city that are some subtype of the indicated classjava.util.List<INavigableVessel>findShips(ICity city)Find all ships in a cityjava.util.Optional<ITradingOffice>findTradingOffice(ICity city)Find the trading office of the player in the city.java.util.List<IShip>getFleet()Get a list of all shipsICitygetHometown()Retreive the hometown of the citizen.java.lang.StringgetLastName()Get a players last namejava.lang.StringgetName()Retrieve the players nameIPersonalDatagetPersonalData()Retrieve the personal data of the playerjava.util.List<INavigableVessel>getSelectableVessels()Provide a different view on the fleet by containing all the vessels that can be selected.java.util.Optional<ISpouseData>getSpouseData()Retrieve the personal data of the players spouse.inthashCode()voidmarry(ISpouseData spouse)Marry a spousevoidreceiveSum(long amount)Handle method for recieving a paymentvoidremoveSelectableVessel(INavigableVessel vessel)Remove a selectable vessel from the list.voidremoveShip(IShip ship)Remove a ship for the playervoidspouseDies()Widow and become unmarried again.java.lang.StringtoString()voidupdateCrimialDrive(int value)Update the new value indicating the level of criminallity of the playervoidupdateRank(ESocialRank rank)Update to the new social rank-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ch.sahits.game.openpatrician.model.IPlayer
getCareerLevel, getChildren, getCompany, getCriminalDrive, getSegmentedMap, getUuid, setCareerLevel, setSegmentedMap
-
-
-
-
Constructor Detail
-
Player
public Player(ICity homeTown, IPersonalData personalData, ESocialRank rank, ICompany company)
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:ICitizenRetrieve the players name- Specified by:
getNamein interfaceICitizen- Specified by:
getNamein interfaceIShipOwner- Returns:
- first name of the citizen.
-
getLastName
public java.lang.String getLastName()
Description copied from interface:ICitizenGet a players last name- Specified by:
getLastNamein interfaceICitizen- Specified by:
getLastNamein interfaceIShipOwner- Returns:
- last name of the citizen
-
getHometown
public ICity getHometown()
Description copied from interface:ICitizenRetreive the hometown of the citizen.- Specified by:
getHometownin interfaceICitizen- Returns:
- home city of the citizen.
-
getFleet
public java.util.List<IShip> getFleet()
Description copied from interface:IPlayerGet a list of all ships
-
getSelectableVessels
public java.util.List<INavigableVessel> getSelectableVessels()
Description copied from interface:IPlayerProvide a different view on the fleet by containing all the vessels that can be selected.- Specified by:
getSelectableVesselsin interfaceIPlayer- Returns:
- list of vessels that can be activated.
-
addSelectableVessel
public void addSelectableVessel(INavigableVessel vessel)
Description copied from interface:IPlayerAdd a selectable vessel to the list.- Specified by:
addSelectableVesselin interfaceIPlayer- Parameters:
vessel- to be added
-
removeSelectableVessel
public void removeSelectableVessel(INavigableVessel vessel)
Description copied from interface:IPlayerRemove a selectable vessel from the list.- Specified by:
removeSelectableVesselin interfaceIPlayer- Parameters:
vessel- to be removed.
-
addShip
public void addShip(IShip ship)
Description copied from interface:IPlayerAdd a new ship for the player
-
removeShip
public void removeShip(IShip ship)
Description copied from interface:IPlayerRemove a ship for the player- Specified by:
removeShipin interfaceIPlayer- Parameters:
ship- to be removed from the fleet.
-
findBuildings
public java.util.List<IBuilding> findBuildings(ICity city)
Description copied from interface:IPlayerFind all buildings of the player in the city- Specified by:
findBuildingsin interfaceIPlayer- Parameters:
city- where to search for buildings.- Returns:
- list of buildings in
cityowned by the player.
-
findTradingOffice
public java.util.Optional<ITradingOffice> findTradingOffice(ICity city)
Description copied from interface:IPlayerFind the trading office of the player in the city.- Specified by:
findTradingOfficein interfaceIPlayer- Parameters:
city- where to look for a trading office- Returns:
- Optional trading office. Empty if there is none in the
city.
-
findBuildings
public <T extends IBuilding> java.util.List<T> findBuildings(ICity city, java.lang.Class<T> buildingClass)
Description copied from interface:IPlayerFind all buildings in the city that are some subtype of the indicated class- Specified by:
findBuildingsin interfaceIPlayer- Parameters:
city- in which to look for buildingsbuildingClass- class of the building that is searched- Returns:
- type cast list of the buildings in
city.
-
marry
public void marry(ISpouseData spouse)
Marry a spouse
-
spouseDies
public void spouseDies()
Description copied from interface:IPlayerWidow and become unmarried again.- Specified by:
spouseDiesin interfaceIPlayer
-
getPersonalData
public IPersonalData getPersonalData()
Description copied from interface:IPlayerRetrieve the personal data of the player- Specified by:
getPersonalDatain interfaceIPlayer- Returns:
- personal data of the player.
-
getSpouseData
public java.util.Optional<ISpouseData> getSpouseData()
Description copied from interface:IPlayerRetrieve the personal data of the players spouse.- Specified by:
getSpouseDatain interfaceIPlayer- Returns:
- Optional spouse data. Empty if the player is not married.
-
updateRank
public void updateRank(ESocialRank rank)
Description copied from interface:IPlayerUpdate to the new social rank- Specified by:
updateRankin interfaceIPlayer- Parameters:
rank- new social rank.
-
findShips
public java.util.List<INavigableVessel> findShips(ICity city)
Description copied from interface:IPlayerFind all ships in a city
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
receiveSum
public void receiveSum(long amount)
Description copied from interface:ICreditorHandle method for recieving a payment- Specified by:
receiveSumin interfaceICreditor- Parameters:
amount- paid money amount.
-
updateCrimialDrive
public void updateCrimialDrive(int value)
Description copied from interface:IPlayerUpdate the new value indicating the level of criminallity of the player- Specified by:
updateCrimialDrivein interfaceIPlayer- Parameters:
value- new criminal drive value.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-