|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectch.sahits.game.openpatrician.model.impl.WareHolding
ch.sahits.game.openpatrician.model.city.impl.City
abstract class City
Implementation of the city model. The model of the city should only be instanciated once. A city is unique. therefore equality can be tested by identity.
| Field Summary | |
|---|---|
private List<IBuilding> |
buildings
Store the buildings in the city |
private IWare[] |
effectiveProduction
|
private IWare[] |
ineffectiveProduction
|
private EKontorType |
kontorType
|
private Locale |
locale
|
private String |
name
|
private Map<IPlayer,Contributions> |
playersContributions
Store the contibutions of the players |
private HashMap<EPopulationClass,Integer> |
population
Holding the population split by population classes |
private Map<IPlayer,IReputation> |
reputation
Map holding the reputation of the different players |
| Constructor Summary | |
|---|---|
City(String configFileName)
|
|
| Method Summary | |
|---|---|
void |
build(IBuilding building)
Add a new building to the 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 |
IWare[] |
getEffectiveProduction()
Retrieve the wares that are produced efficiently |
IWare[] |
getIneffectiveProduction()
Retrieve the wares that are produced inefficiently |
EKontorType |
getKontorType()
Retrieve the city type |
String |
getName()
Retrieve the city name |
int |
getPopulation()
Retrieve the total population |
int |
getPopulation(EPopulationClass popclass)
Retrieve the population count for a class |
IReputation |
getReputation(IPlayer player)
Retrieve the reputation of the player in the city |
ESocialRank |
getSocialRank()
Retrieve the social rank in this city |
private void |
initPopulation(Properties props)
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 |
int |
move(IWare ware,
int amount,
IPlayer player)
Move ware into this holding. |
void |
moveIn(IPlayer player)
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 |
| Methods inherited from class ch.sahits.game.openpatrician.model.impl.WareHolding |
|---|
addNewWare, computeAVGPrice, containsWare, getWare |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface ch.sahits.game.openpatrician.model.city.ICity |
|---|
getUniqueID, getWare |
| Field Detail |
|---|
private final IWare[] effectiveProduction
private final IWare[] ineffectiveProduction
private final String name
private final EKontorType kontorType
private final Locale locale
private List<IBuilding> buildings
private Map<IPlayer,IReputation> reputation
private Map<IPlayer,Contributions> playersContributions
private final HashMap<EPopulationClass,Integer> population
| Constructor Detail |
|---|
public City(String configFileName)
throws IOException
IOException| Method Detail |
|---|
protected void initWares()
private void initPopulation(Properties props)
props - public int getPopulation()
getPopulation in interface ICity
public void setPopulation(int population,
EPopulationClass popClass)
setPopulation in interface ICitypopulation - countpopClass - population classpublic int getPopulation(EPopulationClass popclass)
getPopulation in interface ICitypopclass - population class
public String getName()
ICity
getName in interface ICitypublic EKontorType getKontorType()
ICity
getKontorType in interface ICitypublic IWare[] getEffectiveProduction()
getEffectiveProduction in interface ICitypublic IWare[] getIneffectiveProduction()
getIneffectiveProduction in interface ICitypublic List<IBuilding> getBuildings()
ICity
getBuildings in interface ICitypublic void build(IBuilding building)
build in interface ICitybuilding - public void tearDown(IBuilding building)
tearDown in interface ICitybuilding - public IReputation getReputation(IPlayer player)
ICity
getReputation in interface ICitypublic void moveIn(IPlayer player)
ICity
moveIn in interface ICitypublic ESocialRank getSocialRank()
ICity
getSocialRank in interface ICity
public int move(IWare ware,
int amount,
IPlayer 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 city
public int getContribution(IPlayer player,
IWare ware)
ICity
getContribution in interface ICityplayer - whose contribution is to be checkedware - that is checked for contribution
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||