com.planet_ink.coffee_mud.core
Class CMClass

java.lang.Object
  extended by java.lang.ClassLoader
      extended by com.planet_ink.coffee_mud.core.CMClass

public class CMClass
extends java.lang.ClassLoader

The core class loader, but more importantly, the core object template manager for the whole mud. Classes are grouped by their core interfaces, allowing them to have short "ID" names as referents. Classes are loaded and initialized from the class loader and then kept as template objects, with newInstances created on demand (or simply returned as the template, in cases where the objects are shared).


Nested Class Summary
static class CMClass.CMObjectType
           
protected static class CMClass.JScriptLib
          The helper class for full blown JavaScript objects.
 
Field Summary
protected  XVector<Ability> abilities
           
protected  XVector<Area> areaTypes
           
protected  XVector<Armor> armor
           
protected  XVector<Behavior> behaviors
           
protected  XVector<CharClass> charClasses
           
protected  XVector<ClanItem> clanItems
           
protected static java.util.Map<java.lang.String,java.lang.Class<?>> classes
           
protected  XVector<Command> commands
           
protected  java.util.Hashtable<java.lang.String,Command> commandWords
           
protected  java.util.Hashtable<java.lang.String,CMCommon> common
           
protected static boolean debugging
           
protected  XVector<Exit> exits
           
protected  XVector<Item> items
           
protected static long lastUpdateTime
           
protected  XVector<CMLibrary> libraries
           
protected  XVector<Room> locales
           
static int longestWebMacro
          static int for the web macro object with the longest name, used for web optimization
protected static int MAX_MOBS
           
protected static int MAX_MSGS
           
protected  XVector<MiscMagic> miscMagic
           
protected static java.util.LinkedList<MOB> MOB_CACHE
           
protected  XVector<MOB> MOBs
           
protected static java.util.LinkedList<CMMsg> MSGS_CACHE
           
static CMClass.CMObjectType[] OBJECTS_ITEMTYPES
          collection of all object types that are classified as "items" of one sort or another
protected  XVector<Race> races
           
protected  Item sampleItem
           
protected  MOB sampleMOB
           
protected  MOB samplePlayer
           
protected  XVector<Technical> tech
           
protected  XVector<Weapon> weapons
           
protected  java.util.Hashtable<java.lang.String,WebMacro> webMacros
           
 
Constructor Summary
CMClass()
          Creates a new instance of the class loader, updating the thread-group ref if necessary.
 
Method Summary
static java.util.Enumeration<Ability> abilities()
          An enumeration of all the stored abilities in this classloader for this thread
static java.util.Enumeration<Ability> abilities(Filterer<Ability> f)
          An enumeration of all the stored abilities in this classloader for this thread
static void addAllItemClassNames(java.util.List<java.lang.String> namesList, boolean NonArchon, boolean NonGeneric, boolean NonStandard, int themeCode)
          Fills the given list with the IDs of the various Item types, subject to the given filters
static void addCharClass(CharClass CR)
          Adds a new character class to the set
static boolean addClass(CMClass.CMObjectType type, CMObject O)
          Adds a new prototype of the given object type from your classloader
static void addRace(Race GR)
          Adds a new Race to the class sets.
static java.util.Enumeration<Area> areaTypes()
          An enumeration of all the stored area Types in this classloader for this thread
static java.util.Enumeration<Armor> armor()
          An enumeration of all the stored armor in this classloader for this thread
static java.util.Enumeration<Item> basicItems()
          An enumeration of all the stored basic Items in this classloader for this thread
static java.util.Enumeration<Behavior> behaviors()
          An enumeration of all the stored behaviors in this classloader for this thread
static CMClass c(byte c)
          Returns the CMClass instance tied to the given thread group, or null if not yet created.
static java.util.Enumeration<CharClass> charClasses()
          An enumeration of all the stored char Classes in this classloader for this thread
static boolean checkAncestry(java.lang.Class<?> cl, java.lang.Class<?> ancestorCl)
          Returns true if the given class implements the given ancestor/interface
static boolean checkForCMClass(CMClass.CMObjectType classType, java.lang.String path)
          Returns true if the given class has been loaded into the classloader, or if it is loadable through the cm class loading system.
static java.util.Enumeration<ClanItem> clanItems()
          An enumeration of all the stored clan Items in this classloader for this thread
static java.lang.String classID(java.lang.Object e)
          Returns the ID() if the object is a CMObject, and otherwise the simple class name, which is the class name after the final dot in a class path
static java.lang.String classPtrStr(java.lang.Object e)
          Returns the address part of an instance objects "default string name", which looks like com.planet_ink.coffee_mud.blah.ClassName@ab476d87e where the part after the at sign is the address
static java.util.Enumeration<Command> commands()
          An enumeration of all the stored commands in this classloader for this thread
static java.util.Enumeration<CMCommon> commonObjects()
          An enumeration of all the stored common Objects in this classloader for this thread
static void delCharClass(CharClass C)
          Removes the given characterclass from this set
static boolean delClass(CMClass.CMObjectType type, CMObject O)
          Deletes the class of the given object type from your classloader
static void delRace(Race R)
          Removes the given race from this set
static boolean exists(java.lang.String className)
          Returns whether the given class exists in the vm, not necessarily any given classloader.
static java.util.Enumeration<Exit> exits()
          An enumeration of all the stored exits in this classloader for this thread
static Ability findAbility(java.lang.String calledThis)
          Searches for an Ability object using the given search term.
static Ability findAbility(java.lang.String calledThis, CharStats charStats)
          Searches for an Ability object using the given search term and filters.
static Ability findAbility(java.lang.String calledThis, int ofClassDomain, long ofFlags, boolean exactOnly)
          Searches for an Ability object using the given search term and filters.
static Ability findAbility(java.lang.String calledThis, MOB mob)
          Searches for an Ability object using the given search term and filters.
static Behavior findBehavior(java.lang.String calledThis)
          Searches for a Behavior object using the given search term.
static CharClass findCharClass(java.lang.String calledThis)
          Does a search for a Char Class of the given name, first checking for identical matches, then case insensitive name matches.
static Command findCommandByTrigger(java.lang.String word, boolean exactOnly)
          Searches the command prototypes for a trigger word match and returns the command.
static CMClass.CMObjectType findObjectType(java.lang.String name)
          Searches for a match to the given object type name, preferring exact, but accepting prefixes.
static Race findRace(java.lang.String calledThis)
          Does a search for a race of the given name, first checking for identical matches, then case insensitive name matches.
static java.lang.String findTypeAncestor(java.lang.String code)
          Searches for a match to the given object type name, preferring exact, but accepting prefixes.
 java.lang.Class<?> finishDefineClass(java.lang.String className, byte[] classData, java.lang.String overPackage, boolean resolveIt)
          Finishes loading the class into the underlying classloader by handing the byte data to the classloader, after building a proper full class name.
static Ability getAbility(java.lang.String calledThis)
          Returns a new instance of a ability object of the given ID from your classloader
static Ability getAbilityByName(java.lang.String calledThis, boolean exact)
          Searches for an Ability object using the given search term.
static Ability getAbilityPrototype(java.lang.String calledThis)
          Returns the prototype instance of the ability object of the given ID from your classloader
static Area getAreaType(java.lang.String calledThis)
          Returns a new instance of a area object of the given ID from your classloader
static Armor getArmor(java.lang.String calledThis)
          Returns a new instance of a armor object of the given ID from your classloader
