Package net.sf.freecol.common.model
Class Occupation
- java.lang.Object
-
- net.sf.freecol.common.model.Occupation
-
public class Occupation extends java.lang.ObjectSimple container to define where and what a unit is working on.
-
-
Field Summary
Fields Modifier and Type Field Description ProductionTypeproductionTypeWorkLocationworkLocationGoodsTypeworkType
-
Constructor Summary
Constructors Constructor Description Occupation(WorkLocation workLocation, ProductionType productionType, GoodsType workType)Create an Occupation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intimprove(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.private intimprove(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.intimprove(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.booleaninstall(Unit unit)Install a unit into this occupation.java.lang.StringtoString()
-
-
-
Field Detail
-
workLocation
public WorkLocation workLocation
-
productionType
public ProductionType productionType
-
workType
public GoodsType workType
-
-
Constructor Detail
-
Occupation
public Occupation(WorkLocation workLocation, ProductionType productionType, GoodsType workType)
Create an Occupation.- Parameters:
workLocation- TheWorkLocationto work at.productionType- TheProductionTypeto use at the work location.workType- TheGoodsTypeto 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- TheUnitto 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- TheUnitTypeto produce the goods.wl- TheWorkLocationto check.bestAmount- The best amount of goods produced found so far.workTypes- A collection ofGoodsTypeto consider producing.alone- True if the unit is alone, and can set the production type.lb- ALogBuilderto 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- TheUnitto produce the goods.wl- TheWorkLocationto check.bestAmount- The best amount of goods produced found so far.workTypes- A collection ofGoodsTypeto consider producing.lb- ALogBuilderto 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- TheUnitTypeto produce the goods.wl- TheWorkLocationto check.bestAmount- The best amount of goods produced found so far.workTypes- A collection ofGoodsTypeto consider producing.lb- ALogBuilderto log to.- Returns:
- The best amount of production found.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-