ItMayBeAHack OOD Exercises
An exercise in OOD as guided by ItMayBeAHack.com.
Public Member Functions | List of all members
Roulette.Wheel Class Reference

Responsible for: More...

Public Member Functions

 Wheel (IBinBuilder binBuilder=null, int binSize=38, int rngSeed=int.MinValue)
 Constructs a new wheel, sets its random number generator, and has bin builder fill this wheel's bins. More...
 
int GetBinSize ()
 Gets the size of the bins array. More...
 
void AddOutcomeToBin (int index, Outcome outcome)
 Adds an outcome to the 'bins' array at the specified index. More...
 
Bin GetRandomBin ()
 Gets a random bin from the bins array based on the random number generator. More...
 
Bin GetBinAtIndex (int index)
 Returns a Bin at a specific index. For testing purposes. More...
 
Outcome GetOutcome (string name)
 Retrieves outcome from the outcome dictionary by name. More...
 

Detailed Description

Responsible for:

Constructor & Destructor Documentation

Roulette.Wheel.Wheel ( IBinBuilder  binBuilder = null,
int  binSize = 38,
int  rngSeed = int.MinValue 
)

Constructs a new wheel, sets its random number generator, and has bin builder fill this wheel's bins.

Parameters
binBuilderShould only be null for testing. The BinBuilder that will fill the wheel's bins.
binSizeOptional, default is 38 bins.
rngSeedShould only be set when testing.

Member Function Documentation

void Roulette.Wheel.AddOutcomeToBin ( int  index,
Outcome  outcome 
)

Adds an outcome to the 'bins' array at the specified index.

Parameters
indexIndex to set the outcome at.
outcomeThe outcome to set.
Bin Roulette.Wheel.GetBinAtIndex ( int  index)

Returns a Bin at a specific index. For testing purposes.

Parameters
indexThe index of the bin to retrieve.
Returns
A Bin from the 'bin' array.
int Roulette.Wheel.GetBinSize ( )

Gets the size of the bins array.

Returns
Size of the bins array.
Outcome Roulette.Wheel.GetOutcome ( string  name)

Retrieves outcome from the outcome dictionary by name.

Parameters
nameName of the outcome.
Returns
An outcome if found otherwise null.
Bin Roulette.Wheel.GetRandomBin ( )

Gets a random bin from the bins array based on the random number generator.

Returns
A random bin.

The documentation for this class was generated from the following file: