com.planet_ink.coffee_mud.Libraries
Class CMCatalog.CataDataImpl

java.lang.Object
  extended by com.planet_ink.coffee_mud.Libraries.CMCatalog.CataDataImpl
All Implemented Interfaces:
CatalogLibrary.CataData
Enclosing class:
CMCatalog

protected static class CMCatalog.CataDataImpl
extends java.lang.Object
implements CatalogLibrary.CataData


Field Summary
 java.lang.String category
           
 int deathPickup
           
 boolean live
           
 java.lang.String lmaskStr
           
 MaskingLibrary.CompiledZMask lmaskV
           
 boolean noRefs
           
 double rate
           
 SVector<java.lang.ref.WeakReference<Physical>> refs
           
 
Constructor Summary
  CMCatalog.CataDataImpl(java.lang.String catadata)
           
protected CMCatalog.CataDataImpl(java.lang.String _lmask, double _rate, boolean _live)
           
protected CMCatalog.CataDataImpl(java.lang.String _lmask, java.lang.String _rate, boolean _live)
           
 
Method Summary
 void addReference(Physical P)
          Adds the given object as a world instance of this cataloged object
 void build(java.lang.String catadata)
          Builds this metadata from an xml doc
 void bumpDeathPickup()
          Bumps the number of times this mob has died, if the cataloged object is a mob, or the number of times this item has been picked up, if it's an item.
 java.lang.String category()
          Returns the user-defined catagory to which this cataloged object belongs.
 void cleanHouse()
          Goes through all the world instances of this cataloged item and removes any that are destroyed.
 java.lang.String data(java.lang.String name)
          Returns this metadata as an xml doc
 void delReference(Physical P)
          Removes the given item from the list of registered world instances of this cataloged object.
 java.util.Enumeration<Physical> enumeration()
          Creates and returns an enumeration of all the instances of this cataloged item in the world.
 int getDeathsPicksups()
          Returns the number of times this mob has died, if the cataloged object is a mob, or the number of times this item has been picked up, if it's an item.
 Physical getLiveReference()
          Returns the first world instance of this cataloged item or mob.
protected  RoomnumberSet getLocations()
           
 java.lang.String getMaskStr()
          A zapper mask string that is applied to mobs to determine if this particular item is potentially a random drop.
 MaskingLibrary.CompiledZMask getMaskV()
          A compiled zapper mask that is applied to mobs to determine if this particular item is potentially a random drop.
 double getRate()
          If this item is a random drop, then this is the pct chance that this item is a potential selection for a random drop.
 boolean getWhenLive()
          If this item is a random drop, this flag will return true if it is random equipment for a live mob, and false if it is random drop for a corpse.
 boolean isReference(Physical P)
          Returns whether the given item is a registered world instance of this cataloged object.
 java.lang.String mostPopularArea()
          Determines and returns the name of the most popular area in which instances of this catalog object can be found.
 int numReferences()
          Returns the number of world items that are instances of this cataloged object.
 java.lang.String randomRoom()
          Returns one of the rooms in which an instance of this cataloged item was registered.
 void setCategory(java.lang.String cat)
          Sets the user-defined catagory to which this cataloged object belongs.
 void setMaskStr(java.lang.String s)
          A zapper mask string that is applied to mobs to determine if this particular item is potentially a random drop.
 void setRate(double r)
          If this item is a random drop, then this is the pct chance that this item is a potential selection for a random drop.
 void setWhenLive(boolean l)
          If this item is a random drop, this flag will be true if it is random equipment for a live mob, and false if it is random drop for a corpse.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lmaskStr

public java.lang.String lmaskStr

category

public java.lang.String category

live

public boolean live

rate

public double rate

deathPickup

public volatile int deathPickup

refs

public SVector<java.lang.ref.WeakReference<Physical>> refs

noRefs

public boolean noRefs

lmaskV

public MaskingLibrary.CompiledZMask lmaskV
Constructor Detail

CMCatalog.CataDataImpl

public CMCatalog.CataDataImpl(java.lang.String catadata)

CMCatalog.CataDataImpl

protected CMCatalog.CataDataImpl(java.lang.String _lmask,
                                 java.lang.String _rate,
                                 boolean _live)

CMCatalog.CataDataImpl

protected CMCatalog.CataDataImpl(java.lang.String _lmask,
                                 double _rate,
                                 boolean _live)
Method Detail

category

public java.lang.String category()
Description copied from interface: CatalogLibrary.CataData
Returns the user-defined catagory to which this cataloged object belongs. null is uncatagorized