static Item getBasicItem(java.lang.String calledThis)
          Returns a new instance of a basic item object of the given ID from your classloader
static Behavior getBehavior(java.lang.String calledThis)
          Returns a new instance of a behavior object of the given ID from your classloader
static Behavior getBehaviorByName(java.lang.String calledThis, boolean exact)
          Searches for a Behavior object using the given search term and filters.
static CMObject getByType(java.lang.String ID, CMClass.CMObjectType type)
          Returns a newInstance of an object of the given type and ID.
static CharClass getCharClass(java.lang.String calledThis)
          Returns a reference to the prototype for the char class of the given ID from your classloader
static ClanItem getClanItem(java.lang.String calledThis)
          Returns a new instance of a clan item object of the given ID from your classloader
static CMFile getClassDir(java.lang.Class<?> C)
          Given a class, this method will return a CMFile object for the directory containing that class.
protected static java.lang.Object getClassSet(CMClass.CMObjectType code)
           
protected static java.lang.Object getClassSet(java.lang.String type)
           
static Command getCommand(java.lang.String word)
          Returns a reference to the prototype for the command of the given ID from your classloader
static CMCommon getCommon(java.lang.String calledThis)
          Returns a new instance of a common object of the given ID from your classloader
static CMCommon getCommonPrototype(java.lang.String calledThis)
          Returns the prototype instance of a common object of the given ID from your classloader
static Exit getExit(java.lang.String calledThis)
          Returns a new instance of a exit object of the given ID from your classloader
static MOB getFactoryMOB()
          Returns either a StdFactoryMOB object from the cache, if one is available, or makes a new one.
static MOB getFactoryMOB(java.lang.String name, int level, Room room)
          Returns either a StdFactoryMOB object from the cache, if one is available, or makes a new one, giving him the name, level, and room location given.
static CMObject getGlobal(java.util.List<? extends CMObject> list, java.lang.String ID)
          Returns the prototype of the cmobject of the given id from the given list
static CMObject getGlobal(java.util.Map<java.lang.String,? extends CMObject> list, java.lang.String ID)
          Given a map of CMObjects with ID()s defined, this will return the one matched by the given class name.
static Item getItem(java.lang.String calledThis)
          Returns a new instance of an item object of the given ID from your classloader Will search basic, armor, weapons, misc magic, clan items, and misc tech respectively
static Item getItemPrototype(java.lang.String itemID)
          Returns a reference to the prototype of an item object of the given ID from your classloader Will search basic, armor, weapons, misc magic, clan items, and misc tech respectively
static long getLastClassUpdatedTime()
          Returns a timestamp of the last time there was a change in the full set of classes.
static CMLibrary getLibrary(java.lang.String calledThis)
          Returns a reference to the prototype for the library of the given ID from your classloader
static java.lang.Object getLoadNewClassInstance(CMClass.CMObjectType classType, java.lang.String path, boolean quiet)
          If the given class exists in the classloader, a new instance will be returned.
static Room getLocale(java.lang.String calledThis)
          Returns a new instance of a locale object of the given ID from your classloader
static Room getLocalePrototype(java.lang.String calledThis)
          Returns the prototype instance of a locale object of the given ID from your classloader
static Item getMiscMagic(java.lang.String calledThis)
          Returns a new instance of a misc magic object of the given ID from your classloader
static MOB getMOB(java.lang.String calledThis)
          Returns a new instance of a MOB object of the given ID from your classloader
static MOB getMOBPrototype(java.lang.String mobID)
          Returns a reference to the prototype of a mob object of the given ID from your classloader
static CMMsg getMsg()
          Returns either a CMMsg object from the cache, if one is available, or makes a new one.
static CMMsg getMsg(MOB source, Environmental target, Environmental tool, int newSourceCode, int newTargetCode, int newOthersCode, java.lang.String allMessage)
          Creates and configures a CMMsg object for use in the game
static CMMsg getMsg(MOB source, Environmental target, Environmental tool, int newAllCode, java.lang.String allMessage)
          Creates and configures a CMMsg object for use in the game
static CMMsg getMsg(MOB source, Environmental target, Environmental tool, int newSourceCode, java.lang.String sourceMessage, int newTargetCode, java.lang.String targetMessage, int newOthersCode, java.lang.String othersMessage)
          Creates and configures a CMMsg object for use in the game
static CMMsg getMsg(MOB source, Environmental target, Environmental tool, int newAllCode, java.lang.String sourceMessage, java.lang.String targetMessage, java.lang.String othersMessage)
          Creates and configures a CMMsg object for use in the game
static CMMsg getMsg(MOB source, Environmental target, int newAllCode, java.lang.String allMessage)
          Creates and configures a CMMsg object for use in the game
static CMMsg getMsg(MOB source, int newAllCode, java.lang.String allMessage)
          Creates and configures a CMMsg object for use in the game
static CMMsg getMsg(MOB source, int newAllCode, java.lang.String allMessage, int newValue)
          Creates and configures a CMMsg object for use in the game
static CMObject getNewGlobal(java.util.List<? extends CMObject> list, java.lang.String ID)
          Returns a new instance of the cmobject of the given id from the given list
static CMObject getNewGlobal(java.util.Map<java.lang.String,? extends CMObject> list, java.lang.String ID)
          Given a map of CMObjects with ID()s defined, this will return the one matched by the given ID.
static java.lang.Object getObjectOrPrototype(java.lang.String calledThis)
          Returns either a new instance of the class of the given full java name, or the coffeemud prototype of the class with the given id.
static CMClass.CMObjectType getObjectType(java.lang.Object O)
          Returns the internal object type to which the given object example belongs by checking its interface implementations/ancestry
static java.lang.String getObjInstanceStr(Environmental E)
          This strange method returns an environmentals name, plus a string of instance hex digits, which I guess make the name more unique.
static CMObject getPrototypeByID(CMClass.CMObjectType type, java.lang.String calledThis)
          Returns the base prototype of the given type, by id
static Race getRace(java.lang.String calledThis)
          Returns a reference to the prototype for the race of the given ID from your classloader
static java.lang.String getSimpleClassName(java.lang.Class<?> C)
          Returns the simple class name of a class -- basically the name that comes after the final "." in a classpath.
static java.lang.String getSimpleClassName(java.lang.Object O)
          Returns the simple class name of an object -- basically the name that comes after the final "." in a classpath.
static Item getTech(java.lang.String calledThis)
          Returns a new instance of a misc tech object of the given ID from your classloader
static CMClass.CMObjectType getType(java.lang.Object O)
          Returns the object type of the given object
static CMClass.CMObjectType getTypeByNameOrOrdinal(java.lang.Object nameOrOrdinal)
          Given a string, Integer, or some other stringable object, this will return the cmobjecttype based on its name or ordinal relationship.
static Environmental getUnknown(java.lang.String calledThis)
          Returns a new instance of a Environmental of the given id, prefers items, but also checks mobs and abilities as well.
static Weapon getWeapon(java.lang.String calledThis)
          Returns a new instance of a weapon object of the given ID from your classloader
static WebMacro getWebMacro(java.lang.String macroName)
          Returns a reference to the prototype for the web macro of the given ID from your classloader
static CMClass initialize()
          Creates and returns a new CMClass object for the current calling thread
static CMClass instance()
          Returns the CMClass instance tied to this particular thread group, or null if not yet created.
 void intializeClasses()
          Initializes ALL the internal classes in these sets.
