com.planet_ink.coffee_mud.Common
Class AuctionCoffeeShop

java.lang.Object
  extended by com.planet_ink.coffee_mud.Common.AuctionCoffeeShop
All Implemented Interfaces:
CMCommon, CoffeeShop, CMObject, java.lang.Cloneable, java.lang.Comparable<CMObject>

public class AuctionCoffeeShop
extends java.lang.Object
implements CoffeeShop


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.Common.interfaces.CoffeeShop
CoffeeShop.ShelfProduct
 
Field Summary
 java.lang.String auctionShop
           
static java.util.Vector<Environmental> emptyV
           
static java.util.Vector<CoffeeShop.ShelfProduct> emptyV2
           
protected  java.lang.ref.WeakReference<ShopKeeper> shopKeeper
           
 
Constructor Summary
AuctionCoffeeShop()
           
 
Method Summary
 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.
 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.
 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> V)
          A method for quickly making wholesale changes to a shopkeepers inventory.
 ShopKeeper shopKeeper()
          Returns the shopKeeper that is hosting this shop
 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.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

emptyV

public static final java.util.Vector<Environmental> emptyV

emptyV2

public static final java.util.Vector<CoffeeShop.ShelfProduct> emptyV2

auctionShop

public java.lang.String auctionShop

shopKeeper

protected java.lang.ref.WeakReference<ShopKeeper> shopKeeper
Constructor Detail

AuctionCoffeeShop

public AuctionCoffeeShop()
Method Detail

ID

public java.lang.String ID()
Description copied from interface: CMObject
The CoffeeMud Java Class ID shared by all instances of this object. Unlike the Java Class name, this method does not include package information. However, it must return a String value unique to its class category in the ClassLoader. Class categories include Libraries, Common, Areas, Abilities, Behaviors, CharClasses, Commands, Exits Locales, MOBS, Races, WebMacros, Basic Items, Armor, Weapons, ClanItems, Tech. The name is typically identical to the class name.

Specified by:
ID in interface CMObject
Returns:
the name of this class

name

public java.lang.String name()
Description copied from interface: CMObject
The displayable name of this object. May be modified by phyStats() object. Is derived from the Name().

Specified by:
name in interface CMObject
Returns:
the modified final name of this object on the map.
See Also:
Environmental.Name()

compareTo

public int compareTo(CMObject o)
Specified by:
compareTo in interface java.lang.Comparable<CMObject>

copyOf

public CMObject copyOf()
Description copied from interface: CMObject
Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed.

Specified by:
copyOf in interface CMObject
Returns:
a clone of this object

newInstance

public CMObject newInstance()
Description copied from interface: CMObject
Returns a new instance of this class.

Specified by:
newInstance in interface CMObject
Returns:
a new instance of this class

initializeClass

public void initializeClass()
Description copied from interface: CMObject
Called ONCE after all objects are loaded, but before the map is read in during initialization.

Specified by:
initializeClass in interface CMObject

build

public CoffeeShop build(ShopKeeper SK)
Description copied from interface: CoffeeShop
Initializes this shop object with its host ShopKeeper

Specified by:
build in interface CoffeeShop
Parameters:
SK - the shopkeeper that hosts this object
Returns:
always this

shopKeeper

public ShopKeeper shopKeeper()
Description copied from interface: CoffeeShop
Returns the shopKeeper that is hosting this shop

Specified by:
shopKeeper in interface CoffeeShop
Returns:
the shopKeeper that is hosting this shop

isSold

public boolean isSold(int code)
Description copied from interface: CoffeeShop
Returns whether the whatIsSold code applies to the shopkeeper hosting this shop.

Specified by:
isSold in interface CoffeeShop
Parameters:
code - the whatIsSold code
Returns:
whether the whatIsSold code applies to the shopkeeper hosting this shop.
See Also:
ShopKeeper.DEAL_DESCS

inEnumerableInventory

public boolean inEnumerableInventory(Environmental thisThang)
Description copied from interface: CoffeeShop
Returns whether an item sufficiently like the given item originally existed in this shops inventory when it was created. Applies only to shops where their whatIsSold method returns ONLY_INVENTORY

Specified by:
inEnumerableInventory in interface CoffeeShop
Parameters:
thisThang - the thing to compare against the base inventory
Returns:
whether the item, or one just like it, is in the base inventory
See Also:
ShopKeeper.isSold(int), ShopKeeper.DEAL_INVENTORYONLY

addStoreInventory

public Environmental addStoreInventory(Environmental thisThang)
Description copied from interface: CoffeeShop
Adds a new item to the store inventory. Use this method when an item is sold to the store, as pricing and other information will have to be derived.

Specified by:
addStoreInventory in interface CoffeeShop
Parameters:
thisThang - the thing to sell
Returns:
the core store inventory item added
See Also:
CoffeeShop.addStoreInventory(Environmental, int, int)

