ikegami, thank you for your response. I will try to answer your questions.
I am sorry my code did not work for you. I diffed it against the code on my system and it is working for me. I can offer no explanation for this behavior.
I apologize for not being more forthcoming with my requirements. I had hoped that the example I provided would be enough.
This is essentially an “order of operations” problem. The three operations I have are And, Or, and Not. And I basically want to build a tree that will let me handle the terms in order based on the precedence provided by parenthesis with the And and Or at the same level and Not being a little higher. (I know Not is not in my original code, but I was starting small) Take the below generic statement.
(term1) and (term2) and ((term3) or (term4)) and not (term5))
I would like to boil this down into an array I can traverse bottom up getting to the innermost terms first.
So first resolve term3 or term 4
Then resolve the results vs. not term5
Then resolve the results vs term 2 and term 1
I figured traversing a tree structure would be the fastest way to do this but I am open to suggestions.
|