EPANET
EPANET copied to clipboard
Add option for rule operator precedence
Implements https://github.com/OpenWaterAnalytics/EPANET/issues/844. Due to the lack of response to the question raised in the issue, I've temporarily placed this flag in the top-level struct Project.
The evalpremises function has been refactored, compared to the draft in the issue. Now it uses the same implementation as the one in Wikipedia. Hopefully this refactoring won't change behaviors with established programs or break compatibility with existing inp files.
TODO:
- [ ] Add tests
- [ ] Unify the abbreviation for “rule operator precedence” throughout the code base?
Currently, 1.
OPERATOR PRECEDENCE(withoutRULES), 2.RULE_OP_PREC, 3.R_PREC, 4.OpPrecare used. - [ ] Add the third possible precedence?
The third type of operator precedence is that,
ANDandORhave the same priority. In this case, associativity rules determine the order of evaluation, so the whole premise simply evaluated from left to right. Would anyone really want to use it?