net.sourceforge.rpgee.dice
Interface RandomValueGenerator

All Superinterfaces:
Describable
All Known Implementing Classes:
AbstractRandomValueGenerator

public interface RandomValueGenerator
extends Describable


Field Summary
static java.lang.String DICE_MAPPING_CLASS
          The setting (see setSetting below) that is potentially used in the generateRandomness call.
static java.lang.String DIE_HANDLING_CLASS
           
 
Fields inherited from interface net.sourceforge.rpgee.Describable
CODE_FOOTER, CODE_HEADER
 
Method Summary
 void addRandomValueHandler(RandomValueHandler handler)
          Add A new RandomValueHandler to the list of handlers for this roller
 void generateRandomness()
          Reset the "randomness" factor for a RandomValueGenerator.
 java.util.List<RandomValueHandler> getRandomValueHandlers()
           
 RandomValueResultMapper getRandomValueResultMapper()
          Returns the local result mapper
 java.lang.String getRandomValuesAsString(java.util.List<RandomValue> roll)
          GameMapModel the dice rolls in roll with a mapper if available
 java.lang.Object getSetting(java.lang.String key)
          Returns the internal map of settings used by the "roll" call
 java.lang.String[] getSettings()
          Get a list of available settings
 GeneratedRandomValue produceGeneratedRandomValue(java.lang.String d)
          Produces a DiceEvaluation
 void require(java.lang.Object requirement)
          Submit some value that is required before a roll can continue.
 void setRandomnessFactor(java.lang.Object o)
           
 void setRandomValueHandlers(java.util.List<RandomValueHandler> handlers)
          Set the DieHandlers for this Roller.
 void setRandomValueResultMapper(RandomValueResultMapper mapper)
          Set the code that maps values in die rolls to result strings.
 void setSetting(java.lang.String setting, java.lang.Object value)
          Sets a setting in the internal settings map to the given value.
 
Methods inherited from interface net.sourceforge.rpgee.Describable
getDescription, getHTMLDescription
 

Field Detail

DICE_MAPPING_CLASS

static final java.lang.String DICE_MAPPING_CLASS
The setting (see setSetting below) that is potentially used in the generateRandomness call.

See Also:
Constant Field Values

DIE_HANDLING_CLASS

static final java.lang.String DIE_HANDLING_CLASS
See Also:
Constant Field Values
Method Detail

getSetting

java.lang.Object getSetting(java.lang.String key)
Returns the internal map of settings used by the "roll" call

Returns:

getSettings

java.lang.String[] getSettings()
Get a list of available settings

Returns:

setSetting

void setSetting(java.lang.String setting,
                java.lang.Object value)
                throws InvalidParameterException
Sets a setting in the internal settings map to the given value.

Parameters:
setting - String name of the setting
value - Object value to set the setting to
Throws:
InvalidParameterException

produceGeneratedRandomValue

GeneratedRandomValue produceGeneratedRandomValue(java.lang.String d)
                                                 throws RandomValueException
Produces a DiceEvaluation

Parameters:
d -
Returns:
Throws:
RandomValueException

generateRandomness

void generateRandomness()
                        throws RandomValueException
Reset the "randomness" factor for a RandomValueGenerator. For instance, getting a new Random object with a new seed or shuffling a deck of cards.

Throws:
RandomValueException

setRandomValueResultMapper

void setRandomValueResultMapper(RandomValueResultMapper mapper)
Set the code that maps values in die rolls to result strings.

Parameters:
mapper - The RandomValueResultMapper to map to, or null to use the basic RandomValue's output

getRandomValuesAsString

java.lang.String getRandomValuesAsString(java.util.List<RandomValue> roll)
                                         throws RandomValueException
GameMapModel the dice rolls in roll with a mapper if available

Parameters:
GeneratedRandomValue -
Returns:
String representation of the dice rolled
Throws:
MappingException
RandomValueException

getRandomValueResultMapper

RandomValueResultMapper getRandomValueResultMapper()
Returns the local result mapper

Returns:
Result mapper

getRandomValueHandlers

java.util.List<RandomValueHandler> getRandomValueHandlers()

setRandomValueHandlers

void setRandomValueHandlers(java.util.List<RandomValueHandler> handlers)
Set the DieHandlers for this Roller. Die handlers manage the effect of an individual die and are allowed to transform the value rolled by the randomizer into a new value before display.

Parameters:
handler - The RandomValueHandler to use for this randmizer

addRandomValueHandler

void addRandomValueHandler(RandomValueHandler handler)
Add A new RandomValueHandler to the list of handlers for this roller

Parameters:
handler - RandomValueHandler to add

require

void require(java.lang.Object requirement)
             throws RandomValueException
Submit some value that is required before a roll can continue. For a deck, this is probably the "minimum number of cards remaining". For some other randomizer, it might be a "minumum randomness". This is purely implementation dependent. For randomizers that don't need this, like dice rollers, an empty implementation is fine.

Parameters:
requirement - Some object passed to this function to determine a randomness factor
Throws:
RandomValueException

setRandomnessFactor

void setRandomnessFactor(java.lang.Object o)


Copyright © 2006 An Infinite Number of Monkeys. All Rights Reserved.