static boolean isType(java.lang.Object O, CMClass.CMObjectType type)
          Checks the given object against the given object type
static java.util.Enumeration<CMLibrary> libraries()
          An enumeration of all the stored races in this classloader for this thread
static boolean loadAllCoffeeMudClasses(CMProps page)
          Making good use of the class path directories from the INI file, this will load all the damn classes in coffeemud, being nice enough to report them to the log as it does so
static boolean loadClass(CMClass.CMObjectType classType, java.lang.String path, boolean quiet)
          Loads the class with the given coffeemud or java path to your classloader.
 java.lang.Class<?> loadClass(java.lang.String className)
          Attempts to load the given class, by fully qualified name
 java.lang.Class<?> loadClass(java.lang.String className, boolean resolveIt)
          Attempts to load the given class, by fully qualified name.
static java.util.Vector<java.lang.Object> loadClassList(java.lang.String defaultPath, java.lang.String requestedPathList, java.lang.String subDir, java.lang.Class<?> ancestorC1, boolean quiet)
          Given the "stock" default path to a set of coffeemud classes, and a potential set of requested paths, this method will follow requested paths (observing the default if default is listed in the request paths), and load all the coffeemud classes therein, making sure they respect the given interface/ancestor class.
static java.util.Hashtable loadHashListToObj(java.lang.String defaultPath, java.lang.String requestedPathList, java.lang.String ancestor)
          Given the "stock" default path to a set of coffeemud classes, and a potential set of requested paths, this method will follow requested paths (observing the default if default is listed in the request paths), and load all the coffeemud classes therein, making sure they respect the given interface/ancestor name.
static boolean loadListToObj(java.lang.Object collection, java.lang.String filePath, java.lang.Class<?> ancestorCl, boolean quiet)
          Given a java collection type of some sort (hashtable, vector, etc), a file path, and the class of an interface/ancestor that classes must implement, this method will load all classes in the appropriate path into the given collection.
static boolean loadListToObj(java.lang.Object collection, java.lang.String filePath, java.lang.String ancestor, boolean quiet)
          Given a java collection type of some sort (hashtable, vector, etc), a file path, and the name of an interface/ancestor that classes must implement, this method will load all classes in the appropriate path into the given collection.
static boolean loadObjectListToObj(java.lang.Object collection, java.lang.String defaultPath, java.lang.String path, java.lang.String ancestor)
          Given a java collection type of some sort (hashtable, vector, etc), a default path, a requested path, and the name of an interface/ancestor that classes must implement, this method will load all classes in the appropriate path into the given collection.
static XVector loadVectorListToObj(java.lang.String defaultPath, java.lang.String requestedPathList, java.lang.String ancestor)
          Given the "stock" default path to a set of coffeemud classes, and a potential set of requested paths, this method will follow requested paths (observing the default if default is listed in the request paths), and load all the coffeemud classes therein, making sure they respect the given interface/ancestor name.
static java.util.Enumeration<Room> locales()
          An enumeration of all the stored locales in this classloader for this thread
protected static java.lang.String makeDotClassPath(java.lang.String path)
           
protected static java.lang.String makeFilePath(java.lang.String path)
           
static java.util.Enumeration<MiscMagic> miscMagic()
          An enumeration of all the stored misc Magic in this classloader for this thread
static java.util.Enumeration<MiscMagic> miscMagic(Filterer<MiscMagic> f)
          An enumeration of all the stored misc Magic in this classloader for this thread
static java.util.Enumeration<MOB> mobTypes()
          An enumeration of all the stored mob Types in this classloader for this thread
static int numPrototypes(CMClass.CMObjectType type)
          Returns the total number of template/prototypes of the given type stored by this CMClass instance.
static int numPrototypes(CMClass.CMObjectType[] types)
          Returns the number of prototypes in the classloader of the given set of types
static java.util.Enumeration<Race> races()
          An enumeration of all the stored races in this classloader for this thread
static Ability randomAbility()
          Returns a random available ability prototype from your classloader
static Area randomArea()
          Returns a random available area prototype from your classloader
static CharClass randomCharClass()
          Returns a random available char class prototype from your classloader
static Race randomRace()
          Returns a random available race prototype from your classloader
protected static void reloadCommandWords()
          Causes the map of command words associated with command objects to be re-mapped, so that users can use them.
static boolean returnMob(MOB mob)
          Factory mob objects are normally re-used, and this method is the recycle bin.
static boolean returnMsg(CMMsg msg)
          CMMsg objects are normally re-used, and this method is the recycle bin.
static Item sampleItem()
          Returns the saved copy of the first basic item prototype
static MOB sampleMOB()
          Returns the saved copy of the first mob prototype
static MOB samplePlayer()
          Returns the saved copy of the first mob prototype as a player
static void shutdown()
          Unloads all the classes in this system.
static void sortCMObjectsByID(java.util.List<CMObject> V)
          Given a list of CMObjects, this will sort them, by CMObject.ID()
static void sortEnvironmentalsByName(java.util.List<? extends Environmental> V)
          Given a list of environmentals, this will sort them by CMObject.ID()
static java.util.Enumeration<Technical> tech()
          An enumeration of all the stored misc Tech in this classloader for this thread
static java.util.Enumeration<Technical> tech(Filterer<Technical> f)
          An enumeration of all the stored misc Tech in this classloader for this thread
static int totalClasses()
          Returns the total number of prototypes of all classes in your classloader
protected  int totalLocalClasses()
           
 void unload()
          Clears all the class sets in this loader.
static java.util.Enumeration<Weapon> weapons()
          An enumeration of all the stored weapons in this classloader for this thread
static java.util.Enumeration<WebMacro> webmacros()
          An enumeration of all the stored webmacros in this classloader for this thread
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debugging

protected static boolean debugging

lastUpdateTime

protected static volatile long lastUpdateTime

classes

protected static final java.util.Map<java.lang.String,java.lang.Class<?>> classes

OBJECTS_ITEMTYPES

public static final CMClass.CMObjectType[] OBJECTS_ITEMTYPES
collection of all object types that are classified as "items" of one sort or another


longestWebMacro

public static int longestWebMacro
static int for the web macro object with the longest name, used for web optimization


common

protected java.util.Hashtable<java.lang.String,CMCommon> common

races

protected XVector<Race> races

charClasses

protected XVector<CharClass> charClasses

MOBs

protected XVector<MOB> MOBs

abilities

protected XVector<Ability> abilities

locales

protected XVector<Room> locales

exits

protected XVector<Exit> exits

items

protected XVector<Item> items

behaviors

protected XVector<Behavior> behaviors

weapons

protected XVector<Weapon> weapons

armor

protected XVector<Armor> armor

miscMagic

protected XVector<MiscMagic> miscMagic

tech

protected XVector<Technical> tech

clanItems

protected XVector<ClanItem> clanItems

areaTypes

protected XVector<Area> areaTypes

commands

protected XVector<Command> commands

libraries

protected XVector<CMLibrary> libraries

webMacros

protected java.util.Hashtable<java.lang.String,WebMacro> webMacros

commandWords

protected java.util.Hashtable<java.lang.String,Command> commandWords

MSGS_CACHE

protected static final java.util.LinkedList<CMMsg> MSGS_CACHE

MOB_CACHE

protected static final java.util.LinkedList<MOB> MOB_CACHE

MAX_MSGS

