megamek.common
Class MMRoll

java.lang.Object
  extended by megamek.common.Roll
      extended by megamek.common.MMRoll

public class MMRoll
extends Roll

Subclass of the roll tracker for MMRandom entropy sources.

Author:
Suvarov454

Field Summary
 
Fields inherited from class megamek.common.Roll
faces, id, min
 
Constructor Summary
MMRoll(MMRandom rng)
          Most tolls use standard six sided dice.
MMRoll(MMRandom rng, int max)
          Most other rolls have a minimum value of zero.
MMRoll(MMRandom rng, int count, int start)
          Create a set of virtual dice with the given number of faces that start with the given value.
 
Method Summary
 void addRoll(MMRandom rng)
          Add the result from the given RNG source.
 int getIntValue()
          Get the value of the roll.
 java.lang.String getReport()
          Get a String report that can be parsed to analyse the roll.
static void main(java.lang.String[] args)
          Test harness for this class.
 java.lang.String toString()
          Get a String containing the roll for each of the virtual dice.
 
Methods inherited from class megamek.common.Roll
output
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MMRoll

public MMRoll(MMRandom rng)
Most tolls use standard six sided dice.

Parameters:
rng - - the MMRandom that produces random numbers.

MMRoll

public MMRoll(MMRandom rng,
              int max)
Most other rolls have a minimum value of zero.

Parameters:
rng - - the MMRandom that produces random numbers.
max - - the smallest int value that is higher than all rolls; all rolls will be in the value set [0, max).

MMRoll

public MMRoll(MMRandom rng,
              int count,
              int start)
Create a set of virtual dice with the given number of faces that start with the given value.

Parameters:
rng - - the MMRandom that produces random numbers.
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

addRoll

public void addRoll(MMRandom rng)
Add the result from the given RNG source.

Parameters:
rng - - the MMRandom that produces random numbers.

getIntValue

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

Specified by:
getIntValue in class Roll
Returns:
the int value of the roll.

toString

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

Specified by:
toString in class Roll
Returns:
the String value of the roll.

getReport

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

Specified by:
getReport in class Roll
Returns:
the String details of the roll.

main

public static void main(java.lang.String[] args)
Test harness for this class.

Parameters:
args - - the array of String arguments: first is the number of rolls (defaults to two), second is number of sides (defaults to six sides), third is the starting number (defaults to one for six sided dice, zero for anything else).