@Component @Scope(value="prototype") public class City extends WareHolding implements ICity
occupiedSpaceProperty| Modifier and Type | Field and Description |
|---|---|
private List<IBuilding> |
buildings
Store the buildings in the city
|
private List<ICitizen> |
citizen |
private CityState |
cityState |
private javafx.geometry.Point2D |
coordinates |
private Date |
date |
private IWare[] |
effectiveProduction |
private IWare[] |
ineffectiveProduction |
private EKontorType |
kontorType |
private Locale |
locale |
private org.apache.logging.log4j.Logger |
logger |
private org.springframework.context.MessageSource |
messageSource |
private Map<IWare,org.joda.time.DateTime> |
missingWares |
private String |
name |
private String |
nameTemplate |
private Map<IPlayer,Contributions> |
playersContributions
Store the contibutions of the players
|
protected com.google.common.collect.Interner<javafx.geometry.Point2D> |
pointInterner |
private Map<EPopulationClass,javafx.beans.property.IntegerProperty> |
population
Holding the population split by population classes
|
private UniqueKeyMap<IPlayer,IReputation> |
reputation
Map holding the reputation of the different players
|
private Random |
rnd |
private LateIntegerBinding |
totalPopulation |
computablePrice| Constructor and Description |
|---|
City(ch.sahits.game.openpatrician.data.map.City city) |
City(FoundNewSettlement futureTown) |
City(String configFileName)
This Constructor is used by tests
|
| Modifier and Type | Method and Description |
|---|---|
void |
build(IBuilding building)
Add a new building to the city
|
private int |
calculateInitialBeggarCount(int totalPopulation) |
boolean |
equals(Object o) |
<T extends IBuilding> |
findBuilding(Class<T> buildingClass,
Optional<IPlayer> owner)
Find all matching buildings in a city.
|
List<IBuilding> |
getBuildings()
Retrieve a list of all buildings in the city.
|
int |
getContribution(IPlayer player,
IWare ware)
Check out what the player contributed to the ware
|
Map<IWare,org.joda.time.DateTime> |
getMissingWares()
Retrieve the missing wares along with their times
|
int |
getPopulation(EPopulationClass popclass)
Retrieve the population count for a class
|
javafx.beans.binding.IntegerBinding |
getPopulationBinding()
Retrieve the binding of the city's total population.
|
javafx.beans.property.IntegerProperty |
getPopulationProperty(EPopulationClass popclass)
Retrieve the population count for a class
|
IReputation |
getReputation(IPlayer player)
Retrieve the reputation of the player in the city
|
List<IPlayer> |
getResidentPlayers()
Retrieve all the players that have a office in this city.
|
String |
getUniqueID()
Retrieve the unique ID of the city.
|
int |
hashCode() |
private void |
init() |
private void |
initPopulation()
Initialize the population of the different classes based on the properties
|
protected void |
initWares()
Init the amount of wares available in the city
This method is protected so it can be overriden by subclasses for testing
|
private int |
internalPopulationCount()
Count the population.
|
int |
move(IWare ware,
int amount,
ICitizen player)
Move ware into this holding.
|
void |
moveIn(IPlayer player,
IReputation reputaion,
Contributions contributions)
Add a player to the city
|
void |
setPopulation(int population,
EPopulationClass popClass)
Set the population count for a apopulation class
|
void |
tearDown(IBuilding building)
Remove a building from the list of buildings in the city
|
addNewWare, bindStoredAmount, computeAVGPrice, containsWare, getOccupiedSpace, getWare, occupiedSpaceProperty, setOccupiedSpace, storedAmountBinding, unbindAllAmountsclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetCitizen, getCityState, getCoordinates, getEffectiveProduction, getIneffectiveProduction, getKontorType, getName, getNameTemplate, getWare, setCityStateprivate final org.apache.logging.log4j.Logger logger
@Autowired private Random rnd
private final IWare[] effectiveProduction
private final IWare[] ineffectiveProduction
private String name
private final String nameTemplate
private final EKontorType kontorType
@Autowired private Locale locale
@Autowired private org.springframework.context.MessageSource messageSource
private javafx.geometry.Point2D coordinates
private UniqueKeyMap<IPlayer,IReputation> reputation
private Map<IPlayer,Contributions> playersContributions
private final Map<EPopulationClass,javafx.beans.property.IntegerProperty> population
private LateIntegerBinding totalPopulation
private CityState cityState
@Autowired private Date date
@Autowired protected com.google.common.collect.Interner<javafx.geometry.Point2D> pointInterner
public City(ch.sahits.game.openpatrician.data.map.City city)
public City(FoundNewSettlement futureTown)
City(String configFileName) throws IOException
IOException@PostConstruct @IgnoreOnDeserialisation private void init()
protected void initWares()
private void initPopulation()
private int calculateInitialBeggarCount(int totalPopulation)
private int internalPopulationCount()
public javafx.beans.binding.IntegerBinding getPopulationBinding()
ICitygetPopulationBinding in interface ICitypublic void setPopulation(int population,
EPopulationClass popClass)
setPopulation in interface ICitypopulation - countpopClass - population classpublic int getPopulation(EPopulationClass popclass)
getPopulation in interface ICitypopclass - population classpublic javafx.beans.property.IntegerProperty getPopulationProperty(EPopulationClass popclass)
ICitygetPopulationProperty in interface ICitypopclass - population classpublic List<IBuilding> getBuildings()
ICitygetBuildings in interface ICitypublic void build(IBuilding building)
public void tearDown(IBuilding building)
public IReputation getReputation(IPlayer player)
ICitygetReputation in interface ICitypublic void moveIn(IPlayer player, IReputation reputaion, Contributions contributions)
ICitypublic int move(IWare ware, int amount, ICitizen player)
move in interface ICitymove in class WareHoldingware - to be movedamount - of the ware that is movedplayer - that initiates the moving, may be null, e.g. if the moving is initiated by a citypublic int getContribution(IPlayer player, IWare ware)
ICitygetContribution in interface ICityplayer - whose contribution is to be checkedware - that is checked for contributionpublic Map<IWare,org.joda.time.DateTime> getMissingWares()
ICitygetMissingWares in interface ICitypublic List<IPlayer> getResidentPlayers()
ICitygetResidentPlayers in interface ICitypublic String getUniqueID()
ICitygetUniqueID in interface ICitypublic <T extends IBuilding> List<T> findBuilding(Class<T> buildingClass, Optional<IPlayer> owner)
ICityfindBuilding in interface ICitybuildingClass - class of the buildingowner - search can be restricted to a player.Copyright © 2011-2016 Sahits GmbH. All Rights Reserved.