ggz.common
Class NumberList

java.lang.Object
  extended by ggz.common.NumberList

public class NumberList
extends java.lang.Object

This class provides a method for storing and retrieving a simple list of positive integers. The list must follow a very restrictive form: each value within [1..32] may be included explicitly in the list. Higher values may only be included as the part of a single given range [x..y]. This provides GGZ-specific functionality that is common to some or all of the ggz-server, game-server, ggz-client, and game-client.


Constructor Summary
NumberList()
          Creates an empty number list.
 
Method Summary
 int get_max()
           
 int get_min()
           
 boolean isset(int value)
          Checks to see if the given value is set in the number list.
static NumberList read(java.lang.String text)
          Reads a number list from a text string.
 java.lang.String write()
          Writes a number list to a text string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberList

public NumberList()
Creates an empty number list.

Method Detail

read

public static NumberList read(java.lang.String text)
Reads a number list from a text string. The string is comprised of a list of values (in the range 1..32) separated by spaces, followed by an optional range (separated by ".."). Examples: "2 3 4", "2..4", "1..1000", "2, 3, 10 15-50"


write

public java.lang.String write()
Writes a number list to a text string.


isset

public boolean isset(int value)
Checks to see if the given value is set in the number list.


get_min

public int get_min()
Returns:
the smallest value in the set.

get_max

public int get_max()
Returns:
the largest value in the set.