CMCommon
, CoffeeShop
, CMObject
, java.lang.Cloneable
, java.lang.Comparable<CMObject>
public class DefaultCoffeeShop extends java.lang.Object implements CoffeeShop
CoffeeShop.ShelfProduct
Modifier and Type | Field | Description |
---|---|---|
protected java.lang.Integer |
contentHash |
|
SVector<Environmental> |
enumerableInventory |
|
java.util.List<CoffeeShop.ShelfProduct> |
storeInventory |
idConverter
Constructor | Description |
---|---|
DefaultCoffeeShop() |
Modifier and Type | Method | Description |
---|---|---|
Environmental |
addStoreInventory(Environmental thisThang) |
Adds a new item to the store inventory.
|
Environmental |
addStoreInventory(Environmental thisThang,
int number,
int price) |
Adds a new item to the store inventory so the shopkeeper can sell it.
|
CoffeeShop |
build(ShopKeeper SK) |
Initializes this shop object with its host ShopKeeper
|
void |
buildShopFromXML(java.lang.String text) |
Repopulates this shop inventory from a given xml document, restoring store inventory,
base inventory, prices, and availability.
|
void |
cloneFix(DefaultCoffeeShop E) |
|
int |
compareTo(CMObject o) |
|
long |
contentHash() |
Returns a hash of all the items currently in the
shop, for help in determining when things change.
|
CMObject |
copyOf() |
Similar to Cloneable.clone(), but does its best to make sure that
any internal objects to this class are also copyOfed.
|
void |
delAllStoreInventory(Environmental thisThang) |
Removes all items like the given item from the base and store inventory.
|
void |
deleteShelfProduct(CoffeeShop.ShelfProduct P) |
Remove the specific give shelf product from the official stores.
|
void |
destroyStoreInventory() |
Destroys all the items in this shop.
|
boolean |
doIHaveThisInStock(java.lang.String name,
MOB mob) |
Returns whether an item with the given name is presently in this stores
stock inventory, and available for sale.
|
void |
emptyAllShelves() |
Clears both the base and stock/store inventories.
|
int |
enumerableStockSize() |
Returns the number of items in the stores base inventory.
|
java.util.Iterator<Environmental> |
getEnumerableInventory() |
Returns a iterator of all the Environmental objects this shop has in its base
inventory.
|
Environmental |
getStock(java.lang.String name,
MOB mob) |
Searches this shops stock of items for sale for one matching the given name.
|
java.util.Iterator<Environmental> |
getStoreInventory() |
Returns a iterator of all the Environmental objects this shop has for sale.
|
java.util.Iterator<Environmental> |
getStoreInventory(java.lang.String srchStr) |
Returns a iterator of all the Environmental objects this shop has for sale
which match the given search string.
|
java.util.Iterator<CoffeeShop.ShelfProduct> |
getStoreShelves() |
Returns a iterator of all the ShelfProduct objects this shop has for sale.
|
java.lang.String |
ID() |
The CoffeeMud Java Class ID shared by all instances of
this object.
|
boolean |
inEnumerableInventory(Environmental thisThang) |
Returns whether an item sufficiently like the given item originally
existed in this shops inventory when it was created.
|
void |
initializeClass() |
Called ONCE after all objects are loaded, but before the map is read in
during initialization.
|
boolean |
isSold(int code) |
Returns whether the whatIsSold code applies to the shopkeeper hosting this shop.
|
boolean |
lowerStock(java.lang.String name) |
Searches this shops stock of items for sale for one matching the given name.
|
java.lang.String |
makeXML() |
Generates an XML document of all available shop inventory, prices, and availability.
|
java.lang.String |
name() |
The displayable name of this object.
|
CMObject |
newInstance() |
Returns a new instance of this class.
|
int |
numberInStock(Environmental likeThis) |
Returns the number of items like the one given that the shopkeeper presently
has in stock and available for sale.
|
protected Environmental |
preSaleCopyFix(Environmental thisThang) |
|
java.util.List<Environmental> |
removeSellableProduct(java.lang.String named,
MOB mob) |
Searches this shops stock of items for sale for one matching the given name.
|
Environmental |
removeStock(java.lang.String name,
MOB mob) |
Searches this shops stock of items for sale for one matching the given name.
|
void |
resubmitInventory(java.util.List<Environmental> shopItems) |
A method for quickly making wholesale changes to a shopkeepers inventory.
|
protected boolean |
shopCompare(Environmental thang1,
Environmental thang2) |
|
ShopKeeper |
shopKeeper() |
Returns the shopKeeper that is hosting this shop
|
protected Room |
startRoom() |
|
int |
stockPrice(Environmental likeThis) |
Returns the base stock price (not the final price by any means) that the shop
will use as a foundation for determining the given items price.
|
protected void |
stopTicking(Environmental E) |
|
int |
totalStockSize() |
Returns the number of items this shop currently has for sale.
|
int |
totalStockSizeIncludingDuplicates() |
The number of items in the store inventory, taking number in stock into account.
|
int |
totalStockWeight() |
Total weight, in pounds, of all items in the store inventory, taking number in
stock into account.
|
CoffeeShop |
weakCopyOf() |
Returns a thin copy with independent lists, but the
same items as the original host.
|
public SVector<Environmental> enumerableInventory
public java.util.List<CoffeeShop.ShelfProduct> storeInventory
protected volatile java.lang.Integer contentHash
public java.lang.String ID()
CMObject
public java.lang.String name()
CMObject
name
in interface CMObject
Environmental.Name()
public int compareTo(CMObject o)
compareTo
in interface java.lang.Comparable<CMObject>
public CMObject copyOf()
CMObject
public CoffeeShop weakCopyOf()
CoffeeShop
weakCopyOf
in interface CoffeeShop
public CoffeeShop build(ShopKeeper SK)
CoffeeShop
build
in interface CoffeeShop
SK
- the shopkeeper that hosts this objectpublic ShopKeeper shopKeeper()
CoffeeShop
shopKeeper
in interface CoffeeShop
public boolean isSold(int code)
CoffeeShop
isSold
in interface CoffeeShop
code
- the whatIsSold codeShopKeeper.DEAL_DESCS
protected Room startRoom()
public CMObject newInstance()
CMObject
newInstance
in interface CMObject
public void initializeClass()
CMObject
initializeClass
in interface CMObject
public void cloneFix(DefaultCoffeeShop E)
protected void stopTicking(Environmental E)
public void destroyStoreInventory()
CoffeeShop
destroyStoreInventory
in interface CoffeeShop
public void deleteShelfProduct(CoffeeShop.ShelfProduct P)
CoffeeShop
deleteShelfProduct
in interface CoffeeShop
P
- the shelf product to remove permanentlyprotected boolean shopCompare(Environmental thang1, Environmental thang2)
public boolean inEnumerableInventory(Environmental thisThang)
CoffeeShop
inEnumerableInventory
in interface CoffeeShop
thisThang
- the thing to compare against the base inventoryShopKeeper.isSold(int)
,
ShopKeeper.DEAL_INVENTORYONLY
public Environmental addStoreInventory(Environmental thisThang)
CoffeeShop
addStoreInventory
in interface CoffeeShop
thisThang
- the thing to sellCoffeeShop.addStoreInventory(Environmental, int, int)
public int enumerableStockSize()
CoffeeShop
enumerableStockSize
in interface CoffeeShop
ShopKeeper.isSold(int)
,
ShopKeeper.DEAL_INVENTORYONLY
public int totalStockSize()
CoffeeShop
totalStockSize
in interface CoffeeShop
CoffeeShop.totalStockSizeIncludingDuplicates()
public java.util.Iterator<Environmental> getStoreInventory()
CoffeeShop
getStoreInventory
in interface CoffeeShop
public java.util.Iterator<CoffeeShop.ShelfProduct> getStoreShelves()
CoffeeShop
getStoreShelves
in interface CoffeeShop
public java.util.Iterator<Environmental> getStoreInventory(java.lang.String srchStr)
CoffeeShop
getStoreInventory
in interface CoffeeShop
srchStr
- the item to hunt for.public java.util.Iterator<Environmental> getEnumerableInventory()
CoffeeShop
getEnumerableInventory
in interface CoffeeShop
ShopKeeper.isSold(int)
,
ShopKeeper.DEAL_INVENTORYONLY
protected Environmental preSaleCopyFix(Environmental thisThang)
public Environmental addStoreInventory(Environmental thisThang, int number, int price)
CoffeeShop
addStoreInventory
in interface CoffeeShop
thisThang
- the item/mob/ability to sellnumber
- the number of items to sellprice
- the price of the item (in base currency) or -1 to have it determinedpublic int totalStockWeight()
CoffeeShop
totalStockWeight
in interface CoffeeShop
public int totalStockSizeIncludingDuplicates()
CoffeeShop
totalStockSizeIncludingDuplicates
in interface CoffeeShop
CoffeeShop.totalStockSize()
public void delAllStoreInventory(Environmental thisThang)
CoffeeShop
delAllStoreInventory
in interface CoffeeShop
thisThang
- the item like which to removeShopKeeper.isSold(int)
public boolean doIHaveThisInStock(java.lang.String name, MOB mob)
CoffeeShop
doIHaveThisInStock
in interface CoffeeShop
name
- the name of the item to search formob
- the mob who is interested (stock can differ depending on customer)ShopKeeper.isSold(int)
public int stockPrice(Environmental likeThis)
CoffeeShop
stockPrice
in interface CoffeeShop
likeThis
- the item like which to compareCoffeeShop.getStoreInventory()
public int numberInStock(Environmental likeThis)
CoffeeShop
numberInStock
in interface CoffeeShop
likeThis
- the item like which to compareCoffeeShop.getStoreInventory()
public Environmental getStock(java.lang.String name, MOB mob)
CoffeeShop
getStock
in interface CoffeeShop
name
- the name of the item to search formob
- the mob who is interested (stock can differ depending on customer)CoffeeShop.getStoreInventory()
public Environmental removeStock(java.lang.String name, MOB mob)
CoffeeShop
removeStock
in interface CoffeeShop
name
- the name of the item to search formob
- the mob who is interested (stock can differ depending on customer)CoffeeShop.getStoreInventory()
public boolean lowerStock(java.lang.String name)
CoffeeShop
lowerStock
in interface CoffeeShop
name
- the name of the item to lower the stock ofpublic void resubmitInventory(java.util.List<Environmental> shopItems)
CoffeeShop
resubmitInventory
in interface CoffeeShop
shopItems
- the items for inventorypublic void emptyAllShelves()
CoffeeShop
emptyAllShelves
in interface CoffeeShop
public java.util.List<Environmental> removeSellableProduct(java.lang.String named, MOB mob)
CoffeeShop
removeSellableProduct
in interface CoffeeShop
named
- the name of the item to search formob
- the mob who is interested (stock can differ depending on customer)CoffeeShop.getStoreInventory()
public java.lang.String makeXML()
CoffeeShop
makeXML
in interface CoffeeShop
CoffeeShop.getStoreInventory()
,
CoffeeShop.buildShopFromXML(String)
public void buildShopFromXML(java.lang.String text)
CoffeeShop
buildShopFromXML
in interface CoffeeShop
text
- the xml document to restore fromCoffeeShop.makeXML()
public long contentHash()
CoffeeShop
contentHash
in interface CoffeeShop