protected static final int MAX_MSGS

MAX_MOBS

protected static final int MAX_MOBS

sampleItem

protected Item sampleItem

sampleMOB

protected MOB sampleMOB

samplePlayer

protected MOB samplePlayer
Constructor Detail

CMClass

public CMClass()
Creates a new instance of the class loader, updating the thread-group ref if necessary.

Method Detail

initialize

public static final CMClass initialize()
Creates and returns a new CMClass object for the current calling thread

Returns:
a new CMClass object for the current calling thread

c

public static CMClass c(byte c)
Returns the CMClass instance tied to the given thread group, or null if not yet created.

Parameters:
c - the code for the thread group to return (0-255)
Returns:
the CMClass instance tied to the given thread group, or null if not yet created.

instance

public static CMClass instance()
Returns the CMClass instance tied to this particular thread group, or null if not yet created.

Returns:
the CMClass instance tied to this particular thread group, or null if not yet created.

exists

public static final boolean exists(java.lang.String className)
Returns whether the given class exists in the vm, not necessarily any given classloader. Requires a fully qualified java class name.

Parameters:
className - a fully qualified java class name.
Returns:
whether the given class exists in the vm

isType

public static final boolean isType(java.lang.Object O,
                                   CMClass.CMObjectType type)
Checks the given object against the given object type

Parameters:
O - the object to inspect
type - the type to compare against
Returns:
true if theres a match, and false otherwise
See Also:
CMClass.CMObjectType

getByType

public static final CMObject getByType(java.lang.String ID,
                                       CMClass.CMObjectType type)
Returns a newInstance of an object of the given type and ID. NULL if not found.

Parameters:
ID - the ID of the object to look for
type - the type of object to check
Returns:
a newInstance of an object of the given type and ID.
See Also:
CMClass.CMObjectType

getType

public static final CMClass.CMObjectType getType(java.lang.Object O)
Returns the object type of the given object

Parameters:
O - the object to inspect
Returns:
the cmobjectype type
See Also:
CMClass.CMObjectType

getTypeByNameOrOrdinal

public static CMClass.CMObjectType getTypeByNameOrOrdinal(java.lang.Object nameOrOrdinal)
Given a string, Integer, or some other stringable object, this will return the cmobjecttype based on its name or ordinal relationship.

Parameters:
nameOrOrdinal - the string, integer, or whatever object
Returns:
the cmobjecttype it refers to
See Also:
CMClass.CMObjectType

getClassSet

protected static final java.lang.Object getClassSet(java.lang.String type)

getClassSet

protected static final java.lang.Object getClassSet(CMClass.CMObjectType code)

numPrototypes

public static final int numPrototypes(CMClass.CMObjectType type)
Returns the total number of template/prototypes of the given type stored by this CMClass instance.

Parameters:
type - the type of object to count
Returns:
the number stored
See Also:
CMClass.CMObjectType

races

public static final java.util.Enumeration<Race> races()
An enumeration of all the stored races in this classloader for this thread

Returns:
an enumeration of all the stored races in this classloader for this thread

commonObjects

public static final java.util.Enumeration<CMCommon> commonObjects()
An enumeration of all the stored common Objects in this classloader for this thread

Returns:
an enumeration of all the stored common Objects in this classloader for this thread

charClasses

public static final java.util.Enumeration<CharClass> charClasses()
An enumeration of all the stored char Classes in this classloader for this thread

Returns:
an enumeration of all the stored char Classes in this classloader for this thread

mobTypes

public static final java.util.Enumeration<MOB> mobTypes()
An enumeration of all the stored mob Types in this classloader for this thread

Returns:
an enumeration of all the stored mob Types in this classloader for this thread

libraries

public static final java.util.Enumeration<CMLibrary> libraries()
An enumeration of all the stored races in this classloader for this thread

Returns:
an enumeration of all the stored races in this classloader for this thread

locales

public static final java.util.Enumeration<Room> locales()
An enumeration of all the stored locales in this classloader for this thread

Returns:
an enumeration of all the stored locales in this classloader for this thread

exits

public static final java.util.Enumeration<Exit> exits()
An enumeration of all the stored exits in this classloader for this thread

Returns:
an enumeration of all the stored exits in this classloader for this thread

behaviors

public static final java.util.Enumeration<Behavior> behaviors()
An enumeration of all the stored behaviors in this classloader for this thread

Returns:
an enumeration of all the stored behaviors in this classloader for this thread

basicItems

public static final java.util.Enumeration<Item> basicItems()
An enumeration of all the stored basic Items in this classloader for this thread

Returns:
an enumeration of all the stored basic Items in this classloader for this thread

weapons

public static final java.util.Enumeration<Weapon> weapons()
An enumeration of all the stored weapons in this classloader for this thread

Returns:
an enumeration of all the stored weapons in this classloader for this thread

armor

public static final java.util.Enumeration<Armor> armor()
An enumeration of all the stored armor in this classloader for this thread

Returns:
an enumeration of all the stored armor in this classloader for this thread

miscMagic

public static final java.util.Enumeration<MiscMagic> miscMagic()
An enumeration of all the stored misc Magic in this classloader for this thread

Returns:
an enumeration of all the stored misc Magic in this classloader for this thread

miscMagic

public static final java.util.Enumeration<MiscMagic> miscMagic(Filterer<MiscMagic> f)
An enumeration of all the stored misc Magic in this classloader for this thread

Parameters:
f - the filterer to help select which ones you want
Returns:
an enumeration of all the stored misc Magic in this classloader for this thread

tech

public static final java.util.Enumeration<Technical> tech()
An enumeration of all the stored misc Tech in this classloader for this thread

Returns:
an enumeration of all the stored misc Tech in this classloader for this thread

tech

public static final java.util.Enumeration<Technical> tech(Filterer<Technical> f)
An enumeration of all the stored misc Tech in this classloader for this thread

Parameters:
f - the filterer to help select which ones you want
Returns:
an enumeration of all the stored misc Tech in this classloader for this thread

clanItems

public static final java.util.Enumeration<ClanItem> clanItems()
An enumeration of all the stored clan Items in this classloader for this thread

Returns:
an enumeration of all the stored clan Items in this classloader for this thread

areaTypes

public static final java.util.Enumeration<Area> areaTypes()
An enumeration of all the stored area Types in this classloader for this thread

Returns:
an enumeration of all the stored area Types in this classloader for this thread

commands

public static final java.util.Enumeration<Command> commands()
An enumeration of all the stored commands in this classloader for this thread

Returns:
an enumeration of all the stored commands in this classloader for this thread

abilities

public static final java.util.Enumeration<Ability> abilities()
An enumeration of all the stored abilities in this classloader for this thread

Returns:
an enumeration of all the stored abilities in this classloader for this thread

abilities

public static final java.util.Enumeration<Ability> abilities(Filterer<Ability> f)
An enumeration of all the stored abilities in this classloader for this thread

Parameters:
f - the filterer to help select which ones you want
Returns:
an enumeration of all the stored abilities in this classloader for this thread

webmacros

public static final java.util.Enumeration<WebMacro> webmacros()
An enumeration of all the stored webmacros in this classloader for this thread

Returns:
an enumeration of all the stored webmacros in this classloader for this thread

randomRace

public static final Race randomRace()
Returns a random available race prototype from your classloader

Returns:
a random available race prototype

randomCharClass

public static final CharClass randomCharClass()
Returns a random available char class prototype from your classloader