enumerableStockSize

public int enumerableStockSize()
Description copied from interface: CoffeeShop
Returns the number of items in the stores base inventory. Only really useful for historical reasons, or if the shop sells inventory only.

Specified by:
enumerableStockSize in interface CoffeeShop
Returns:
the number of items in the base inventory
See Also:
ShopKeeper.isSold(int), ShopKeeper.DEAL_INVENTORYONLY

totalStockSize

public int totalStockSize()
Description copied from interface: CoffeeShop
Returns the number of items this shop currently has for sale. Does not take number of duplicates into account. For that call totalStockSizeIncludingDuplicates

Specified by:
totalStockSize in interface CoffeeShop
Returns:
the number of items for sale.
See Also:
CoffeeShop.totalStockSizeIncludingDuplicates()

getStoreInventory

public java.util.Iterator<Environmental> getStoreInventory()
Description copied from interface: CoffeeShop
Returns a iterator of all the Environmental objects this shop has for sale. Will only return one of each item, even if multiple are available.

Specified by:
getStoreInventory in interface CoffeeShop
Returns:
a iterator of objects for sale.

getStoreShelves

public java.util.Iterator<CoffeeShop.ShelfProduct> getStoreShelves()
Description copied from interface: CoffeeShop
Returns a iterator of all the ShelfProduct objects this shop has for sale.

Specified by:
getStoreShelves in interface CoffeeShop
Returns:
a iterator of all the shelves at the shop.

lowerStock

public boolean lowerStock(java.lang.String name)
Description copied from interface: CoffeeShop
Searches this shops stock of items for sale for one matching the given name. If one is found, then one unit is removed from one of the available stock and true is returned.

Specified by:
lowerStock in interface CoffeeShop
Parameters:
name - the name of the item to lower the stock of
Returns:
true if it was lowered

weakCopyOf

public CoffeeShop weakCopyOf()
Description copied from interface: CoffeeShop
Returns a thin copy with independent lists, but the same items as the original host.

Specified by:
weakCopyOf in interface CoffeeShop
Returns:
the thin copy

getStoreInventory

public java.util.Iterator<Environmental> getStoreInventory(java.lang.String srchStr)
Description copied from interface: CoffeeShop
Returns a iterator of all the Environmental objects this shop has for sale which match the given search string. Will only return one of each item, even if multiple are available.

Specified by:
getStoreInventory in interface CoffeeShop
Parameters:
srchStr - the item to hunt for.
Returns:
a iterator of objects for sale.

getEnumerableInventory

public java.util.Iterator<Environmental> getEnumerableInventory()
Description copied from interface: CoffeeShop
Returns a iterator of all the Environmental objects this shop has in its base inventory. Only useful for historical reasons, or if the shop sells inventory only.

Specified by:
getEnumerableInventory in interface CoffeeShop
Returns:
a iterator of objects in base inventory
See Also:
ShopKeeper.isSold(int), ShopKeeper.DEAL_INVENTORYONLY

addStoreInventory

public Environmental addStoreInventory(Environmental thisThang,
                                       int number,
                                       int price)
Description copied from interface: CoffeeShop
Adds a new item to the store inventory so the shopkeeper can sell it. All items added go cumulatively into the store inventory, and one copy is kept in the base inventory for historical reasons. The method is called when multiple items need to be added, or if the price is available. This method is usually used to build an original shop inventory.

Specified by:
addStoreInventory in interface CoffeeShop
Parameters:
thisThang - the item/mob/ability to sell
number - the number of items to sell
price - the price of the item (in base currency) or -1 to have it determined
Returns:
the actual object stored in the inventory

totalStockWeight

public int totalStockWeight()
Description copied from interface: CoffeeShop
Total weight, in pounds, of all items in the store inventory, taking number in stock into account.

Specified by:
totalStockWeight in interface CoffeeShop
Returns:
the total weight in pounds

totalStockSizeIncludingDuplicates

public int totalStockSizeIncludingDuplicates()
Description copied from interface: CoffeeShop
The number of items in the store inventory, taking number in stock into account. Call this method to see how crowded the shop really is, as opposed to totalStockSize.

Specified by:
totalStockSizeIncludingDuplicates in interface CoffeeShop
Returns:
the total number of all items in stock
See Also:
CoffeeShop.totalStockSize()

delAllStoreInventory

public void delAllStoreInventory(Environmental thisThang)
Description copied from interface: CoffeeShop
Removes all items like the given item from the base and store inventory.

Specified by:
delAllStoreInventory in interface CoffeeShop
Parameters:
thisThang - the item like which to remove
See Also:
ShopKeeper.isSold(int)

doIHaveThisInStock

public boolean doIHaveThisInStock(java.lang.String name,
                                  MOB mob)
