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>
consumptionAmounts
private java.util.Map<IWare,java.lang.Integer>
productionAmounts
private 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 int
getConsumptionAmount(IWare ware)
Retrieve the consumption amount for a ware.int
getProductionAmount(IWare ware)
Retrieve the consumption amount for a ware.java.util.List<IWare>
getSortedProductionWares()
int
getStoredAmount(IWare ware)
Retrieve the stored amount for a ware.private void
init()
void
updateConsumption(IWare ware, int amount)
Update the knowledge about the weekly consumed amounts.void
updateProduction(IWare ware, int amount)
Update the knowlege about the weekly produced amounts.void
updateStored(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:ICityProductionConsumptionKnowledge
Retrieve the consumption amount for a ware.- Specified by:
getProductionAmount
in 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:ICityProductionConsumptionKnowledge
Retrieve the consumption amount for a ware.- Specified by:
getConsumptionAmount
in 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:ICityProductionConsumptionKnowledge
Retrieve the stored amount for a ware.- Specified by:
getStoredAmount
in interfaceICityProductionConsumptionKnowledge
- Parameters:
ware
- for which the stored amount is to be looked up.- Returns:
- stored amount.
-
-