net.sourceforge.rpgee.dice
Interface GeneratedRandomValueMapper

All Superinterfaces:
Describable, Identified

public interface GeneratedRandomValueMapper
extends Identified, Describable

A mapper for GeneratedRandomValues. One such use would be to map a Hand of Cards to a poker hand. This could be represented by both a string ("Royal Flush", "2 Aces") or a number (150, 75). In that instance, it would be reasonable to compare the results of two different mappings to determine which was "better" or "bigger" An entirely different use might be to map all of a generated result's rolls against some arbitrary "target number" to see if a "success" was indicated. These classes are almost always specific to a particular type of GeneratedRandomValue. It might be best to keep them as private inner classes to the various GeneratedRandomValues and make them available only with a factory call on that value.

Author:
Mykel

Field Summary
 
Fields inherited from interface net.sourceforge.rpgee.Identified
ID
 
Fields inherited from interface net.sourceforge.rpgee.Describable
CODE_FOOTER, CODE_HEADER
 
Method Summary
 int getNumericValueForGeneratedRandomValue(GeneratedRandomValue v, java.lang.Object mappingData)
          Generate a numeric value, usually ordinal according to weight, for the GeneratedRandomValue and any attendant data passed in as mapping data.
 int getStringValueForGeneratedRandomValue(GeneratedRandomValue v, java.lang.Object mappingData)
          Generate a string value for the GeneratedRandomValue and any attendant data passed in as mapping data.
 boolean isMappingDataRequired()
           
 boolean supports(java.lang.Class c)
          Returns true if this mapper supports the specified class
 
Methods inherited from interface net.sourceforge.rpgee.Identified
getId, getIdAsString
 
Methods inherited from interface net.sourceforge.rpgee.Describable
getDescription, getHTMLDescription
 

Method Detail

getNumericValueForGeneratedRandomValue

int getNumericValueForGeneratedRandomValue(GeneratedRandomValue v,
                                           java.lang.Object mappingData)
                                           throws InvalidParameterException
Generate a numeric value, usually ordinal according to weight, for the GeneratedRandomValue and any attendant data passed in as mapping data. MappingData could be a GameMapModel of parameters, or an Integer or some other thingie.

Parameters:
v - A GeneratedRandomValue
mappingData - An arbitrary, and optional, parameter for use by the call
Returns:
Some integer representation of the GeneratedRandomValue
Throws:
InvalidParameterException - if the Value or the Mapping data isnot of the correct type

getStringValueForGeneratedRandomValue

int getStringValueForGeneratedRandomValue(GeneratedRandomValue v,
                                          java.lang.Object mappingData)
                                          throws InvalidParameterException
Generate a string value for the GeneratedRandomValue and any attendant data passed in as mapping data. MappingData could be a GameMapModel of parameters, or an Integer or some other thingie.

Parameters:
v - A GeneratedRandomValue
mappingData - An arbitrary, and optional, parameter for use by the call
Returns:
Some String representation of the GeneratedRandomValue
Throws:
InvalidParameterException - if the Value or the Mapping data isnot of the correct type

supports

boolean supports(java.lang.Class c)
Returns true if this mapper supports the specified class

Parameters:
c -
Returns:

isMappingDataRequired

boolean isMappingDataRequired()
Returns:
true if the mappingData parameter is NOT optional


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