Class Occupation


  • public class Occupation
    extends java.lang.Object
    Simple container to define where and what a unit is working on.
    • Constructor Detail

      • Occupation

        public Occupation​(WorkLocation workLocation,
                          ProductionType productionType,
                          GoodsType workType)
        Create an Occupation.
        Parameters:
        workLocation - The WorkLocation to work at.
        productionType - The ProductionType to use at the work location.
        workType - The GoodsType to produce at the work location with the production type.
    • Method Detail

      • install

        public boolean install​(Unit unit)
        Install a unit into this occupation.
        Parameters:
        unit - The Unit to establish.
        Returns:
        True if the unit is installed.
      • improve

        private int improve​(UnitType unitType,
                            WorkLocation wl,
                            int bestAmount,
                            java.util.Collection<GoodsType> workTypes,
                            boolean alone,
                            LogBuilder lb)
        Improve this occupation to the best available production for the given unit type.
        Parameters:
        unitType - The UnitType to produce the goods.
        wl - The WorkLocation to check.
        bestAmount - The best amount of goods produced found so far.
        workTypes - A collection of GoodsType to consider producing.
        alone - True if the unit is alone, and can set the production type.
        lb - A LogBuilder to log to.
        Returns:
        The best amount of production found.
      • improve

        public int improve​(Unit unit,
                           WorkLocation wl,
                           int bestAmount,
                           java.util.Collection<GoodsType> workTypes,
                           LogBuilder lb)
        Improve this occupation to the best available production for the given unit.
        Parameters:
        unit - The Unit to produce the goods.
        wl - The WorkLocation to check.
        bestAmount - The best amount of goods produced found so far.
        workTypes - A collection of GoodsType to consider producing.
        lb - A LogBuilder to log to.
        Returns:
        The best amount of production found.
      • improve

        public int improve​(UnitType unitType,
                           WorkLocation wl,
                           int bestAmount,
                           java.util.Collection<GoodsType> workTypes,
                           LogBuilder lb)
        Improve this occupation to the best available production for the given unit type.
        Parameters:
        unitType - The UnitType to produce the goods.
        wl - The WorkLocation to check.
        bestAmount - The best amount of goods produced found so far.
        workTypes - A collection of GoodsType to consider producing.
        lb - A LogBuilder to log to.
        Returns:
        The best amount of production found.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object