com.planet_ink.coffee_mud.Common.interfaces
Interface CMIntegerGrouper

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

public interface CMIntegerGrouper
extends CMCommon

This class represents an efficient representation of a group of room numbers with optional xy grid coords. It maintains a compact list by ordering the digits and then tagging the groups without missing members.


Field Summary
static long GRID_FLAGL
          Whether this number denotes the beginning of a grouping.
static int NEXT_BITS
          a mask for room number values
static long NEXT_BITSL
          a mask for room number values
static int NEXT_FLAG
          Whether this number denotes the beginning of a grouping.
static long NEXT_FLAGL
          Whether this number denotes the beginning of a grouping.
 
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.
 boolean contains(long x)
          Returns whether this list contains the given coded room number.
 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
 int roomCount()
          The total number of digits represented by this grouping.
 java.lang.String text()
          This set of integers as a savable string.
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, ID, initializeClass, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

NEXT_FLAG

static final int NEXT_FLAG
Whether this number denotes the beginning of a grouping.

See Also:
Constant Field Values

NEXT_BITS

static final int NEXT_BITS
a mask for room number values

See Also:
Constant Field Values

NEXT_FLAGL

static final long NEXT_FLAGL
Whether this number denotes the beginning of a grouping.

See Also:
Constant Field Values

GRID_FLAGL

static final long GRID_FLAGL
Whether this number denotes the beginning of a grouping.

See Also:
Constant Field Values

NEXT_BITSL

static final long NEXT_BITSL
a mask for room number values

See Also:
Constant Field Values
Method Detail

text

java.lang.String text()
This set of integers as a savable string.

Returns:
this group as a string.

random

long random()
Return a random coded room number from this set.

Returns:
the random room number as coded long

allRoomNums

long[] allRoomNums()
Return all raw room numbers, with grid locales encoded.

Returns:
all of the room numbers

allPrimaryRoomNums

int[] allPrimaryRoomNums()
Return all primary raw room numbers.

Returns:
all of the room numbers

packedGridRoomNums

long[] packedGridRoomNums()
Return all packed grid room numbers, with grid locales encoded.

Returns:
all of the packed grid room numbers

packedRoomNums

int[] packedRoomNums()
Return all packed grid room numbers, with grid locales encoded.

Returns:
all of the packed grid room numbers

parseText

CMIntegerGrouper parseText(java.lang.String txt)
Creates a nice storage of integers from a saved string.

Parameters:
txt - the list as a string
Returns:
a populated grouping object

contains

boolean contains(long x)
Returns whether this list contains the given coded room number.

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

roomCount

int roomCount()
The total number of digits represented by this grouping.

Returns:
the number of room numbers herein.

remove

CMIntegerGrouper remove(long x)
Removes the room number

Parameters:
x - the coded digit pair to remove.
Returns:
the integrouper with the pair removed

add

CMIntegerGrouper add(long x)
Adds the room number

Parameters:
x - the coded digit pair to add.
Returns:
the integrouper with the pair added

remove

CMIntegerGrouper remove(CMIntegerGrouper grp)
Removes the room number

Parameters:
grp - the coded digit pair to remove.
Returns:
the integrouper with the pair removed

add

CMIntegerGrouper add(CMIntegerGrouper grp)
Adds a group of room numbers

Parameters:
grp - the coded digit pairs to add.
Returns:
the integrouper with the pair added

addy

void addy(long x)
Adds the single digit

Parameters:
x - the single digit to add.

addx

void addx(int x)
Adds the single digit

Parameters:
x - the single digit to add.