|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.planet_ink.coffee_mud.Common.WeakItemCollection
public class WeakItemCollection
Abstract collection of item objects, complete with some finders and various accessors. Also, the copyOf method does a deep copy. Also, this is a weak item collection, so as items get destroyed, they disappear from here.
Constructor Summary | |
---|---|
WeakItemCollection()
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WeakItemCollection()
Method Detail |
---|
public java.lang.String ID()
CMObject
ID
in interface CMObject
public java.lang.String name()
CMObject
name
in interface CMObject
Environmental.Name()
public CMObject copyOf()
CMObject
copyOf
in interface CMObject
public void initializeClass()
CMObject
initializeClass
in interface CMObject
public CMObject newInstance()
CMObject
newInstance
in interface CMObject
public int compareTo(CMObject o)
compareTo
in interface java.lang.Comparable<CMObject>
public Item findItem(java.lang.String itemID)
ItemCollection
findItem
in interface ItemCollection
itemID
- the name or partial name of the item to fetch
public java.util.Enumeration<Item> items()
ItemCollection
items
in interface ItemCollection
public Item findItem(Item goodLocation, java.lang.String itemID)
ItemCollection
findItem
in interface ItemCollection
goodLocation
- the container to look in, or null for noneitemID
- the name or partial name of the item to fetch
public java.util.List<Item> findItems(Item goodLocation, java.lang.String itemID)
ItemCollection
findItems
in interface ItemCollection
goodLocation
- the container to look in, or null for noneitemID
- the name or partial name of the item to fetch
public java.util.List<Item> findItems(java.lang.String itemID)
ItemCollection
findItems
in interface ItemCollection
itemID
- the name or partial name of the item to fetch
public void addItem(Item item)
ItemCollection
addItem
in interface ItemCollection
item
- the item to addItemCollection.delItem(Item)
public void delItem(Item item)
ItemCollection
delItem
in interface ItemCollection
item
- the item to removepublic void delAllItems(boolean destroy)
ItemCollection
delAllItems
in interface ItemCollection
destroy
- true to also destroy the itemspublic int numItems()
ItemCollection
numItems
in interface ItemCollection
public boolean isContent(Item item)
ItemCollection
isContent
in interface ItemCollection
item
- the item to check
public Item getItem(int i)
ItemCollection
getItem
in interface ItemCollection
i
- the index of the item
public void eachItem(EachApplicable<Item> applier)
ItemCollection
eachItem
in interface ItemCollection
applier
- code to execute against each objectpublic Item getRandomItem()
ItemCollection
getRandomItem
in interface ItemCollection
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |