Interface ICity
-
- All Known Implementing Classes:
City
public interface ICity
Model of a city.- Author:
- Andi Hotz, (c) Sahits GmbH, 2011 Created on Sep 16, 2011
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addBuildingPermission(IPlayer player)
Add the bulidng permission for that player in the city.void
build(IBuilding building)
Remove a building from the list of buildings in the city<T extends IBuilding>
java.util.List<T>findBuilding(java.lang.Class<T> buildingClass, java.util.Optional<IPlayer> owner)
Find all matching buildings in a city.java.util.List<IBuilding>
getBuildings()
Retrieve a list of all buildings in the city.java.util.List<ICitizen>
getCitizen()
Retrieve the list of citizen in the city.CityState
getCityState()
Retrieve the city state.int
getContribution(IPlayer player, IWare ware)
Check out what the player contributed to the warejavafx.geometry.Point2D
getCoordinates()
Retrieve the coordinates of the cityIWare[]
getEffectiveProduction()
Retrieve the wares that are produced efficientlyjava.util.List<IWare>
getImported()
Retrieve the subset list of wares that are produced but are actually imported.IWare[]
getIneffectiveProduction()
Retrieve the wares that are produced inefficientlyEKontorType
getKontorType()
Retrieve the city typejava.util.Map<IWare,java.time.LocalDateTime>
getMissingWares()
Retrieve the missing wares along with their timesjava.lang.String
getName()
Retrieve the city namejava.lang.String
getNameTemplate()
Retrieve the non locale sepecific name template.double
getPercentageRoad()
Retrieve the amount of road in the city.int
getPopulation(EPopulationClass popclass)
Retrieve the current population of the city by classjavafx.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 classIReputation
getReputation(IPlayer player)
Retrieve the reputation of the player in the cityjava.util.List<IPlayer>
getResidentPlayers()
Retrieve all the players that have a office in this city.java.lang.String
getUniqueID()
Retrieve the unique ID of the city.AmountablePrice<IWare>
getWare(IWare ware)
Retrieve the amount of ware in the cityboolean
hasBuildingPermission(IPlayer player)
The player has building permission in this city.boolean
isRiverCity()
Check if the city is on a river instead of the open sea.int
move(IWare ware, int amount, ICitizen player)
Add or remove ware from the city.void
moveIn(IPlayer player, IReputation reputaion, Contributions contributions)
Add a player to the cityvoid
setCityState(CityState state)
Set the city statevoid
setPopulation(int population, EPopulationClass popClass)
Set the population by classvoid
tearDown(IBuilding building)
Add a new building to the city
-
-
-
Method Detail
-
getUniqueID
java.lang.String getUniqueID()
Retrieve the unique ID of the city.- Returns:
- UUID of the city
-
getKontorType
EKontorType getKontorType()
Retrieve the city type- Returns:
- kontor type of the city
-
getName
java.lang.String getName()
Retrieve the city name- Returns:
- localized name of the city.
-
getPopulation
int getPopulation(EPopulationClass popclass)
Retrieve the current population of the city by class- Parameters:
popclass
- for which to retrieve the population- Returns:
- population of the relevant
popclass
-
setPopulation
void setPopulation(int population, EPopulationClass popClass)
Set the population by class- Parameters:
population
- size of the population of the specifiedpopclass
popClass
- population class for which to set the population.
-
move
int move(IWare ware, int amount, ICitizen player)
Add or remove ware from the city. If the amount is negative it will be removed. If the full amount is not available only the available will be moved and returned. The amount is in the ware specific size.- Parameters:
ware
- to be movedamount
- of the ware that is movedplayer
- that moved the ware- Returns:
- amount moved
-
getIneffectiveProduction
IWare[] getIneffectiveProduction()
Retrieve the wares that are produced inefficiently- Returns:
- array of wares produced ineffectively.
-
getEffectiveProduction
IWare[] getEffectiveProduction()
Retrieve the wares that are produced efficiently- Returns:
- array of wares produced effectively.
-
getBuildings
java.util.List<IBuilding> getBuildings()
Retrieve a list of all buildings in the city. The list is immutable- Returns:
- list of buildings in the city.
-
tearDown
void tearDown(IBuilding building)
Add a new building to the city- Parameters:
building
- building to be removed.
-
build
void build(IBuilding building)
Remove a building from the list of buildings in the city- Parameters:
building
- to be added as completed
-
getReputation
IReputation getReputation(IPlayer player)
Retrieve the reputation of the player in the city- Parameters:
player
- for whom to retrieve the reputation- Returns:
- reputation of a player
-
moveIn
void moveIn(IPlayer player, IReputation reputaion, Contributions contributions)
Add a player to the city- Parameters:
player
- that is added to the cityreputaion
- of that player in the citycontributions
- contibutions of that player in the city.
-
getContribution
int getContribution(IPlayer player, IWare ware)
Check out what the player contributed to the ware- Parameters:
player
- whose contribution is to be checkedware
- that is checked for contribution- Returns:
- amount of the contribution may also be negative
-
getMissingWares
java.util.Map<IWare,java.time.LocalDateTime> getMissingWares()
Retrieve the missing wares along with their times- Returns:
- map of wares and since when they are missing
-
getCoordinates
javafx.geometry.Point2D getCoordinates()
Retrieve the coordinates of the city- Returns:
- coordinates of the city
-
getResidentPlayers
java.util.List<IPlayer> getResidentPlayers()
Retrieve all the players that have a office in this city.- Returns:
- immutable list
-
getCityState
CityState getCityState()
Retrieve the city state.- Returns:
- Retrieve hte city state
-
setCityState
void setCityState(CityState state)
Set the city state- Parameters:
state
- state of the city.
-
getWare
AmountablePrice<IWare> getWare(IWare ware)
Retrieve the amount of ware in the city- Parameters:
ware
- for which to retrieve amount and price- Returns:
- amount and price of the ware.
-
getPopulationProperty
javafx.beans.property.IntegerProperty getPopulationProperty(EPopulationClass popclass)
Retrieve the population count for a class- Parameters:
popclass
- population class- Returns:
- integer property for the population of a specific
popclass
-
getPopulationBinding
javafx.beans.binding.IntegerBinding getPopulationBinding()
Retrieve the binding of the city's total population.- Returns:
- Integer binding of the overall population.
-
getCitizen
java.util.List<ICitizen> getCitizen()
Retrieve the list of citizen in the city. This list contains various player as well as some instances used by the AI to govern the city.- Returns:
- List of citizens in the city.
-
findBuilding
<T extends IBuilding> java.util.List<T> findBuilding(java.lang.Class<T> buildingClass, java.util.Optional<IPlayer> owner)
Find all matching buildings in a city.- Parameters:
buildingClass
- class of the buildingowner
- search can be restricted to a player.- Returns:
- List of buildings of type T
-
getNameTemplate
java.lang.String getNameTemplate()
Retrieve the non locale sepecific name template.- Returns:
- non localized name template
-
isRiverCity
boolean isRiverCity()
Check if the city is on a river instead of the open sea.- Returns:
- true if the city is located on a river (instead of sea)
-
getImported
java.util.List<IWare> getImported()
Retrieve the subset list of wares that are produced but are actually imported.- Returns:
- List of wares that are imported.
-
hasBuildingPermission
boolean hasBuildingPermission(IPlayer player)
The player has building permission in this city.- Parameters:
player
- for whom to check building permission- Returns:
- true if
player
has building permission.
-
addBuildingPermission
void addBuildingPermission(IPlayer player)
Add the bulidng permission for that player in the city.- Parameters:
player
- for whom to add a building permission
-
getPercentageRoad
double getPercentageRoad()
Retrieve the amount of road in the city. The amount is the value of number road tiles versus the population.- Returns:
- percentage [0,1] of the built road in the city.
-
-