Class PopulationConsume
- java.lang.Object
-
- ch.sahits.game.openpatrician.model.city.PopulationConsume
-
public class PopulationConsume extends java.lang.Object
This class defines the amount of wares consumed by each populace class. The amount is per week. The sizes are specified in the ware specific sizes- Author:
- Andi Hotz, (c) Sahits GmbH, 2011 Created on Nov 28, 2011
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<EWare,java.util.Map<EPopulationClass,java.lang.Double>>
needs
Store the amounts
-
Constructor Summary
Constructors Constructor Description PopulationConsume()
PopulationConsume(java.lang.String propFileName)
Initialize the needs structure based on a property file
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getBasicWeeklyConsumtion(IWare ware)
Basic need distribution for a city of 1000 people of average income.double
getNeed(IWare ware, EPopulationClass popClass, int popSize)
Retrieve the amount needed of a ware by a population class of the sizedouble
getWeeklyConsumption(IWare ware, ICity city)
Calculate the weekly overall consumption of a ware in a city.
-
-
-
Field Detail
-
needs
private java.util.Map<EWare,java.util.Map<EPopulationClass,java.lang.Double>> needs
Store the amounts
-
-
Method Detail
-
getNeed
public double getNeed(IWare ware, EPopulationClass popClass, int popSize)
Retrieve the amount needed of a ware by a population class of the size- Parameters:
ware
- to be requestedpopClass
- population classpopSize
- number of people of the class- Returns:
- amount needed per week
-
getWeeklyConsumption
public double getWeeklyConsumption(IWare ware, ICity city)
Calculate the weekly overall consumption of a ware in a city.- Parameters:
ware
- that's consumption should be retrievedcity
- in which the consumption is checked.- Returns:
- amount of the ware consumed within a week.
-
getBasicWeeklyConsumtion
public int getBasicWeeklyConsumtion(IWare ware)
Basic need distribution for a city of 1000 people of average income.- Parameters:
ware
- to check for weekly consumption- Returns:
- weekly consumption of
ware
-
-