|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.common.model.ProductionCache
public class ProductionCache
The ProductionCache is contains all relevant
information about the production and consumption of the
colony. This includes the production of all colony tiles and
buildings, as well as the consumption of all units, buildings and
build queues.
| Field Summary | |
|---|---|
private Colony |
colony
The colony whose production is being cached. |
private java.util.Set<GoodsType> |
goodsUsed
|
private TypeCountMap<GoodsType> |
netProduction
|
private java.util.Map<java.lang.Object,ProductionInfo> |
productionAndConsumption
|
private boolean |
upToDate
|
| Constructor Summary | |
|---|---|
ProductionCache(Colony colony)
Creates a new ProductionCache instance. |
|
| Method Summary | |
|---|---|
private int |
getGoodsCount(GoodsType type)
Returns the number of goods of the given type stored in the colony. |
int |
getNetProductionOf(GoodsType type)
Returns the net production, that is the total production minus the total consumption, of the given GoodsType. |
ProductionInfo |
getProductionInfo(java.lang.Object object)
Returns the ProductionInfo for the given WorkLocation or Consumer. |
TypeCountMap<GoodsType> |
getProductionMap()
Gets a copy of the current production state. |
void |
invalidate()
Invalidates the production cache. |
void |
invalidate(GoodsType goodsType)
Invalidates the production cache if it produces or consumes the given GoodsType. |
private void |
update()
Updates all data structures. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Colony colony
private TypeCountMap<GoodsType> netProduction
private java.util.Map<java.lang.Object,ProductionInfo> productionAndConsumption
private java.util.Set<GoodsType> goodsUsed
private boolean upToDate
| Constructor Detail |
|---|
public ProductionCache(Colony colony)
ProductionCache instance.
colony - a Colony value| Method Detail |
|---|
private void update()
private int getGoodsCount(GoodsType type)
type - a GoodsType value
int valuepublic void invalidate()
FoundingFather is added, or when
the colony's production bonus changes.
public void invalidate(GoodsType goodsType)
goodsType - a GoodsType valuepublic int getNetProductionOf(GoodsType type)
type - a GoodsType value
int valuepublic ProductionInfo getProductionInfo(java.lang.Object object)
ProductionInfo for the given WorkLocation or Consumer.
object - an Object value
ProductionInfo valuepublic TypeCountMap<GoodsType> getProductionMap()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||