FileDocCategorySizeDatePackage
GameParameters.javaAPI DocExample2620Tue Dec 12 18:58:40 GMT 2000bingo.game

GameParameters

public class GameParameters extends Parameters implements Constants

Fields Summary
private long
delay
private long
countDown
private int
maxPlayers
private int
maxCards
private String
delayName
private String
countDownName
private String
maxPlayersName
private String
maxCardsName
Constructors Summary
GameParameters()


     
        super("bingoServer.props", "BINGO Server Properties");
	getParameters();
    
Methods Summary
longgetCountDown()

	return countDown;
    
longgetDelay()

	return delay;
    
intgetMaxCards()

	return maxCards;
    
intgetMaxPlayers()

	return maxPlayers;
    
voidsetCountDown(long countDown)

	this.countDown = countDown;
	saveParameters();
    
protected voidsetDefaults(java.util.Properties defaults)

	defaults.put(delayName, new Long(delay/ONE_SECOND).toString());
	defaults.put(countDownName, new Long(countDown/ONE_SECOND).toString());
	defaults.put(maxPlayersName, new Integer(maxPlayers).toString());
	defaults.put(maxCardsName, new Integer(maxCards).toString());
    
voidsetDelay(long delay)

	this.delay = delay;
	saveParameters();
    
voidsetMaxCards(int maxCards)

	this.maxCards = maxCards;
	saveParameters();
    
voidsetMaxPlayers(int maxPlayers)

	this.maxPlayers = maxPlayers;
	saveParameters();
    
public java.lang.StringtoString()

        return "["
               + "delay=" + delay + ","
               + "countDown=" + countDown + ","
               + "maxPlayers=" + maxPlayers + ","
               + "maxCards=" + maxCards + "]";
    
protected voidupdatePropertiesFromSettings()

	properties.put(delayName, new Long(delay/ONE_SECOND).toString());
	properties.put(countDownName, new Long(countDown/ONE_SECOND).toString());
	properties.put(maxCardsName, new Integer(maxCards).toString());
	properties.put(maxPlayersName, new Integer(maxPlayers).toString());
    
protected voidupdateSettingsFromProperties()

	try {
	    delay = Long.parseLong(properties.getProperty(delayName)) * ONE_SECOND;
	    countDown = Long.parseLong(properties.getProperty(countDownName)) * ONE_SECOND;
	    maxPlayers = Integer.parseInt(properties.getProperty(maxPlayersName));
	    maxCards = Integer.parseInt(properties.getProperty(maxCardsName));
	} catch (NumberFormatException e) {
	    // we don't care if the property was of the wrong format,
	    // they've all got default values. So catch the exception
	    // and keep going.
	}