Class BuildingProduction
- java.lang.Object
-
- ch.sahits.game.openpatrician.clientserverinterface.service.BuildingProduction
-
- All Implemented Interfaces:
IBuildingProduction
@Service @Lazy @DependentInitialisation(StartNewGameBean.class) public class BuildingProduction extends java.lang.Object implements IBuildingProduction
This class helps computing the production amount for the different buildings- Author:
- Andi Hotz, (c) Sahits GmbH, 2012 Created on Jul 18, 2012
-
-
Field Summary
Fields Modifier and Type Field Description private CityProductionAndConsumptionService
cityProductionAndConsumptionService
private PlayerList
players
-
Constructor Summary
Constructors Constructor Description BuildingProduction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getConsumption(IWare ware, ICity city, IPlayer player)
Retrieve the amount of ware that all the workshops of a player consume within a weekint
getProduction(IWare ware, ICity city, IPlayer player)
Compute the total amount of ware the player produces in the city within a weekint
getTotalConsumtion(IWare ware, ICity city)
Retrieve the amount the workshops consume to produce the ware within a weekint
getTotalProduction(IWare ware, ICity city)
Compute the total amount of ware that is produced in the city within a week
-
-
-
Field Detail
-
cityProductionAndConsumptionService
@Autowired private CityProductionAndConsumptionService cityProductionAndConsumptionService
-
players
@Autowired private PlayerList players
-
-
Method Detail
-
getTotalProduction
public int getTotalProduction(IWare ware, ICity city)
Description copied from interface:IBuildingProduction
Compute the total amount of ware that is produced in the city within a week- Specified by:
getTotalProduction
in interfaceIBuildingProduction
- Parameters:
ware
- that is producedcity
- in witch the ware is produced- Returns:
- total amount of all the production by all the players in the city
-
getProduction
public int getProduction(IWare ware, ICity city, IPlayer player)
Description copied from interface:IBuildingProduction
Compute the total amount of ware the player produces in the city within a week- Specified by:
getProduction
in interfaceIBuildingProduction
- Parameters:
ware
- that is producedcity
- in witch the ware is producedplayer
- that produces the ware- Returns:
- total amount of the ware produced by that player in the city
-
getTotalConsumtion
public int getTotalConsumtion(IWare ware, ICity city)
Description copied from interface:IBuildingProduction
Retrieve the amount the workshops consume to produce the ware within a week- Specified by:
getTotalConsumtion
in interfaceIBuildingProduction
- Parameters:
ware
- that is consumedcity
- in witch the ware is consumed- Returns:
- amount of the ware that is consumed
-
getConsumption
public int getConsumption(IWare ware, ICity city, IPlayer player)
Retrieve the amount of ware that all the workshops of a player consume within a week- Parameters:
ware
- that is consumedcity
- in witch the ware is consumedplayer
- who owns the workshops- Returns:
- amount of the ware that is consumed
-
-