Description copied from interface: CoffeeShop
Returns whether an item with the given name is presently in this stores stock inventory, and available for sale.

Specified by:
doIHaveThisInStock in interface CoffeeShop
Parameters:
name - the name of the item to search for
mob - the mob who is interested (stock can differ depending on customer)
Returns:
whether the item is available
See Also:
ShopKeeper.isSold(int)

stockPrice

public int stockPrice(Environmental likeThis)
Description copied from interface: CoffeeShop
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. -1 would mean that the shopkeeper uses the valuation of the item as a basis, whereas another value is in base gold. Best to get likeThis item from the getStoreInventory()

Specified by:
stockPrice in interface CoffeeShop
Parameters:
likeThis - the item like which to compare
Returns:
the stock price of the item given.
See Also:
CoffeeShop.getStoreInventory()

numberInStock

public int numberInStock(Environmental likeThis)
Description copied from interface: CoffeeShop
Returns the number of items like the one given that the shopkeeper presently has in stock and available for sale.

Specified by:
numberInStock in interface CoffeeShop
Parameters:
likeThis - the item like which to compare
Returns:
the number currently in stock.
See Also:
CoffeeShop.getStoreInventory()

resubmitInventory

public void resubmitInventory(java.util.List<Environmental> V)
Description copied from interface: CoffeeShop
A method for quickly making wholesale changes to a shopkeepers inventory. getStoreInventory should be called to get the list of items. The items can then be modified, and this method called to properly "resubmit" them to the shopkeeper.

Specified by:
resubmitInventory in interface CoffeeShop
Parameters:
V - the items for inventory

getStock

public Environmental getStock(java.lang.String name,
                              MOB mob)
Description copied from interface: CoffeeShop
Searches this shops stock of items for sale for one matching the given name.

Specified by:
getStock in interface CoffeeShop
Parameters:
name - the name of the item to search for
mob - the mob who is interested (stock can differ depending on customer)
Returns:
the available item, if found
See Also:
CoffeeShop.getStoreInventory()

destroyStoreInventory

public void destroyStoreInventory()
Description copied from interface: CoffeeShop
Destroys all the items in this shop.

Specified by:
destroyStoreInventory in interface CoffeeShop

removeStock

public Environmental removeStock(java.lang.String name,
                                 MOB mob)
Description copied from interface: CoffeeShop
Searches this shops stock of items for sale for one matching the given name. If one is found, it copies the item, removes one from the available stock, and returns the copy.

Specified by:
removeStock in interface CoffeeShop
Parameters:
name - the name of the item to search for
mob - the mob who is interested (stock can differ depending on customer)
Returns:
the available item, if found
See Also:
CoffeeShop.getStoreInventory()

emptyAllShelves

public void emptyAllShelves()
Description copied from interface: CoffeeShop
Clears both the base and stock/store inventories.

Specified by:
emptyAllShelves in interface CoffeeShop

removeSellableProduct

public java.util.List<Environmental> removeSellableProduct(java.lang.String named,
                                                           MOB mob)
Description copied from interface: CoffeeShop
Searches this shops stock of items for sale for one matching the given name. If one is found, it copies the item, removes one from the available stock, and prepares it for sale by adding it to a list along with any necessary accessories, such as necessary keys, or if a container, any contents of the container.

Specified by:
removeSellableProduct in interface CoffeeShop
Parameters:
named - the name of the item to search for
mob - the mob who is interested (stock can differ depending on customer)
Returns:
the available items, if found, as a list of Environmental objects
See Also:
CoffeeShop.getStoreInventory()

makeXML

public java.lang.String makeXML()
Description copied from interface: CoffeeShop
Generates an XML document of all available shop inventory, prices, and availability.

Specified by:
makeXML in interface CoffeeShop
Returns:
an XML document.
See Also:
CoffeeShop.getStoreInventory(), CoffeeShop.buildShopFromXML(String)

buildShopFromXML

public void buildShopFromXML(java.lang.String text)
Description copied from interface: CoffeeShop
Repopulates this shop inventory from a given xml document, restoring store inventory, base inventory, prices, and availability.

Specified by:
buildShopFromXML in interface CoffeeShop
Parameters:
text - the xml document to restore from
See Also:
CoffeeShop.makeXML()

contentHash

public long contentHash()
Description copied from interface: CoffeeShop
Returns a hash of all the items currently in the shop, for help in determining when things change.

Specified by:
contentHash in interface CoffeeShop
Returns:
the hash of the contents.

deleteShelfProduct

public void deleteShelfProduct(CoffeeShop.ShelfProduct P)
Description copied from interface: CoffeeShop
Remove the specific give shelf product from the official stores.

Specified by:
deleteShelfProduct in interface CoffeeShop
Parameters:
P - the shelf product to remove permanently