public class DefaultBalanceablePoolModel<ContainerType,ItemType> extends java.lang.Object implements BalanceablePoolModel<ContainerType,ItemType>
BalanceablePoolModel
, providing essential arithmetic for item and container
workrates and thresholds. See subclasses for specific requirements for migrating items.Constructor and Description |
---|
DefaultBalanceablePoolModel(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
void |
dumpItemDistribution() |
void |
dumpItemDistribution(java.io.PrintStream out) |
java.util.Map<ContainerType,java.lang.Double> |
getContainerWorkrates() |
double |
getCurrentPoolWorkrate() |
double |
getHighThreshold(ContainerType container) |
java.util.Set<ItemType> |
getItemsForContainer(ContainerType node) |
java.lang.Double |
getItemWorkrate(ItemType item) |
java.util.Map<ItemType,java.lang.Double> |
getItemWorkrates(ContainerType node)
contains -1 instead of actual item workrate, for items which cannot be moved
|
Location |
getLocation(ContainerType container) |
double |
getLowThreshold(ContainerType container) |
java.lang.String |
getName() |
java.lang.String |
getName(ContainerType container) |
ContainerType |
getParentContainer(ItemType item) |
java.util.Set<ContainerType> |
getPoolContents() |
double |
getPoolHighThreshold() |
double |
getPoolLowThreshold() |
int |
getPoolSize() |
double |
getTotalWorkrate(ContainerType container) |
boolean |
isCold() |
boolean |
isHot() |
boolean |
isItemAllowedIn(ItemType item,
Location location) |
boolean |
isItemMoveable(ItemType item) |
java.lang.String |
itemDistributionToString()
Warning: this can be an expensive (time and memory) operation if there are a lot of items/containers.
|
void |
onContainerAdded(ContainerType newContainer,
double lowThreshold,
double highThreshold) |
void |
onContainerRemoved(ContainerType oldContainer) |
void |
onItemAdded(ItemType item,
ContainerType parentContainer) |
void |
onItemAdded(ItemType item,
ContainerType parentContainer,
boolean immovable) |
void |
onItemMoved(ItemType item,
ContainerType newNode) |
void |
onItemRemoved(ItemType item) |
void |
onItemWorkrateUpdated(ItemType item,
double newValue) |
public DefaultBalanceablePoolModel(java.lang.String name)
public ContainerType getParentContainer(ItemType item)
public java.util.Set<ItemType> getItemsForContainer(ContainerType node)
public java.lang.Double getItemWorkrate(ItemType item)
public double getPoolLowThreshold()
getPoolLowThreshold
in interface BalanceablePoolModel<ContainerType,ItemType>
public double getPoolHighThreshold()
getPoolHighThreshold
in interface BalanceablePoolModel<ContainerType,ItemType>
public double getCurrentPoolWorkrate()
getCurrentPoolWorkrate
in interface BalanceablePoolModel<ContainerType,ItemType>
public boolean isHot()
isHot
in interface BalanceablePoolModel<ContainerType,ItemType>
public boolean isCold()
isCold
in interface BalanceablePoolModel<ContainerType,ItemType>
public java.lang.String getName()
getName
in interface BalanceablePoolModel<ContainerType,ItemType>
public int getPoolSize()
getPoolSize
in interface BalanceablePoolModel<ContainerType,ItemType>
public java.util.Set<ContainerType> getPoolContents()
getPoolContents
in interface BalanceablePoolModel<ContainerType,ItemType>
public java.lang.String getName(ContainerType container)
getName
in interface BalanceablePoolModel<ContainerType,ItemType>
public Location getLocation(ContainerType container)
getLocation
in interface BalanceablePoolModel<ContainerType,ItemType>
public double getLowThreshold(ContainerType container)
getLowThreshold
in interface BalanceablePoolModel<ContainerType,ItemType>
public double getHighThreshold(ContainerType container)
getHighThreshold
in interface BalanceablePoolModel<ContainerType,ItemType>
public double getTotalWorkrate(ContainerType container)
getTotalWorkrate
in interface BalanceablePoolModel<ContainerType,ItemType>
public java.util.Map<ContainerType,java.lang.Double> getContainerWorkrates()
getContainerWorkrates
in interface BalanceablePoolModel<ContainerType,ItemType>
public java.util.Map<ItemType,java.lang.Double> getItemWorkrates(ContainerType node)
BalanceablePoolModel
getItemWorkrates
in interface BalanceablePoolModel<ContainerType,ItemType>
public boolean isItemMoveable(ItemType item)
isItemMoveable
in interface BalanceablePoolModel<ContainerType,ItemType>
public boolean isItemAllowedIn(ItemType item, Location location)
isItemAllowedIn
in interface BalanceablePoolModel<ContainerType,ItemType>
public void onItemMoved(ItemType item, ContainerType newNode)
onItemMoved
in interface BalanceablePoolModel<ContainerType,ItemType>
public void onContainerAdded(ContainerType newContainer, double lowThreshold, double highThreshold)
onContainerAdded
in interface BalanceablePoolModel<ContainerType,ItemType>
public void onContainerRemoved(ContainerType oldContainer)
onContainerRemoved
in interface BalanceablePoolModel<ContainerType,ItemType>
public void onItemAdded(ItemType item, ContainerType parentContainer)
onItemAdded
in interface BalanceablePoolModel<ContainerType,ItemType>
public void onItemAdded(ItemType item, ContainerType parentContainer, boolean immovable)
onItemAdded
in interface BalanceablePoolModel<ContainerType,ItemType>
public void onItemRemoved(ItemType item)
onItemRemoved
in interface BalanceablePoolModel<ContainerType,ItemType>
public void onItemWorkrateUpdated(ItemType item, double newValue)
onItemWorkrateUpdated
in interface BalanceablePoolModel<ContainerType,ItemType>
public java.lang.String itemDistributionToString()
public void dumpItemDistribution()
public void dumpItemDistribution(java.io.PrintStream out)