public class ProductionCache
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ProductionCache.Entry
An Entry in the production cache represents a single unit
producing goods in a certain work location.
|
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
ProductionCache(Colony colony) |
Modifier and Type | Method and Description |
---|---|
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.
|
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 final TypeCountMap<BuildingType> unitCounts
public ProductionCache(Colony colony)
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
valuepublic static java.util.List<ProductionCache.Entry> removeEntries(Unit unit, WorkLocation workLocation, java.util.List<ProductionCache.Entry> entryList)
unit
- a Unit
workLocation
- a WorkLocation
entryList
- a List
of Entry
sEntry
s removed