kotcity4 / kotcity.data / HasInventory

HasInventory

interface HasInventory

Represents something in (or external) to the city that can have Tradeables in its possession.

Functions

addInventory

abstract fun addInventory(tradeable: Tradeable, quantity: Int): Int

balance

abstract fun balance(): Int

How much Tradeable.MONEY that the given thing has.

quantityOnHand

abstract fun quantityOnHand(tradeable: Tradeable): Int

setInventory

abstract fun setInventory(tradeable: Tradeable, quantity: Int): Int

subtractInventory

abstract fun subtractInventory(tradeable: Tradeable, quantity: Int): Int

summarizeInventory

abstract fun summarizeInventory(): String

transferInventory

abstract fun transferInventory(to: TradeEntity, tradeable: Tradeable, quantity: Int): Int

Inheritors

HasConcreteInventory

interface HasConcreteInventory : HasInventory

This is used for something in the CityMap that has REAL trackable inventory. The reason we have "HasConcreteInventory" and not is because the outside NationalTradeEntity does not REALLY have anything. It just pretends to.

NationalTradeEntity

data class NationalTradeEntity : HasContracts, HasInventory

OutsideTradeEntity

data class OutsideTradeEntity : TradeEntity, HasContracts, HasInventory