Class 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 size
      double getWeeklyConsumption​(IWare ware, ICity city)
      Calculate the weekly overall consumption of a ware in a city.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • needs

        private java.util.Map<EWare,​java.util.Map<EPopulationClass,​java.lang.Double>> needs
        Store the amounts
    • Constructor Detail

      • PopulationConsume

        public PopulationConsume​(java.lang.String propFileName)
        Initialize the needs structure based on a property file
        Parameters:
        propFileName - file name of the properties
      • PopulationConsume

        public PopulationConsume()
    • 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 requested
        popClass - population class
        popSize - 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 retrieved
        city - 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