com.planet_ink.coffee_mud.Common
Class DefaultRoomnumberSet

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

public class DefaultRoomnumberSet
extends java.lang.Object
implements RoomnumberSet


Field Summary
 STreeMap<java.lang.String,LongSet> root
           
 
Constructor Summary
DefaultRoomnumberSet()
           
 
Method Summary
 void add(RoomnumberSet set)
          Adds a set of room ids to this object
 void add(java.lang.String str)
          Adds the given room id to this object
 int compareTo(CMObject o)
           
 boolean contains(java.lang.String str)
          Returns whether the given room id is stored here
 int[] convertRoomID(long coded)
           
 java.lang.String convertRoomID(java.lang.String prefix, long coded)
           
 CMObject copyOf()
          Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed.
 java.util.Iterator<java.lang.String> getAreaNames()
          Returns an enumerator for all area names in this object
 LongSet getGrouper(java.lang.String areaName)
          Returns the number parts of the room ids stored in this object for a given area.
 java.util.Enumeration<java.lang.String> getRoomIDs()
          Returns an enumerator for all room ids in this object
 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 isEmpty()
          Returns whether any rooms at all are defined.
 java.lang.String name()
          The displayable name of this object.
 CMObject newInstance()
          Returns a new instance of this class.
 void parseXML(java.lang.String xml)
          Restores this object from an xml document
 java.lang.String random()
          Returns a random, fully qualified room id from those stored in here.
 void remove(java.lang.String str)
          Removes a single room id from this object
 int roomCount(java.lang.String areaName)
          Returns the number of room ids stored for the given Area name.
 int roomCountAllAreas()
          Returns the total number of room ids stored here
 java.lang.String xml()
          Converts the contents of this object into an xml document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

public STreeMap<java.lang.String,LongSet> root
Constructor Detail

DefaultRoomnumberSet

public DefaultRoomnumberSet()
Method Detail

ID

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

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

name

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

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

compareTo

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

newInstance

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

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

initializeClass

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

Specified by:
initializeClass in interface CMObject

copyOf

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

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

add

public void add(RoomnumberSet set)
Description copied from interface: RoomnumberSet
Adds a set of room ids to this object

Specified by:
add in interface RoomnumberSet
Parameters:
set - the room ids to add

remove

public void remove(java.lang.String str)
Description copied from interface: RoomnumberSet
Removes a single room id from this object

Specified by:
remove in interface RoomnumberSet
Parameters:
str - the room id to remove from this object

roomCountAllAreas

public int roomCountAllAreas()
Description copied from interface: RoomnumberSet
Returns the total number of room ids stored here

Specified by:
roomCountAllAreas in interface RoomnumberSet
Returns:
the total number of room ids stored here

isEmpty

public boolean isEmpty()
Description copied from interface: RoomnumberSet
Returns whether any rooms at all are defined.

Specified by:
isEmpty in interface RoomnumberSet
Returns:
true if none are defined, false otherwise

roomCount

public int roomCount(java.lang.String areaName)
Description copied from interface: RoomnumberSet
Returns the number of room ids stored for the given Area name.

Specified by:
roomCount in interface RoomnumberSet
Parameters:
areaName - the Area to count the rooms of
Returns:
the number of room ids in the area

random

public java.lang.String random()
Description copied from interface: RoomnumberSet
Returns a random, fully qualified room id from those stored in here. Includes Area name.

Specified by:
random in interface RoomnumberSet
Returns:
a random full room id

convertRoomID

public int[] convertRoomID(long coded)

convertRoomID

public java.lang.String convertRoomID(java.lang.String prefix,
                                      long coded)

getAreaNames

public java.util.Iterator<java.lang.String> getAreaNames()
Description copied from interface: RoomnumberSet
Returns an enumerator for all area names in this object

Specified by:
getAreaNames in interface RoomnumberSet
Returns:
an enumerator for all area names in this object

getGrouper

public LongSet getGrouper(java.lang.String areaName)
Description copied from interface: RoomnumberSet
Returns the number parts of the room ids stored in this object for a given area.

Specified by:
getGrouper in interface RoomnumberSet
Parameters:
areaName - the area name to look for
Returns:
a set of numbers.
See Also:
LongSet

contains

public boolean contains(java.lang.String str)
Description copied from interface: RoomnumberSet
Returns whether the given room id is stored here

Specified by:
contains in interface RoomnumberSet
Parameters:
str - the room id to look for
Returns:
true if the given room id is stored here

xml

public java.lang.String xml()
Description copied from interface: RoomnumberSet
Converts the contents of this object into an xml document.

Specified by:
xml in interface RoomnumberSet
Returns:
the contents of this object as an xml

parseXML

public void parseXML(java.lang.String xml)
Description copied from interface: RoomnumberSet
Restores this object from an xml document

Specified by:
parseXML in interface RoomnumberSet
Parameters:
xml - contents for this object as an xml

add

public void add(java.lang.String str)
Description copied from interface: RoomnumberSet
Adds the given room id to this object

Specified by:
add in interface RoomnumberSet
Parameters:
str - a room id

getRoomIDs

public java.util.Enumeration<java.lang.String> getRoomIDs()
Description copied from interface: RoomnumberSet
Returns an enumerator for all room ids in this object

Specified by:
getRoomIDs in interface RoomnumberSet
Returns:
an enumerator for all room ids in this object