@Component @Scope(value="prototype") public class CityState extends Object
| Modifier and Type | Field and Description |
|---|---|
private IBuildingProduction |
buildingProduction |
private ICity |
city
Reference to the city model that is driven by this engine
|
private CityWall |
cityWall |
private PopulationConsume |
consume
Provider for the consume numbers
|
private Map<IWare,Double> |
consumed
Map of consumed wares, since only whole units can be consumed we need to store the fractions
|
private org.apache.logging.log4j.Logger |
logger |
private DependentPropertyInitializer |
propertyInitializer |
private Random |
rnd |
private IShipyard |
shipyardState
Ship yard state fos the city
|
private double |
surplusThreshold |
private TavernState |
tavernState
Tavern state for this city
|
| Constructor and Description |
|---|
CityState(ICity city,
IShipyard shipard,
TavernState tavern) |
| Modifier and Type | Method and Description |
|---|---|
Set<Map.Entry<IWare,Double>> |
consumedEntries()
Get the consumed entries as a set.
|
Optional<IWare> |
findMostNeededWare()
Find the ware which is consumed the most and which is missing for the longest time.
|
Optional<IWare> |
findWareWithMostSurplus()
Find the ware that the city sells near the minimal price.
|
double |
getConsumedAmount(EWare ware)
Retrieve the amount that is consumed so far.
|
(package private) Map<IWare,Integer> |
getSortedWareAvailabilityMap()
Find the wares and order them in the amount of their availability.
|
private void |
initCity() |
void |
replaceConsumedAmount(IWare ware,
double amount)
Set the amount of the ware that is consumed.
|
private final org.apache.logging.log4j.Logger logger
@Autowired private Random rnd
@DependentValue(value="ware.surplus.treshold") private double surplusThreshold
private ICity city
private Map<IWare,Double> consumed
private TavernState tavernState
private IShipyard shipyardState
@Autowired private PopulationConsume consume
@Autowired private IBuildingProduction buildingProduction
@Autowired private DependentPropertyInitializer propertyInitializer
@Autowired private CityWall cityWall
public CityState(ICity city, IShipyard shipard, TavernState tavern)
@PostConstruct private void initCity()
public Set<Map.Entry<IWare,Double>> consumedEntries()
public void replaceConsumedAmount(IWare ware, double amount)
ware - to be consumedamount - to be consumedpublic double getConsumedAmount(EWare ware)
ware - which should be checked for consumption.public Optional<IWare> findMostNeededWare()
public Optional<IWare> findWareWithMostSurplus()
Copyright © 2011-2016 Sahits GmbH. All Rights Reserved.