@Component @Scope(value="prototype") public class CityState extends Object
| Type | Property and Description |
|---|---|
javafx.beans.property.ObjectProperty<ECityState> |
cityEvent
Property holding the corrent city event, may be null.
|
| Modifier and Type | Field and Description |
|---|---|
private IBuildingProduction |
buildingProduction |
private ICity |
city
Reference to the city model that is driven by this engine
|
private javafx.beans.binding.ObjectBinding<ECityState> |
cityEvent |
private javafx.beans.property.ObjectProperty<ECityState> |
cityState |
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 Date |
date |
private javafx.beans.binding.BooleanBinding |
famine |
private static org.apache.logging.log4j.Logger |
LOGGER |
private javafx.beans.binding.ObjectBinding<IWare> |
longestMissingWare |
private Map<IWare,java.time.LocalDateTime> |
longestMissingWares |
private PopulationUpdateStats |
popUpdateStatistic |
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
|
private com.google.common.eventbus.AsyncEventBus |
timerEventBus |
| Constructor and Description |
|---|
CityState(ICity city,
IShipyard shipard,
TavernState tavern) |
| Modifier and Type | Method and Description |
|---|---|
javafx.beans.property.ObjectProperty<ECityState> |
cityEventProperty()
Property holding the corrent city event, may be null.
|
Set<Map.Entry<IWare,Double>> |
consumedEntries()
Get the consumed entries as a set.
|
void |
dailyUpdate(ClockTickPostDayChange dayChange)
Update the missing wares.
|
javafx.beans.binding.BooleanBinding |
famineBinding()
Binding indicating if there is a famine.
|
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.
|
private IWare |
getLongestMissingWares()
Retrieve the ware that is missing the longest.
|
(package private) Map<IWare,Integer> |
getSortedWareAvailabilityMap()
Find the wares and order them in the amount of their availability.
|
private void |
initCity() |
private boolean |
isFamine()
Check if there is a famine.
|
javafx.beans.binding.ObjectBinding<IWare> |
longestMissingWaresBinding()
Retrieve the ware that is missing the longest.
|
void |
replaceConsumedAmount(IWare ware,
double amount)
Set the amount of the ware that is consumed.
|
public javafx.beans.property.ObjectProperty<ECityState> cityEventProperty
private static 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
@Autowired private PopulationUpdateStats popUpdateStatistic
@Autowired @Qualifier(value="timerEventBus") private com.google.common.eventbus.AsyncEventBus timerEventBus
@Autowired private Date date
private javafx.beans.binding.ObjectBinding<IWare> longestMissingWare
private javafx.beans.binding.BooleanBinding famine
private javafx.beans.binding.ObjectBinding<ECityState> cityEvent
private javafx.beans.property.ObjectProperty<ECityState> cityState
public CityState(ICity city, IShipyard shipard, TavernState tavern)
@PostConstruct private void initCity()
public void dailyUpdate(ClockTickPostDayChange dayChange)
dayChange - private IWare getLongestMissingWares()
public javafx.beans.binding.ObjectBinding<IWare> longestMissingWaresBinding()
private boolean isFamine()
public javafx.beans.binding.BooleanBinding famineBinding()
public javafx.beans.property.ObjectProperty<ECityState> cityEventProperty()
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-2018 Sahits GmbH. All Rights Reserved.