public class DefaultFollowTheSunModel<ContainerType,ItemType> extends java.lang.Object implements FollowTheSunModel<ContainerType,ItemType>
| Constructor and Description |
|---|
DefaultFollowTheSunModel(java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
dumpItemDistribution() |
void |
dumpItemDistribution(java.io.PrintStream out) |
java.util.Set<ContainerType> |
getAvailableContainersFor(ItemType item,
Location location) |
Location |
getContainerLocation(ContainerType container) |
java.util.Map<ItemType,java.util.Map<Location,java.lang.Double>> |
getDirectSendsToItemByLocation() |
ContainerType |
getItemContainer(ItemType item) |
Location |
getItemLocation(ItemType item) |
java.util.Set<ItemType> |
getItems() |
java.lang.String |
getName() |
java.lang.String |
getName(ItemType item) |
boolean |
hasActiveMigration(ItemType item) |
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.
|
static <K,V> java.util.Map<K,V> |
newHashMap(K k,
V v) |
void |
onContainerAdded(ContainerType container,
Location location) |
void |
onContainerLocationUpdated(ContainerType container,
Location location) |
void |
onContainerRemoved(ContainerType container) |
void |
onItemAdded(ItemType item,
ContainerType container,
boolean immovable) |
void |
onItemMoved(ItemType item,
ContainerType newContainer) |
void |
onItemRemoved(ItemType item) |
void |
onItemUsageUpdated(ItemType item,
java.util.Map<? extends ItemType,java.lang.Double> newValue) |
static double |
sum(java.util.Collection<? extends java.lang.Number> values) |
public java.util.Set<ItemType> getItems()
getItems in interface FollowTheSunModel<ContainerType,ItemType>public ContainerType getItemContainer(ItemType item)
getItemContainer in interface FollowTheSunModel<ContainerType,ItemType>public Location getItemLocation(ItemType item)
getItemLocation in interface FollowTheSunModel<ContainerType,ItemType>public Location getContainerLocation(ContainerType container)
getContainerLocation in interface FollowTheSunModel<ContainerType,ItemType>public java.lang.String getName()
getName in interface FollowTheSunModel<ContainerType,ItemType>public java.lang.String getName(ItemType item)
getName in interface FollowTheSunModel<ContainerType,ItemType>public boolean isItemMoveable(ItemType item)
isItemMoveable in interface FollowTheSunModel<ContainerType,ItemType>public boolean isItemAllowedIn(ItemType item, Location location)
isItemAllowedIn in interface FollowTheSunModel<ContainerType,ItemType>public boolean hasActiveMigration(ItemType item)
hasActiveMigration in interface FollowTheSunModel<ContainerType,ItemType>public java.util.Map<ItemType,java.util.Map<Location,java.lang.Double>> getDirectSendsToItemByLocation()
getDirectSendsToItemByLocation in interface FollowTheSunModel<ContainerType,ItemType>public java.util.Set<ContainerType> getAvailableContainersFor(ItemType item, Location location)
getAvailableContainersFor in interface FollowTheSunModel<ContainerType,ItemType>public void onItemMoved(ItemType item, ContainerType newContainer)
onItemMoved in interface FollowTheSunModel<ContainerType,ItemType>public void onContainerAdded(ContainerType container, Location location)
onContainerAdded in interface FollowTheSunModel<ContainerType,ItemType>public void onContainerRemoved(ContainerType container)
onContainerRemoved in interface FollowTheSunModel<ContainerType,ItemType>public void onContainerLocationUpdated(ContainerType container, Location location)
onContainerLocationUpdated in interface FollowTheSunModel<ContainerType,ItemType>public void onItemAdded(ItemType item, ContainerType container, boolean immovable)
onItemAdded in interface FollowTheSunModel<ContainerType,ItemType>public void onItemRemoved(ItemType item)
onItemRemoved in interface FollowTheSunModel<ContainerType,ItemType>public void onItemUsageUpdated(ItemType item, java.util.Map<? extends ItemType,java.lang.Double> newValue)
onItemUsageUpdated in interface FollowTheSunModel<ContainerType,ItemType>public java.lang.String itemDistributionToString()
public void dumpItemDistribution()
public void dumpItemDistribution(java.io.PrintStream out)
public static <K,V> java.util.Map<K,V> newHashMap(K k,
V v)
public static double sum(java.util.Collection<? extends java.lang.Number> values)