Returns:
a random available char class prototype

randomAbility

public static final Ability randomAbility()
Returns a random available ability prototype from your classloader

Returns:
a random available ability prototype

randomArea

public static final Area randomArea()
Returns a random available area prototype from your classloader

Returns:
a random available area prototype

getLocale

public static final Room getLocale(java.lang.String calledThis)
Returns a new instance of a locale object of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
a new instance of a locale object of the given ID

getLocalePrototype

public static final Room getLocalePrototype(java.lang.String calledThis)
Returns the prototype instance of a locale object of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
the prototype instance of a locale object of the given ID

getLibrary

public static final CMLibrary getLibrary(java.lang.String calledThis)
Returns a reference to the prototype for the library of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
a reference to the prototype for the library of the given ID

getAreaType

public static final Area getAreaType(java.lang.String calledThis)
Returns a new instance of a area object of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
a new instance of a area object of the given ID

getExit

public static final Exit getExit(java.lang.String calledThis)
Returns a new instance of a exit object of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
a new instance of a exit object of the given ID

getMOB

public static final MOB getMOB(java.lang.String calledThis)
Returns a new instance of a MOB object of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
a new instance of a MOB object of the given ID

getWeapon

public static final Weapon getWeapon(java.lang.String calledThis)
Returns a new instance of a weapon object of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
a new instance of a weapon object of the given ID

getClanItem

public static final ClanItem getClanItem(java.lang.String calledThis)
Returns a new instance of a clan item object of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
a new instance of a clan item object of the given ID

getMiscMagic

public static final Item getMiscMagic(java.lang.String calledThis)
Returns a new instance of a misc magic object of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
a new instance of a misc magic object of the given ID

getTech

public static final Item getTech(java.lang.String calledThis)
Returns a new instance of a misc tech object of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
a new instance of a misc tech object of the given ID

getArmor

public static final Armor getArmor(java.lang.String calledThis)
Returns a new instance of a armor object of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
a new instance of a armor object of the given ID

getBasicItem

public static final Item getBasicItem(java.lang.String calledThis)
Returns a new instance of a basic item object of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
a new instance of a basic item object of the given ID

getBehavior

public static final Behavior getBehavior(java.lang.String calledThis)
Returns a new instance of a behavior object of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
a new instance of a behavior object of the given ID

getAbility

public static final Ability getAbility(java.lang.String calledThis)
Returns a new instance of a ability object of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
a new instance of a ability object of the given ID

getAbilityPrototype

public static final Ability getAbilityPrototype(java.lang.String calledThis)
Returns the prototype instance of the ability object of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
the prototype instance of a ability object of the given ID

getCharClass

public static final CharClass getCharClass(java.lang.String calledThis)
Returns a reference to the prototype for the char class of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
a reference to the prototype for the char class of the given ID

getCommon

public static final CMCommon getCommon(java.lang.String calledThis)
Returns a new instance of a common object of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
a new instance of a common object of the given ID

getCommonPrototype

public static final CMCommon getCommonPrototype(java.lang.String calledThis)
Returns the prototype instance of a common object of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
the prototype instance of a common object of the given ID

getCommand

public static final Command getCommand(java.lang.String word)
Returns a reference to the prototype for the command of the given ID from your classloader

Parameters:
word - the ID() of the object to return
Returns:
a reference to the prototype for the command of the given ID

getWebMacro

public static final WebMacro getWebMacro(java.lang.String macroName)
Returns a reference to the prototype for the web macro of the given ID from your classloader

Parameters:
macroName - the ID() of the object to return
Returns:
a reference to the prototype for the web macro of the given ID

getRace

public static final Race getRace(java.lang.String calledThis)
Returns a reference to the prototype for the race of the given ID from your classloader

Parameters:
calledThis - the ID() of the object to return
Returns:
a reference to the prototype for the race of the given ID

numPrototypes

public static final int numPrototypes(CMClass.CMObjectType[] types)
Returns the number of prototypes in the classloader of the given set of types

Parameters:
types - the types to count
Returns:
the number of prototypes in the classloader of the given set of types

addAllItemClassNames

public static final void addAllItemClassNames(java.util.List<java.lang.String> namesList,
                                              boolean NonArchon,
                                              boolean NonGeneric,
                                              boolean NonStandard,
                                              int themeCode)
Fills the given list with the IDs of the various Item types, subject to the given filters

Parameters:
namesList - the list to populate with IDs
NonArchon - true to not include Archon items
NonGeneric - true to not include Gen items
NonStandard - true to not include Standard items
themeCode - the theme mask to respect, sortof

getItem

public static Item getItem(java.lang.String calledThis)
Returns a new instance of an item object of the given ID from your classloader Will search basic, armor, weapons, misc magic, clan items, and misc tech respectively

Parameters:
calledThis - the ID() of the object to return
Returns:
a new instance of an item object of the given ID

sampleItem

public static final Item sampleItem()
Returns the saved copy of the first basic item prototype

Returns:
the saved copy of the first basic item prototype

getItemPrototype

public static final Item getItemPrototype(java.lang.String itemID)
Returns a reference to the prototype of an item object of the given ID from your classloader Will search basic, armor, weapons, misc magic, clan items, and misc tech respectively

Parameters:
itemID - the ID() of the object to return
Returns:
a reference to the prototype of an item object of the given ID

getMOBPrototype

public static final MOB getMOBPrototype(java.lang.String mobID)
Returns a reference to the prototype of a mob object of the given ID from your classloader

Parameters:
mobID - the ID() of the object to return
Returns:
a reference to the prototype of an mob object of the given ID

sampleMOB

public static final MOB sampleMOB()
Returns the saved copy of the first mob prototype

Returns:
the saved copy of the first mob prototype

samplePlayer

public static final MOB samplePlayer()
Returns the saved copy of the first mob prototype as a player

Returns:
the saved copy of the first mob prototype as a player

findCommandByTrigger

public static final Command findCommandByTrigger(java.lang.String word,
                                                 boolean exactOnly)
Searches the command prototypes for a trigger word match and returns the command.

Parameters:
word - the command word to search for
exactOnly - true for a whole word match, false for a startsWith match
Returns:
the command prototypes for a trigger word match and returns the command.

totalLocalClasses

protected final int totalLocalClasses()

totalClasses

public static final int totalClasses()
Returns the total number of prototypes of all classes in your classloader

Returns:
the total number of prototypes of all classes in your classloader

delClass

public static final boolean delClass(CMClass.CMObjectType type,
                                     CMObject O)
Deletes the class of the given object type from your classloader

Parameters:
type - the type of object that the given object belongs to
O - the specific prototype class to remove
Returns:
true

addClass

public static final boolean addClass(CMClass.CMObjectType type,
                                     CMObject O)
Adds a new prototype of the given object type from your classloader

Parameters:
type - the type of object that the given object belongs to
O - the specific prototype class to add
Returns:
true

findObjectType

public static final CMClass.CMObjectType findObjectType(java.lang.String name)
Searches for a match to the given object type name, preferring exact, but accepting prefixes.

Parameters:
name - the object type name to search for
Returns:
the matching object type or NULL

findTypeAncestor

public static final java.lang.String findTypeAncestor(java.lang.String code)
Searches for a match to the given object type name, preferring exact, but accepting prefixes. Returns the ancestor java class type

Parameters:
code - the object type name to search for
Returns:
the matching object type interface/ancestor or NULL

