Let's say I have three items, each with descendents...
X
- X1
- X2
-- X2A
-- X2B
- X3
Y
- Y1
-- Y1A
-- Y1B
- Y2
- Y3
Z
- Z1
- Z2
- Z3
-- Z3A
-- Z3B
Let's also say there are rules for the value of A depending on different combinations of these items. Each rule applies to an item's descendents unless there is another rule to supersede.
For this example our rules are:
For case X-Y-Z, A=1
For case X2-Y-Z, A=2
For case X2-Y1-Z3, A=3
So, for a combination of X2A-Y3-Z1, the rules determine that A=2.
I could loop through every single combination of items and save the corresponding values. But if instead of 3 item families there are 10 or 20 families, the number of combinations will be huge. And each time there is a rule change the list of values will need to be regenerated.
Is there a better approach for determining the value for a specific case?
X
- X1
- X2
-- X2A
-- X2B
- X3
Y
- Y1
-- Y1A
-- Y1B
- Y2
- Y3
Z
- Z1
- Z2
- Z3
-- Z3A
-- Z3B
Let's also say there are rules for the value of A depending on different combinations of these items. Each rule applies to an item's descendents unless there is another rule to supersede.
For this example our rules are:
For case X-Y-Z, A=1
For case X2-Y-Z, A=2
For case X2-Y1-Z3, A=3
So, for a combination of X2A-Y3-Z1, the rules determine that A=2.
I could loop through every single combination of items and save the corresponding values. But if instead of 3 item families there are 10 or 20 families, the number of combinations will be huge. And each time there is a rule change the list of values will need to be regenerated.
Is there a better approach for determining the value for a specific case?