megamek.common
Class Roll

java.lang.Object
  extended by megamek.common.Roll
Direct Known Subclasses:
MMRoll, MMShuffle

public abstract class Roll
extends java.lang.Object

Encapsulate all information known about a requested roll. This information can be logged for full statistical analysis and auditing, so hopefully people will finally stop questioning whether the RNG is any good.

Author:
Suvarov454

Field Summary
protected  int faces
          The number of faces on each virtual die.
protected  long id
          The unique identifier for this roll.
protected  int min
          The lowest value on each virtual die.
 
Constructor Summary
protected Roll(int count, int start)
          Store the configuration information for this roll.
 
Method Summary
abstract  int getIntValue()
          Get the value of the roll.
abstract  java.lang.String getReport()
          Get a String report that can be parsed to analyse the roll.
protected static void output(Roll roll)
          Formats Roll output for test harnesses.
abstract  java.lang.String toString()
          Get a String containing the roll for each of the virtual dice.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected final long id
The unique identifier for this roll.


faces

protected final int faces
The number of faces on each virtual die.


min

protected final int min
The lowest value on each virtual die.

Constructor Detail

Roll

protected Roll(int count,
               int start)
Store the configuration information for this roll.

Parameters:
count - - the int number of results possible on each virtual die.
start - - the int value that is the start of the value set of each virtual die.
Method Detail

getIntValue

public abstract int getIntValue()
Get the value of the roll. This is the total of each of the rolls of each virtual die.

Returns:
the int value of the roll.

toString

public abstract java.lang.String toString()
Get a String containing the roll for each of the virtual dice.

Overrides:
toString in class java.lang.Object
Returns:
the String value of the roll.

getReport

public abstract java.lang.String getReport()
Get a String report that can be parsed to analyse the roll.

Returns:
the String details of the roll.

output

protected static void output(Roll roll)
Formats Roll output for test harnesses.

Parameters:
roll - - the Roll to be reported.