getObjectType

public static final CMClass.CMObjectType getObjectType(java.lang.Object O)
Returns the internal object type to which the given object example belongs by checking its interface implementations/ancestry

Parameters:
O - the object to find the type of
Returns:
the type of object this is, or NULL

loadClass

public static final boolean loadClass(CMClass.CMObjectType classType,
                                      java.lang.String path,
                                      boolean quiet)
Loads the class with the given coffeemud or java path to your classloader.

Parameters:
classType - the type of object to load
path - the file or java path of the class to load
quiet - true to not report errors to the log, false otherwise
Returns:
true if the prototype was loaded

makeDotClassPath

protected static java.lang.String makeDotClassPath(java.lang.String path)

makeFilePath

protected static java.lang.String makeFilePath(java.lang.String path)

getLoadNewClassInstance

public static final java.lang.Object getLoadNewClassInstance(CMClass.CMObjectType classType,
                                                             java.lang.String path,
                                                             boolean quiet)
If the given class exists in the classloader, a new instance will be returned. If it does not, it will be loaded, and then a new instance of it will be returned.

Parameters:
classType - the type of class as a filter
path - the path of some sort to get a new instance of
quiet - true to not post errors to the log, false otherwise
Returns:
a new instance of the given class

checkForCMClass

public static final boolean checkForCMClass(CMClass.CMObjectType classType,
                                            java.lang.String path)
Returns true if the given class has been loaded into the classloader, or if it is loadable through the cm class loading system.

Parameters:
classType - the type of class to check for (for ancestry confirmation)
path - the path of the class to check for
Returns:
true if it is loaded or loadable, false otherwise

getPrototypeByID

public static final CMObject getPrototypeByID(CMClass.CMObjectType type,
                                              java.lang.String calledThis)
Returns the base prototype of the given type, by id

Parameters:
type - the cmobjecttype to return
calledThis - the ID of the cmobjecttype
Returns:
the base prototype of the given type, by id

getObjectOrPrototype

public static final java.lang.Object getObjectOrPrototype(java.lang.String calledThis)
Returns either a new instance of the class of the given full java name, or the coffeemud prototype of the class with the given id. Checks all cmobjecttypes.

Parameters:
calledThis - the ID or the given full java name.
Returns:
a new instance of the class, or the prototype

getUnknown

public static final Environmental getUnknown(java.lang.String calledThis)
Returns a new instance of a Environmental of the given id, prefers items, but also checks mobs and abilities as well.

Parameters:
calledThis - the id of the cmobject
Returns:
a new instance of a Environmental

findRace

public static final Race findRace(java.lang.String calledThis)
Does a search for a race of the given name, first checking for identical matches, then case insensitive name matches.

Parameters:
calledThis - the name or id
Returns:
the race object

findCharClass

public static final CharClass findCharClass(java.lang.String calledThis)
Does a search for a Char Class of the given name, first checking for identical matches, then case insensitive name matches.

Parameters:
calledThis - the name or id
Returns:
the Char Class object

getNewGlobal

public static final CMObject getNewGlobal(java.util.List<? extends CMObject> list,
                                          java.lang.String ID)
Returns a new instance of the cmobject of the given id from the given list

Parameters:
list - the list to search, must be alphabetized
ID - the perfect cmobject ID of the object
Returns:
a new instance of the cmobject of the given id from the given list

getGlobal

public static final CMObject getGlobal(java.util.List<? extends CMObject> list,
                                       java.lang.String ID)
Returns the prototype of the cmobject of the given id from the given list

Parameters:
list - the list to search, must be alphabetized
ID - the perfect cmobject ID of the object
Returns:
the prototype of the cmobject of the given id from the given list

findAbility

public static final Ability findAbility(java.lang.String calledThis)
Searches for an Ability object using the given search term. This "finder" matches the ID, and searches the name and display text.

Parameters:
calledThis - the search term to use
Returns:
the first ability found matching the search term

findAbility

public static final Ability findAbility(java.lang.String calledThis,
                                        int ofClassDomain,
                                        long ofFlags,
                                        boolean exactOnly)
Searches for an Ability object using the given search term and filters. This "finder" matches the ID, and searches the name and display text.

Parameters:
calledThis - the search term to use
ofClassDomain - a class/domain filter, or -1 to skip
ofFlags - an ability flag filter, or -1 to skip
exactOnly - true to match only case-insensitive whole strings, false otherwise
Returns:
the first ability found matching the search term

findBehavior

public static final Behavior findBehavior(java.lang.String calledThis)
Searches for a Behavior object using the given search term. This "finder" matches the ID, and searches the name.

Parameters:
calledThis - the search term to use
Returns:
the first behavior found matching the search term

getBehaviorByName

public static final Behavior getBehaviorByName(java.lang.String calledThis,
                                               boolean exact)
Searches for a Behavior object using the given search term and filters. This "finder" matches the name only, no ID.

Parameters:
calledThis - the search term to use
exact - true for whole string match, false otherwise
Returns:
the first behavior found matching the search term

getAbilityByName

public static final Ability getAbilityByName(java.lang.String calledThis,
                                             boolean exact)
Searches for an Ability object using the given search term. This "finder" matches the name only, no ID

Parameters:
calledThis - the search term to use
exact - true for whole string match, false otherwise
Returns:
the first ability found matching the search term

findAbility

public static final Ability findAbility(java.lang.String calledThis,
                                        CharStats charStats)
Searches for an Ability object using the given search term and filters. This "finder" searches the name and display text, and finally the ID. The filter here is to allow you to filter only abilities that a given mob qualifies for by sending their charstats as a "character class" set.

Parameters:
calledThis - the search term to use
charStats - only the abilities qualified for by the classes herein
Returns:
the first ability found matching the search term

findAbility

public static final Ability findAbility(java.lang.String calledThis,
                                        MOB mob)
Searches for an Ability object using the given search term and filters. This "finder" searches the name and display text, and finally the ID. The filter here is to allow you to filter only abilities that a given mob actually has.

Parameters:
calledThis - the search term to use
mob - the dude to search
Returns:
the first ability found matching the search term

getNewGlobal

public static final CMObject getNewGlobal(java.util.Map<java.lang.String,? extends CMObject> list,
                                          java.lang.String ID)
Given a map of CMObjects with ID()s defined, this will return the one matched by the given ID. If the ID is not found in the map, it will iterate and look for a case-insensitive match before giving up. It returns a brand new object.

Parameters:
list - the map of IDs to objects
ID - the ID to search for
Returns:
the CMObject that the ID belongs to, after newInstance is called.

getGlobal

public static final CMObject getGlobal(java.util.Map<java.lang.String,? extends CMObject> list,
                                       java.lang.String ID)
Given a map of CMObjects with ID()s defined, this will return the one matched by the given class name. If the name is not found in the map, it will iterate and look for a case-insensitive match before giving up. If returns the actual map reference.

Parameters:
list - the map of IDs to objects
ID - the ID to search for
Returns:
the CMObject that the ID belongs to, straight from the map.

addRace

public static final void addRace(Race GR)
Adds a new Race to the class sets.

Parameters:
GR - the race to add

addCharClass

public static final void addCharClass(CharClass CR)
Adds a new character class to the set

Parameters:
CR - the character class to add

delCharClass

public static final void delCharClass(CharClass C)
Removes the given characterclass from this set

Parameters:
C - the character class to remove

delRace

public static final void delRace(Race R)
Removes the given race from this set

