UDice - the Universal Dice System by sad2project

OutputRange

OutputRange is one of the lowest-level classes used in the project, aside from Ranges, which just hold an inclusive range of integers.

OutputRanges are used in Relationships so that they can know what to output when a certain value comes in. As you may be able to tell, OutputRanges are essentially just a range with an output (just a String for now, but it may evolve to allow for other output types). It takes in an integer value and returns the output that corresponds to that value.

You can set up the output to be dynamic or static. A static output will be the same no matter what value you give to the OutputRange (unless you give a value that's not in the range). A dynamic output will put the given value into the string wherever you put the placeholder. By default, the placeholder is _, but you can set the placeholder to whatever character you like during the object's creation.

As an example of dynamic output, we could look at the OutputRange for the typical numeric die. You give the OutputRange a range that covers the entire available spectrum of numbers, and you set the output to be "_". This will make it so that any value is allowed, and the output will simply be that value.

As mentioned before, OutputRanges are the building blocks of Relationships, where every value has one and only one OutputRange. You should check out Relationships to find out more about that.

The Individual Pieces of the Dice Model:
Dice Set
Die
Face
Face Value
Relationship
Output Range