Package net.sf.freecol.common.model
Class Occupation
- java.lang.Object
-
- net.sf.freecol.common.model.Occupation
-
public class Occupation extends java.lang.Object
Simple container to define where and what a unit is working on.
-
-
Field Summary
Fields Modifier and Type Field Description ProductionType
productionType
WorkLocation
workLocation
GoodsType
workType
-
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 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.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.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.boolean
install(Unit unit)
Install a unit into this occupation.java.lang.String
toString()
-
-
-
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
- TheWorkLocation
to work at.productionType
- TheProductionType
to use at the work location.workType
- TheGoodsType
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
- TheUnit
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
- TheUnitType
to produce the goods.wl
- TheWorkLocation
to check.bestAmount
- The best amount of goods produced found so far.workTypes
- A collection ofGoodsType
to consider producing.alone
- True if the unit is alone, and can set the production type.lb
- ALogBuilder
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
- TheUnit
to produce the goods.wl
- TheWorkLocation
to check.bestAmount
- The best amount of goods produced found so far.workTypes
- A collection ofGoodsType
to consider producing.lb
- ALogBuilder
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
- TheUnitType
to produce the goods.wl
- TheWorkLocation
to check.bestAmount
- The best amount of goods produced found so far.workTypes
- A collection ofGoodsType
to consider producing.lb
- ALogBuilder
to log to.- Returns:
- The best amount of production found.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-