Help! I can’t figure out how to store a rather particular set of data.
An object in my system has properties. Each property has a value.
However, the value of each property can change based on a number of
“build axes”. There are an arbitrary number of orthogonal build axes,
none of which is more important than another. (However, if it’s needed,
I am happy to impose a particular ordering on them.)
Each build axis has a number of ‘notches’, or discrete values along the
axis. In addition to all the notches, there is one special notch named
“Master”. A value set in this notch is a fallback, default value if
other notches in the axis have no values.
So, for example, assume I’m talking about a Text object. One of it’s
properties is “textString”.
The system has two build axes: “Language” and “Rating”.
The “Language” axis has “French”, “English”, “German”, and “Jibbrish”
notches in addition to the Master notch. The “Rating” axis has “G”,
“PG”, “R”, and “X” values.
Here’s a monospace-font diagram of the values I want to store:
-------------------Language------------------------- Master English French German Jibbrish
R Master (yell) - - Ach! -
A G - Wow! Oh! - -
T PG - Holy Crap! Merde! - -
I R - Holy Shit! Mon Dieu! - -
N X [email protected]* - - XXX -
With the above, the textString property should have a value of “Ach!”
if the Language axis is set to German and the Rating axis is set to G,
PG, or R.
If the Rating is set to “X”, then the textString should be set to
“[email protected]*” regardless of the Language axis setting…except for if the
Language is set to German, in which case it should be “XXX”
If the Language is set to “Jibbrish”, then the value is “(yell)”,
except when the Rating is “X”.
If the Rating is set to “PG” and the Language is set to “English”, then
the textString value should be set to “Holy Crap!”. And so on for other
values that are explicitly set for all axis combinations.
Hopefully that example is clear enough to show that explicit values win
over master values.
So, how the heck would you store this sort of information? I mostly
don’t even care about speed.