|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.server.ai.ProductionCache
public class ProductionCache
The production cache is intended to record all possible combinations of units producing goods in a colony's work locations. These entries are sorted, allowing fast retrieval of the most efficient way to produce a given type of goods.
| Nested Class Summary | |
|---|---|
class |
ProductionCache.Entry
An Entry in the production cache represents a single unit producing goods in a certain work location. |
| Field Summary | |
|---|---|
private java.util.List<ProductionCache.Entry> |
assigned
The assigned entries. |
private Colony |
colony
|
private java.util.Set<ColonyTile> |
colonyTiles
The available colony tiles. |
private static java.util.Comparator<ProductionCache.Entry> |
defaultComparator
Compares entries by production. |
private java.util.Map<GoodsType,java.util.List<ProductionCache.Entry>> |
entries
Sorted entries per goods type. |
private static java.util.Comparator<ProductionCache.Entry> |
marketValueComparator
Compares entries by market value of production. |
private java.util.List<ProductionCache.Entry> |
reserved
The reserved entries. |
private int |
unitCount
The number of units available. |
private TypeCountMap<BuildingType> |
unitCounts
The number of Units in various buildings. |
private java.util.Set<Unit> |
units
The units available in the colony. |
| Constructor Summary | |
|---|---|
ProductionCache(Colony colony)
|
|
| Method Summary | |
|---|---|
void |
assign(ProductionCache.Entry entry)
Assigns an entry. |
private java.util.List<ProductionCache.Entry> |
createEntries(GoodsType goodsType)
|
int |
decrementUnitCount(BuildingType buildingType)
|
java.util.List<ProductionCache.Entry> |
getAssigned()
|
java.util.List<ProductionCache.Entry> |
getEntries(GoodsType goodsType)
|
java.util.List<ProductionCache.Entry> |
getEntries(java.util.List<GoodsType> goodsTypes)
|
java.util.List<ProductionCache.Entry> |
getEntries(java.util.List<GoodsType> goodsTypes,
boolean useMarketValues)
|
java.util.List<ProductionCache.Entry> |
getReserved()
|
int |
getUnitCount()
|
int |
getUnitCount(BuildingType buildingType)
|
java.util.Set<Unit> |
getUnits()
|
static java.util.List<ProductionCache.Entry> |
removeEntries(Unit unit,
WorkLocation workLocation,
java.util.List<ProductionCache.Entry> entryList)
Removes all entries that refer to the unit or work location given from the given list of entries and returns them. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final Colony colony
private final java.util.Set<Unit> units
private final java.util.Set<ColonyTile> colonyTiles
private final java.util.Map<GoodsType,java.util.List<ProductionCache.Entry>> entries
private final java.util.List<ProductionCache.Entry> assigned
private final java.util.List<ProductionCache.Entry> reserved
private static final java.util.Comparator<ProductionCache.Entry> defaultComparator
private static final java.util.Comparator<ProductionCache.Entry> marketValueComparator
private int unitCount
private TypeCountMap<BuildingType> unitCounts
| Constructor Detail |
|---|
public ProductionCache(Colony colony)
| Method Detail |
|---|
private java.util.List<ProductionCache.Entry> createEntries(GoodsType goodsType)
public java.util.Set<Unit> getUnits()
public int getUnitCount()
public int getUnitCount(BuildingType buildingType)
public int decrementUnitCount(BuildingType buildingType)
public java.util.List<ProductionCache.Entry> getAssigned()
public java.util.List<ProductionCache.Entry> getReserved()
public java.util.List<ProductionCache.Entry> getEntries(GoodsType goodsType)
public java.util.List<ProductionCache.Entry> getEntries(java.util.List<GoodsType> goodsTypes)
public java.util.List<ProductionCache.Entry> getEntries(java.util.List<GoodsType> goodsTypes,
boolean useMarketValues)
public void assign(ProductionCache.Entry entry)
entry - an Entry value
public static java.util.List<ProductionCache.Entry> removeEntries(Unit unit,
WorkLocation workLocation,
java.util.List<ProductionCache.Entry> entryList)
unit - a UnitworkLocation - a WorkLocationentryList - a List of Entrys
Entrys removed
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||