Class CityProductionConsumptionKnowledge
- java.lang.Object
-
- ch.sahits.game.openpatrician.engine.player.CityProductionConsumptionKnowledge
-
- All Implemented Interfaces:
ICityProductionConsumptionKnowledge
public class CityProductionConsumptionKnowledge extends java.lang.Object implements ICityProductionConsumptionKnowledge
Model of the knowledge of a player about the production and the consumption of a city.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<IWare,java.lang.Integer>consumptionAmountsprivate java.util.Map<IWare,java.lang.Integer>productionAmountsprivate java.util.Map<IWare,java.lang.Integer>storedAmounts
-
Constructor Summary
Constructors Constructor Description CityProductionConsumptionKnowledge()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetConsumptionAmount(IWare ware)Retrieve the consumption amount for a ware.intgetProductionAmount(IWare ware)Retrieve the consumption amount for a ware.java.util.List<IWare>getSortedProductionWares()intgetStoredAmount(IWare ware)Retrieve the stored amount for a ware.private voidinit()voidupdateConsumption(IWare ware, int amount)Update the knowledge about the weekly consumed amounts.voidupdateProduction(IWare ware, int amount)Update the knowlege about the weekly produced amounts.voidupdateStored(IWare ware, int amount)Update the knowledge about the stored amounts.
-
-
-
Method Detail
-
init
@PostConstruct @IgnoreOnDeserialisation private void init()
-
updateProduction
public void updateProduction(IWare ware, int amount)
Update the knowlege about the weekly produced amounts.- Parameters:
ware- that is to be updated in the productionamount- amount of the ware that is to be updated.
-
getSortedProductionWares
public java.util.List<IWare> getSortedProductionWares()
-
getProductionAmount
public int getProductionAmount(IWare ware)
Description copied from interface:ICityProductionConsumptionKnowledgeRetrieve the consumption amount for a ware.- Specified by:
getProductionAmountin interfaceICityProductionConsumptionKnowledge- Parameters:
ware- for which the production amount is to be looked up- Returns:
- amount produced in the city per week.
-
updateConsumption
public void updateConsumption(IWare ware, int amount)
Update the knowledge about the weekly consumed amounts.- Parameters:
ware- ware that is to be consumedamount- amount of the ware that is to be consumed
-
getConsumptionAmount
public int getConsumptionAmount(IWare ware)
Description copied from interface:ICityProductionConsumptionKnowledgeRetrieve the consumption amount for a ware.- Specified by:
getConsumptionAmountin interfaceICityProductionConsumptionKnowledge- Parameters:
ware- for which the consumption amount is to be looked up.- Returns:
- amount consumed in the city per week
-
updateStored
public void updateStored(IWare ware, int amount)
Update the knowledge about the stored amounts.- Parameters:
ware- that is to be storedamount- amount of the ware that is to be stored
-
getStoredAmount
public int getStoredAmount(IWare ware)
Description copied from interface:ICityProductionConsumptionKnowledgeRetrieve the stored amount for a ware.- Specified by:
getStoredAmountin interfaceICityProductionConsumptionKnowledge- Parameters:
ware- for which the stored amount is to be looked up.- Returns:
- stored amount.
-
-