Specified by:
category in interface CatalogLibrary.CataData
Returns:
the catagory name
See Also:
CatalogLibrary.CataData.setCategory(String)

setCategory

public void setCategory(java.lang.String cat)
Description copied from interface: CatalogLibrary.CataData
Sets the user-defined catagory to which this cataloged object belongs. null is uncatagorized

Specified by:
setCategory in interface CatalogLibrary.CataData
Parameters:
cat - the catagory name
See Also:
CatalogLibrary.CataData.category()

getLocations

protected RoomnumberSet getLocations()

randomRoom

public java.lang.String randomRoom()
Description copied from interface: CatalogLibrary.CataData
Returns one of the rooms in which an instance of this cataloged item was registered.

Specified by:
randomRoom in interface CatalogLibrary.CataData
Returns:
a room with an instance

mostPopularArea

public java.lang.String mostPopularArea()
Description copied from interface: CatalogLibrary.CataData
Determines and returns the name of the most popular area in which instances of this catalog object can be found.

Specified by:
mostPopularArea in interface CatalogLibrary.CataData
Returns:
the name of the area

numReferences

public int numReferences()
Description copied from interface: CatalogLibrary.CataData
Returns the number of world items that are instances of this cataloged object.

Specified by:
numReferences in interface CatalogLibrary.CataData
Returns:
the number of world items
See Also:
CatalogLibrary.CataData.enumeration(), CatalogLibrary.CataData.addReference(Physical), CatalogLibrary.CataData.isReference(Physical), CatalogLibrary.CataData.delReference(Physical)

enumeration

public java.util.Enumeration<Physical> enumeration()
Description copied from interface: CatalogLibrary.CataData
Creates and returns an enumeration of all the instances of this cataloged item in the world.

Specified by:
enumeration in interface CatalogLibrary.CataData
Returns:
an enumeration of all the instances
See Also:
CatalogLibrary.CataData.addReference(Physical), CatalogLibrary.CataData.isReference(Physical), CatalogLibrary.CataData.delReference(Physical), CatalogLibrary.CataData.numReferences()

getDeathsPicksups

public int getDeathsPicksups()
Description copied from interface: CatalogLibrary.CataData
Returns the number of times this mob has died, if the cataloged object is a mob, or the number of times this item has been picked up, if it's an item.

Specified by:
getDeathsPicksups in interface CatalogLibrary.CataData
Returns:
the number of times
See Also:
CatalogLibrary.CataData.bumpDeathPickup()

bumpDeathPickup

public void bumpDeathPickup()
Description copied from interface: CatalogLibrary.CataData
Bumps the number of times this mob has died, if the cataloged object is a mob, or the number of times this item has been picked up, if it's an item.

Specified by:
bumpDeathPickup in interface CatalogLibrary.CataData
See Also:
CatalogLibrary.CataData.bumpDeathPickup()

cleanHouse

public void cleanHouse()
Description copied from interface: CatalogLibrary.CataData
Goes through all the world instances of this cataloged item and removes any that are destroyed. Hopefully this method never does anything.

Specified by:
cleanHouse in interface CatalogLibrary.CataData

getLiveReference

public Physical getLiveReference()
Description copied from interface: CatalogLibrary.CataData
Returns the first world instance of this cataloged item or mob.

Specified by:
getLiveReference in interface CatalogLibrary.CataData
Returns:
the first world instance

addReference

public void addReference(Physical P)
Description copied from interface: CatalogLibrary.CataData
Adds the given object as a world instance of this cataloged object

Specified by:
addReference in interface CatalogLibrary.CataData
Parameters:
P - the mob or item in the world
See Also:
CatalogLibrary.CataData.enumeration(), CatalogLibrary.CataData.isReference(Physical), CatalogLibrary.CataData.delReference(Physical), CatalogLibrary.CataData.numReferences()

isReference

public boolean isReference(Physical P)
Description copied from interface: CatalogLibrary.CataData
Returns whether the given item is a registered world instance of this cataloged object.

Specified by:
isReference in interface CatalogLibrary.CataData
Parameters:
P - the item or mob in the world
Returns:
true if its registered, false otherwise
See Also:
CatalogLibrary.CataData.enumeration(), CatalogLibrary.CataData.addReference(Physical), CatalogLibrary.CataData.delReference(Physical), CatalogLibrary.CataData.numReferences()

delReference

public void delReference(Physical P)
Description copied from interface: CatalogLibrary.CataData
Removes the given item from the list of registered world instances of this cataloged object.