Parameters:
R - the race to remove

sortCMObjectsByID

public static final void sortCMObjectsByID(java.util.List<CMObject> V)
Given a list of CMObjects, this will sort them, by CMObject.ID()

Parameters:
V - the list of objects to sort.

sortEnvironmentalsByName

public static final void sortEnvironmentalsByName(java.util.List<? extends Environmental> V)
Given a list of environmentals, this will sort them by CMObject.ID()

Parameters:
V - the list of environmentals

intializeClasses

public final void intializeClasses()
Initializes ALL the internal classes in these sets. All of them. All types.


loadHashListToObj

public static java.util.Hashtable loadHashListToObj(java.lang.String defaultPath,
                                                    java.lang.String requestedPathList,
                                                    java.lang.String ancestor)
Given the "stock" default path to a set of coffeemud classes, and a potential set of requested paths, this method will follow requested paths (observing the default if default is listed in the request paths), and load all the coffeemud classes therein, making sure they respect the given interface/ancestor name.

Parameters:
defaultPath - the path to use when default is a requested path
requestedPathList - the ; separated list of paths to look for classes in
ancestor - the full class name of an acester/interface
Returns:
a hashtable mapping the IDs of the classes with a prototype instance of the classes

loadVectorListToObj

public static final XVector loadVectorListToObj(java.lang.String defaultPath,
                                                java.lang.String requestedPathList,
                                                java.lang.String ancestor)
Given the "stock" default path to a set of coffeemud classes, and a potential set of requested paths, this method will follow requested paths (observing the default if default is listed in the request paths), and load all the coffeemud classes therein, making sure they respect the given interface/ancestor name.

Parameters:
defaultPath - the path to use when default is a requested path
requestedPathList - the ; separated list of paths to look for classes in
ancestor - the full class name of an acester/interface
Returns:
a vector of all the prototype instance of the classes

loadClassList

public static final java.util.Vector<java.lang.Object> loadClassList(java.lang.String defaultPath,
                                                                     java.lang.String requestedPathList,
                                                                     java.lang.String subDir,
                                                                     java.lang.Class<?> ancestorC1,
                                                                     boolean quiet)
Given the "stock" default path to a set of coffeemud classes, and a potential set of requested paths, this method will follow requested paths (observing the default if default is listed in the request paths), and load all the coffeemud classes therein, making sure they respect the given interface/ancestor class.

Parameters:
defaultPath - the path to use when default is a requested path
requestedPathList - the ; separated list of paths to look for classes in
ancestorC1 - the full class of an acester/interface
subDir - if given, this will be appended to all requested paths except default
quiet - true to not report errors to the log, false otherwise
Returns:
a vector of all the prototype instance of the classes

loadObjectListToObj

public static final boolean loadObjectListToObj(java.lang.Object collection,
                                                java.lang.String defaultPath,
                                                java.lang.String path,
                                                java.lang.String ancestor)
Given a java collection type of some sort (hashtable, vector, etc), a default path, a requested path, and the name of an interface/ancestor that classes must implement, this method will load all classes in the appropriate path into the given collection.

Parameters:
collection - the collection type to use (map, list, set, etc, etc)
defaultPath - the path to use if the given path requests the default path
path - the requested path to use
ancestor - the full java class name of an interface ancestor to force classes to respect
Returns:
true if classes were loaded without errors, false otherwise

loadListToObj

public static final boolean loadListToObj(java.lang.Object collection,
                                          java.lang.String filePath,
                                          java.lang.String ancestor,
                                          boolean quiet)
Given a java collection type of some sort (hashtable, vector, etc), a file path, and the name of an interface/ancestor that classes must implement, this method will load all classes in the appropriate path into the given collection.

Parameters:
collection - the collection type to use (map, list, set, etc, etc)
filePath - the path to look for classes in
ancestor - the full java class name of an interface ancestor to force classes to respect
quiet - true to not report errors, false otherwise
Returns:
true if classes were loaded successfully, false otherwise

loadListToObj

public static final boolean loadListToObj(java.lang.Object collection,
                                          java.lang.String filePath,
                                          java.lang.Class<?> ancestorCl,
                                          boolean quiet)
Given a java collection type of some sort (hashtable, vector, etc), a file path, and the class of an interface/ancestor that classes must implement, this method will load all classes in the appropriate path into the given collection.

Parameters:
collection - the collection type to use (map, list, set, etc, etc)
filePath - the path to look for classes in
ancestorCl - the full java class of an interface ancestor to force classes to respect
quiet - true to not report errors, false otherwise
Returns:
true if classes were loaded successfully, false otherwise

getObjInstanceStr

public static final java.lang.String getObjInstanceStr(Environmental E)
This strange method returns an environmentals name, plus a string of instance hex digits, which I guess make the name more unique.

Parameters:
E - the environmenal to make a unique name for
Returns:
the unique name

getSimpleClassName

public static final java.lang.String getSimpleClassName(java.lang.Object O)
Returns the simple class name of an object -- basically the name that comes after the final "." in a classpath.

Parameters:
O - the object to get the name for
Returns:
the simple name

getSimpleClassName

public static final java.lang.String getSimpleClassName(java.lang.Class<?> C)
Returns the simple class name of a class -- basically the name that comes after the final "." in a classpath.

Parameters:
C - the class to get the name for
Returns:
the simple name

getClassDir

public static final CMFile getClassDir(java.lang.Class<?> C)
Given a class, this method will return a CMFile object for the directory containing that class.

Parameters:
C - the class to get a directory for
Returns:
the CMFile containing that class

checkAncestry

public static final boolean checkAncestry(java.lang.Class<?> cl,
                                          java.lang.Class<?> ancestorCl)
Returns true if the given class implements the given ancestor/interface

Parameters:
cl - the class to check
ancestorCl - the ancestor/interface
Returns:
true if one comes from the second

classPtrStr

public static final java.lang.String classPtrStr(java.lang.Object e)
Returns the address part of an instance objects "default string name", which looks like com.planet_ink.coffee_mud.blah.ClassName@ab476d87e where the part after the at sign is the address

Parameters:
e - the object to get an address for
Returns:
the address

classID

public static final java.lang.String classID(java.lang.Object e)
Returns the ID() if the object is a CMObject, and otherwise the simple class name, which is the class name after the final dot in a class path

Parameters:
e - the object to get a simple class name for.
Returns:
the simple class name, or ID

loadClass

public final java.lang.Class<?> loadClass(java.lang.String className)
                                   throws java.lang.ClassNotFoundException
Attempts to load the given class, by fully qualified name

Overrides:
loadClass in class java.lang.ClassLoader
Parameters:
className - the class name
Returns:
the class loaded
Throws:
java.lang.ClassNotFoundException - something went wrong

finishDefineClass

public final java.lang.Class<?> finishDefineClass(java.lang.String className,
                                                  byte[] classData,
                                                  java.lang.String overPackage,
                                                  boolean resolveIt)
                                           throws java.lang.ClassFormatError
Finishes loading the class into the underlying classloader by handing the byte data to the classloader, after building a proper full class name.

Parameters:
className - the class name
classData - the byte data of the class to load
overPackage - the package the class belongs to
resolveIt - true to link the class, false if this is a drill
Returns:
the class defined
Throws:
java.lang.ClassFormatError - something went wrong

loadClass

public final java.lang.Class<?> loadClass(java.lang.String className,
                                          boolean resolveIt)
                                   throws java.lang.ClassNotFoundException
