CMCommon, CMObject, ItemCollection, java.lang.Cloneable, java.lang.Comparable<CMObject>public class DefaultItemCollection extends java.lang.Object implements ItemCollection, CMCommon
idConverter| Constructor | Description |
|---|---|
DefaultItemCollection() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addItem(Item item) |
Adds a new item to its possessor.
|
int |
compareTo(CMObject o) |
|
CMObject |
copyOf() |
Similar to Cloneable.clone(), but does its best to make sure that
any internal objects to this class are also copyOfed.
|
void |
delAllItems(boolean destroy) |
Removes all items from this collection
|
void |
delItem(Item item) |
Removes the item from this possessor.
|
void |
eachItem(EachApplicable<Item> applier) |
Applies the given code to each item in this collection
|
Item |
findItem(Item goodLocation,
java.lang.String itemID) |
Returns the item in the given container that matches the
given itemID, whether by full name, description, class ID,
or partial name (if no fuller name is found).
|
Item |
findItem(java.lang.String itemID) |
Returns the item in this possessor that matches the
given itemID, whether by full name, description, class ID,
or partial name (if no fuller name is found).
|
java.util.List<Item> |
findItems(Item goodLocation,
java.lang.String itemID) |
Returns all items in the given container that matches the
given itemID, whether by full name, description, class ID,
or partial name (if no fuller names are found).
|
java.util.List<Item> |
findItems(java.lang.String itemID) |
Returns all items in this possessor that matches the
given itemID, whether by full name, description, class ID,
or partial name (if no fuller names are found).
|
Item |
getItem(int i) |
Returns the item at the given index, regardless of container status,
visibility, or other modifiers.
|
Item |
getRandomItem() |
Returns a random item in this collection, or null
|
java.lang.String |
ID() |
The CoffeeMud Java Class ID shared by all instances of
this object.
|
void |
initializeClass() |
Called ONCE after all objects are loaded, but before the map is read in
during initialization.
|
boolean |
isContent(Item item) |
Returns whether the given item is in this possessors list.
|
java.util.Enumeration<Item> |
items() |
An enumeration of all the items at this possessor.
|
java.lang.String |
name() |
The displayable name of this object.
|
CMObject |
newInstance() |
Returns a new instance of this class.
|
int |
numItems() |
Returns the total number of items at this possessor, regardless
of container status.
|
public java.lang.String ID()
CMObjectpublic java.lang.String name()
CMObjectname in interface CMObjectEnvironmental.Name()public CMObject copyOf()
CMObjectpublic void initializeClass()
CMObjectinitializeClass in interface CMObjectpublic CMObject newInstance()
CMObjectnewInstance in interface CMObjectpublic int compareTo(CMObject o)
compareTo in interface java.lang.Comparable<CMObject>public Item findItem(java.lang.String itemID)
ItemCollectionfindItem in interface ItemCollectionitemID - the name or partial name of the item to fetchpublic java.util.Enumeration<Item> items()
ItemCollectionitems in interface ItemCollectionpublic Item findItem(Item goodLocation, java.lang.String itemID)
ItemCollectionfindItem in interface ItemCollectiongoodLocation - the container to look in, or null for noneitemID - the name or partial name of the item to fetchpublic java.util.List<Item> findItems(Item goodLocation, java.lang.String itemID)
ItemCollectionfindItems in interface ItemCollectiongoodLocation - the container to look in, or null for noneitemID - the name or partial name of the item to fetchpublic java.util.List<Item> findItems(java.lang.String itemID)
ItemCollectionfindItems in interface ItemCollectionitemID - the name or partial name of the item to fetchpublic void addItem(Item item)
ItemCollectionaddItem in interface ItemCollectionitem - the item to addItemCollection.delItem(Item)public void delItem(Item item)
ItemCollectiondelItem in interface ItemCollectionitem - the item to removepublic int numItems()
ItemCollectionnumItems in interface ItemCollectionpublic boolean isContent(Item item)
ItemCollectionisContent in interface ItemCollectionitem - the item to checkpublic void delAllItems(boolean destroy)
ItemCollectiondelAllItems in interface ItemCollectiondestroy - true to also destroy the itemspublic void eachItem(EachApplicable<Item> applier)
ItemCollectioneachItem in interface ItemCollectionapplier - code to execute against each objectpublic Item getItem(int i)
ItemCollectiongetItem in interface ItemCollectioni - the index of the itempublic Item getRandomItem()
ItemCollectiongetRandomItem in interface ItemCollection