Specified by:
delReference in interface CatalogLibrary.CataData
Parameters:
P - the item or mob in the world
See Also:
CatalogLibrary.CataData.enumeration(), CatalogLibrary.CataData.addReference(Physical), CatalogLibrary.CataData.isReference(Physical), CatalogLibrary.CataData.numReferences()

getMaskV

public MaskingLibrary.CompiledZMask getMaskV()
Description copied from interface: CatalogLibrary.CataData
A compiled zapper mask that is applied to mobs to determine if this particular item is potentially a random drop. The mask is only applied if it is non-null, so null means it is NOT a random drop.

Specified by:
getMaskV in interface CatalogLibrary.CataData
Returns:
a compiled zapper mask for dead mobs
See Also:
CatalogLibrary.CataData.getMaskStr(), CatalogLibrary.CataData.getWhenLive(), CatalogLibrary.CataData.getRate()

getMaskStr

public java.lang.String getMaskStr()
Description copied from interface: CatalogLibrary.CataData
A zapper mask string that is applied to mobs to determine if this particular item is potentially a random drop. The mask is only applied if it is non-empty, so empty means it is NOT a random drop.

Specified by:
getMaskStr in interface CatalogLibrary.CataData
Returns:
a zapper mask string for dead mobs
See Also:
CatalogLibrary.CataData.getMaskV(), CatalogLibrary.CataData.getRate(), CatalogLibrary.CataData.setMaskStr(String)

getWhenLive

public boolean getWhenLive()
Description copied from interface: CatalogLibrary.CataData
If this item is a random drop, this flag will return true if it is random equipment for a live mob, and false if it is random drop for a corpse.

Specified by:
getWhenLive in interface CatalogLibrary.CataData
Returns:
true for equipment, false for live mob
See Also:
CatalogLibrary.CataData.getMaskV(), CatalogLibrary.CataData.getRate(), CatalogLibrary.CataData.setWhenLive(boolean)

getRate

public double getRate()
Description copied from interface: CatalogLibrary.CataData
If this item is a random drop, then this is the pct chance that this item is a potential selection for a random drop. It is a number from 0.0 - 1, where 0.0 means it is not a random drop at all.

Specified by:
getRate in interface CatalogLibrary.CataData
Returns:
pct chance that the item is a potential selection
See Also:
CatalogLibrary.CataData.getMaskV(), CatalogLibrary.CataData.setRate(double), CatalogLibrary.CataData.getWhenLive()

setMaskStr

public void setMaskStr(java.lang.String s)
Description copied from interface: CatalogLibrary.CataData
A zapper mask string that is applied to mobs to determine if this particular item is potentially a random drop. The mask is only applied if it is non-empty, so empty means it is NOT a random drop.

Specified by:
setMaskStr in interface CatalogLibrary.CataData
Parameters:
s - a zapper mask string for dead mobs
See Also:
CatalogLibrary.CataData.getMaskV(), CatalogLibrary.CataData.getRate(), CatalogLibrary.CataData.getMaskStr()

setWhenLive

public void setWhenLive(boolean l)
Description copied from interface: CatalogLibrary.CataData
If this item is a random drop, this flag will be true if it is random equipment for a live mob, and false if it is random drop for a corpse.

Specified by:
setWhenLive in interface CatalogLibrary.CataData
Parameters:
l - true for equipment, false for live mob
See Also:
CatalogLibrary.CataData.getMaskV(), CatalogLibrary.CataData.getRate(), CatalogLibrary.CataData.getWhenLive()

setRate

public void setRate(double r)
Description copied from interface: CatalogLibrary.CataData
If this item is a random drop, then this is the pct chance that this item is a potential selection for a random drop. It is a number from 0.0 - 1, where 0.0 means it is not a random drop at all.

Specified by:
setRate in interface CatalogLibrary.CataData
Parameters:
r - pct chance that the item is a potential selection
See Also:
CatalogLibrary.CataData.getMaskV(), CatalogLibrary.CataData.setRate(double), CatalogLibrary.CataData.getWhenLive()

data

public java.lang.String data(java.lang.String name)
Description copied from interface: CatalogLibrary.CataData
Returns this metadata as an xml doc

Specified by:
data in interface CatalogLibrary.CataData
Parameters:
name - null, or an optional item/mob name
Returns:
this metadata as an xml doc
See Also:
CatalogLibrary.CataData.build(String)

build

public void build(java.lang.String catadata)
Description copied from interface: CatalogLibrary.CataData
Builds this metadata from an xml doc

Specified by:
build in interface CatalogLibrary.CataData
Parameters:
catadata - this metadata as an xml doc
See Also:
CatalogLibrary.CataData.data(String)