public class AndAboveProxTransformer
extends NodeVisitor
Ensure that And/FuzzyAnd are always above PROX nodes.
This is to avoid the following: (Mercury:#11006)
BEFORE
/ \
"a" AND
/ \
"b" "c"
We do not return :
"b c a" because neither "b" nor "c" are after "a" (OK)
We return:
"a b c" (OK)
"b a c" because "a" is before "c" (NOK)
"c a b" (NOK)
This is transformed to:
AND
/ \
BEFORE BEFORE
/ \ / \
"a" "b" "a" "c"
In addition, we must ensure that NOT nodes are also placed above BEFORE,
except that there can only be one NOT under a BEFORE, else results are not guaranteed
(NOT a) BEFORE b -> NOT (a before b)
a BEFORE (NOT b) -> NOT (a before b)
(NOT a) BEFORE (NOT b) -> ????