com.planet_ink.coffee_mud.Common
Class DefaultCMIntegerGrouper

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

public class DefaultCMIntegerGrouper
extends java.lang.Object
implements CMIntegerGrouper


Field Summary
 int[] xs
           
 long[] ys
           
 
Fields inherited from interface com.planet_ink.coffee_mud.Common.interfaces.CMIntegerGrouper
GRID_FLAGL, NEXT_BITS, NEXT_BITSL, NEXT_FLAG, NEXT_FLAGL
 
Constructor Summary
DefaultCMIntegerGrouper()
           
 
Method Summary
 CMIntegerGrouper add(CMIntegerGrouper grp)
          Adds a group of room numbers
 CMIntegerGrouper add(long x)
          Adds the room number
 void addx(int x)
          Adds the single digit
 void addy(long x)
          Adds the single digit
 int[] allPrimaryRoomNums()
          Return all primary raw room numbers.
 long[] allRoomNums()
          Return all raw room numbers, with grid locales encoded.
 int compareTo(CMObject o)
           
 void consolodatex()
           
 void consolodatey()
           
 boolean contains(long x)
          Returns whether this list contains the given coded room number.
 CMObject copyOf()
          Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed.
 int getXindex(int x)
           
 int getYindex(long y)
           
 void growarrayx(int here, int amount)
           
 void growarrayy(int here, int amount)
           
 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.
 CMObject newInstance()
          Returns a new instance of this class.
 long[] packedGridRoomNums()
          Return all packed grid room numbers, with grid locales encoded.
 int[] packedRoomNums()
          Return all packed grid room numbers, with grid locales encoded.
 CMIntegerGrouper parseText(java.lang.String txt)
          Creates a nice storage of integers from a saved string.
 long random()
          Return a random coded room number from this set.
 CMIntegerGrouper remove(CMIntegerGrouper grp)
          Removes the room number
 CMIntegerGrouper remove(long x)
          Removes the room number
 void removex(int x)
           
 void removey(long x)
           
 int roomCount()
          The total number of digits represented by this grouping.
 void shrinkarrayx(int here, int amount)
           
 void shrinkarrayy(int here, int amount)
           
 java.lang.String text()
          This set of integers as a savable string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xs

public int[] xs

ys

public long[] ys
Constructor Detail

DefaultCMIntegerGrouper

public DefaultCMIntegerGrouper()
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, MiscTech. The name is typically identical to the class name.

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

compareTo

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

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

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

text

public java.lang.String text()
Description copied from interface: CMIntegerGrouper
This set of integers as a savable string.

Specified by:
text in interface CMIntegerGrouper
Returns:
this group as a string.

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

parseText

public CMIntegerGrouper parseText(java.lang.String txt)
Description copied from interface: CMIntegerGrouper
Creates a nice storage of integers from a saved string.

Specified by:
parseText in interface CMIntegerGrouper
Parameters:
txt - the list as a string
Returns:
a populated grouping object

packedGridRoomNums

public long[] packedGridRoomNums()
Description copied from interface: CMIntegerGrouper
Return all packed grid room numbers, with grid locales encoded.

Specified by:
packedGridRoomNums in interface CMIntegerGrouper
Returns:
all of the packed grid room numbers

packedRoomNums

public int[] packedRoomNums()
Description copied from interface: CMIntegerGrouper
Return all packed grid room numbers, with grid locales encoded.

Specified by:
packedRoomNums in interface CMIntegerGrouper
Returns:
all of the packed grid room numbers

contains

public boolean contains(long x)
Description copied from interface: CMIntegerGrouper
Returns whether this list contains the given coded room number.

Specified by:
contains in interface CMIntegerGrouper
Parameters:
x - the number to look for, coded as a room number
Returns:
whether x is in this grouping.

getXindex

public int getXindex(int x)

getYindex

public int getYindex(long y)

allPrimaryRoomNums

public int[] allPrimaryRoomNums()
Description copied from interface: CMIntegerGrouper
Return all primary raw room numbers.

Specified by:
allPrimaryRoomNums in interface CMIntegerGrouper
Returns:
all of the room numbers

allRoomNums

public long[] allRoomNums()
Description copied from interface: CMIntegerGrouper
Return all raw room numbers, with grid locales encoded.

Specified by:
allRoomNums in interface CMIntegerGrouper
Returns:
all of the room numbers

roomCount

public int roomCount()
Description copied from interface: CMIntegerGrouper
The total number of digits represented by this grouping.

Specified by:
roomCount in interface CMIntegerGrouper
Returns:
the number of room numbers herein.

random

public long random()
Description copied from interface: CMIntegerGrouper
Return a random coded room number from this set.

Specified by:
random in interface CMIntegerGrouper
Returns:
the random room number as coded long

growarrayx

public void growarrayx(int here,
                       int amount)

growarrayy

public void growarrayy(int here,
                       int amount)

remove

public CMIntegerGrouper remove(long x)
Description copied from interface: CMIntegerGrouper
Removes the room number

Specified by:
remove in interface CMIntegerGrouper
Parameters:
x - the coded digit pair to remove.
Returns:
the integrouper with the pair removed

remove

public CMIntegerGrouper remove(CMIntegerGrouper grp)
Description copied from interface: CMIntegerGrouper
Removes the room number

Specified by:
remove in interface CMIntegerGrouper
Parameters:
grp - the coded digit pair to remove.
Returns:
the integrouper with the pair removed

shrinkarrayx

public void shrinkarrayx(int here,
                         int amount)

shrinkarrayy

public void shrinkarrayy(int here,
                         int amount)

consolodatex

public void consolodatex()

consolodatey

public void consolodatey()

add

public CMIntegerGrouper add(CMIntegerGrouper grp)
Description copied from interface: CMIntegerGrouper
Adds a group of room numbers

Specified by:
add in interface CMIntegerGrouper
Parameters:
grp - the coded digit pairs to add.
Returns:
the integrouper with the pair added

add

public CMIntegerGrouper add(long x)
Description copied from interface: CMIntegerGrouper
Adds the room number

Specified by:
add in interface CMIntegerGrouper
Parameters:
x - the coded digit pair to add.
Returns:
the integrouper with the pair added

addy

public void addy(long x)
Description copied from interface: CMIntegerGrouper
Adds the single digit

Specified by:
addy in interface CMIntegerGrouper
Parameters:
x - the single digit to add.

addx

public void addx(int x)
Description copied from interface: CMIntegerGrouper
Adds the single digit

Specified by:
addx in interface CMIntegerGrouper
Parameters:
x - the single digit to add.

removey

public void removey(long x)

removex

public void removex(int x)