com.planet_ink.coffee_mud.Common.interfaces
Interface RoomnumberSet

All Superinterfaces:
java.lang.Cloneable, CMCommon, CMObject, java.lang.Comparable<CMObject>
All Known Implementing Classes:
DefaultRoomnumberSet

public interface RoomnumberSet
extends CMCommon

A class for holding CoffeeMud-style room IDs of the form AreaName#[NUMBER], for instance, Midgaard#3001 This class is totally awesome because it stores them in an efficient way (holding room ids 5-10 not as 5,6,7,8,9,10, but as 5,10), but sorts them for quick reads. Stores the internal numbers using LongSet

See Also:
LongSet

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
 boolean contains(java.lang.String str)
          Returns whether the given room id is stored here
 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
 boolean isEmpty()
          Returns whether any rooms at all are defined.
 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 interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, ID, initializeClass, name, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

roomCount

int roomCount(java.lang.String areaName)
Returns the number of room ids stored for the given Area name.

Parameters:
areaName - the Area to count the rooms of
Returns:
the number of room ids in the area

roomCountAllAreas

int roomCountAllAreas()
Returns the total number of room ids stored here

Returns:
the total number of room ids stored here

isEmpty

boolean isEmpty()
Returns whether any rooms at all are defined.

Returns:
true if none are defined, false otherwise

contains

boolean contains(java.lang.String str)
Returns whether the given room id is stored here

Parameters:
str - the room id to look for
Returns:
true if the given room id is stored here

xml

java.lang.String xml()
Converts the contents of this object into an xml document.

Returns:
the contents of this object as an xml

parseXML

void parseXML(java.lang.String xml)
Restores this object from an xml document

Parameters:
xml - contents for this object as an xml

add

void add(java.lang.String str)
Adds the given room id to this object

Parameters:
str - a room id

add

void add(RoomnumberSet set)
Adds a set of room ids to this object

Parameters:
set - the room ids to add

remove

void remove(java.lang.String str)
Removes a single room id from this object

Parameters:
str - the room id to remove from this object

random

java.lang.String random()
Returns a random, fully qualified room id from those stored in here. Includes Area name.

Returns:
a random full room id

getRoomIDs

java.util.Enumeration<java.lang.String> getRoomIDs()
Returns an enumerator for all room ids in this object

Returns:
an enumerator for all room ids in this object

getAreaNames

java.util.Iterator<java.lang.String> getAreaNames()
Returns an enumerator for all area names in this object

Returns:
an enumerator for all area names in this object

getGrouper

LongSet getGrouper(java.lang.String areaName)
Returns the number parts of the room ids stored in this object for a given area.

Parameters:
areaName - the area name to look for
Returns:
a set of numbers.
See Also:
LongSet