OutputRange
is one of the lowest-level classes used in the project, aside from Range
s, which just hold an inclusive range of integers.
OutputRange
s are used in Relationship
s so that they can know what to output when a certain value comes in. As you may be able to tell, OutputRange
s 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, OutputRange
s are the building blocks of Relationship
s, where every value has one and only one OutputRange
. You should check out Relationship
s to find out more about that.