DFDL-1634 provides support for simpleType uinons in Daffodil.
However, a union is still validated (in "limited" validation mode, or when dfdl:checkConstraints is called) by sequentially walking through the union members one by one.
When the union consists of enumerations, or ranges, or mixtures of only those two, then a faster mechanism is needed.
E.g., for a union that is just enumerations, the validation should take constant time, by using a hash/table lookup.
For a union of min/max ranges, some sort of decision tree that rapidly determines validity is required.
combinations of these are also possible. A common situation would be for the integer 0 to mean "No Statement", 1-25 are valid values that have some mathematical meaning, and 26-31 are illegal.
We want to express this like
In the above, the union containing the 25 enumeration simple types will be iterated with a loop that will go through all 25 possibles one by one. This needs to be improved to be a constant time dispatch.