Attempts to load the given class, by fully qualified name. This is fun because it will also load javascript classes, if the className ends with .js instead of .class This is the required version of loadClass<?> which is called both from loadClass<?> above and from the internal function FindClassFromClass.

Overrides:
loadClass in class java.lang.ClassLoader
Parameters:
className - the class name
resolveIt - true to link the class, false if this is a drill
Returns:
the class loaded
Throws:
java.lang.ClassNotFoundException - something went wrong

reloadCommandWords

protected static final void reloadCommandWords()
Causes the map of command words associated with command objects to be re-mapped, so that users can use them.


loadAllCoffeeMudClasses

public static final boolean loadAllCoffeeMudClasses(CMProps page)
Making good use of the class path directories from the INI file, this will load all the damn classes in coffeemud, being nice enough to report them to the log as it does so

Parameters:
page - the coffeemud.ini file
Returns:
true if success happened, and false otherwise

getLastClassUpdatedTime

public static long getLastClassUpdatedTime()
Returns a timestamp of the last time there was a change in the full set of classes.

Returns:
the last time there was a change

returnMsg

public static final boolean returnMsg(CMMsg msg)
CMMsg objects are normally re-used, and this method is the recycle bin. If the msg were to have been garbage collected, it would get returned here anyway, but this is the nice way to get it done.

Parameters:
msg - the CMMsg we are done using
Returns:
true if it was returned to the bin, and false if it was allowed to die

getMsg

public static final CMMsg getMsg()
Returns either a CMMsg object from the cache, if one is available, or makes a new one.

Returns:
a CMMsg object, ready to use.

getMsg

public static final CMMsg getMsg(MOB source,
                                 int newAllCode,
                                 java.lang.String allMessage)
Creates and configures a CMMsg object for use in the game

Parameters:
source - the agent source of the action
newAllCode - the source, target, and others code to use
allMessage - the source, target, and others string msg to send
Returns:
the CMMsg Object
See Also:
CMMsg.source(), CMMsg.sourceCode(), CMMsg.sourceMessage()

getMsg

public static final CMMsg getMsg(MOB source,
                                 int newAllCode,
                                 java.lang.String allMessage,
                                 int newValue)
Creates and configures a CMMsg object for use in the game

Parameters:
source - the agent source of the action
newAllCode - the source, target, and others code to use
allMessage - the source, target, and others string msg to send
newValue - the value to set on the message
Returns:
the CMMsg Object
See Also:
CMMsg.source(), CMMsg.sourceCode(), CMMsg.sourceMessage(), CMMsg.value()

getMsg

public static final CMMsg getMsg(MOB source,
                                 Environmental target,
                                 int newAllCode,
                                 java.lang.String allMessage)
Creates and configures a CMMsg object for use in the game

Parameters:
source - the agent source of the action
target - the target of the action
newAllCode - the source, target, and others code to use
allMessage - the source, target, and others string msg to send
Returns:
the CMMsg Object
See Also:
CMMsg.source(), CMMsg.target(), CMMsg.sourceCode(), CMMsg.sourceMessage()

getMsg

public static final CMMsg getMsg(MOB source,
                                 Environmental target,
                                 Environmental tool,
                                 int newAllCode,
                                 java.lang.String allMessage)
Creates and configures a CMMsg object for use in the game

Parameters:
source - the agent source of the action
target - the target of the action
tool - the tool used by the source to do the action
newAllCode - the source, target, and others code to use
allMessage - the source, target, and others string msg to send
Returns:
the CMMsg Object
See Also:
CMMsg.source(), CMMsg.target(), CMMsg.tool(), CMMsg.sourceCode(), CMMsg.sourceMessage()

getMsg

public static final CMMsg getMsg(MOB source,
                                 Environmental target,
                                 Environmental tool,
                                 int newSourceCode,
                                 int newTargetCode,
                                 int newOthersCode,
                                 java.lang.String allMessage)
Creates and configures a CMMsg object for use in the game

Parameters:
source - the agent source of the action
target - the target of the action
tool - the tool used by the source to do the action
newSourceCode - the source code for this action
newTargetCode - the target code for this action
newOthersCode - the others/observed code for this action
allMessage - the source, target, and others string msg to send
Returns:
the CMMsg Object
See Also:
CMMsg.source(), CMMsg.target(), CMMsg.tool(), CMMsg.sourceCode(), CMMsg.targetCode(), CMMsg.othersCode(), CMMsg.sourceMessage()

getMsg

public static final CMMsg getMsg(MOB source,
                                 Environmental target,
                                 Environmental tool,
                                 int newAllCode,
                                 java.lang.String sourceMessage,
                                 java.lang.String targetMessage,
                                 java.lang.String othersMessage)
Creates and configures a CMMsg object for use in the game

Parameters:
source - the agent source of the action
target - the target of the action
tool - the tool used by the source to do the action
newAllCode - the source, target, and others code to use
sourceMessage - the action/message as seen by the source
targetMessage - the action/message as seen by the target
othersMessage - the action/message as seen by everyone else
Returns:
the CMMsg Object
See Also:
CMMsg.source(), CMMsg.target(), CMMsg.tool(), CMMsg.sourceCode(), CMMsg.sourceMessage(), CMMsg.targetMessage(), CMMsg.othersMessage()

getMsg

public static final CMMsg getMsg(MOB source,
                                 Environmental target,
                                 Environmental tool,
                                 int newSourceCode,
                                 java.lang.String sourceMessage,
                                 int newTargetCode,
                                 java.lang.String targetMessage,
                                 int newOthersCode,
                                 java.lang.String othersMessage)
Creates and configures a CMMsg object for use in the game

Parameters:
source - the agent source of the action
target - the target of the action
tool - the tool used by the source to do the action
newSourceCode - the source code for this action
sourceMessage - the action/message as seen by the source
newTargetCode - the target code for this action
targetMessage - the action/message as seen by the target
newOthersCode - the others/observed code for this action
othersMessage - the action/message as seen by everyone else
Returns:
the CMMsg Object
See Also:
CMMsg.source(), CMMsg.target(), CMMsg.tool(), CMMsg.sourceCode(), CMMsg.targetCode(), CMMsg.othersCode(), CMMsg.sourceMessage(), CMMsg.targetMessage(), CMMsg.othersMessage()

returnMob

public static final boolean returnMob(MOB mob)
Factory mob objects are normally re-used, and this method is the recycle bin. If the mob were to have been garbage collected, it would get returned here anyway, but this is the nice way to get it done.

Parameters:
mob - the mob we are done using
Returns:
true if it was returned to the bin, and false if it was allowed to die

getFactoryMOB

public static final MOB getFactoryMOB()
Returns either a StdFactoryMOB object from the cache, if one is available, or makes a new one.

Returns:
a StdFactoryMOB object, ready to use.

getFactoryMOB

public static final MOB getFactoryMOB(java.lang.String name,
                                      int level,
                                      Room room)
Returns either a StdFactoryMOB object from the cache, if one is available, or makes a new one, giving him the name, level, and room location given.

Parameters:
name - the name to give the mob
level - the level to give the mob
room - the room to set the mobs location at
Returns:
a StdFactoryMOB object, ready to use.

shutdown

public static final void shutdown()
Unloads all the classes in this system. Why, I do not know.


unload

public final void unload()
Clears all the class sets in this loader. I don't know why.