Negates a logical expression by adding or removing a NOT.
(RexNode e)
| 2161 | |
| 2162 | /** Negates a logical expression by adding or removing a NOT. */ |
| 2163 | public static RexNode not(RexNode e) { |
| 2164 | switch (e.getKind()) { |
| 2165 | case NOT: |
| 2166 | return ((RexCall) e).getOperands().get(0); |
| 2167 | default: |
| 2168 | return addNot(e); |
| 2169 | } |
| 2170 | } |
| 2171 | |
| 2172 | private static RexNode addNot(RexNode e) { |
| 2173 | return new RexCall(e.getType(), SqlStdOperatorTable.NOT, ImmutableList.of(e)); |