code: private static Selector simplifyNOT(Selector tree) {
      if (tree instanceof Literal)
        return new LiteralImpl( EvaluatorImpl.not((Boolean) ((Literal) tree).getValue())); // was BooleanValue
      if (!(tree instanceof Operator))
        return new OperatorImpl(Selector.NOT, tree);
      Operator oper = (Operator) tree;
      switch(oper.getOp()) {
      case Selector.NOT:
        return simplifyTree(oper.getOperands()[0]);
      case Selector.AND:
        return makeOR(simplifyNOT(oper.getOperands()[0]),
                      simplifyNOT(oper.getOperands()[1]));
      case Selector.OR:
        return makeAND(simplifyNOT(oper.getOperands()[0]),
                       simplifyNOT(oper.getOperands()[1]));
      case Selector.EQ:
        return simplifyNE(oper.getOperands()[0], oper.getOperands()[1]);
      case Selector.NE:
        return simplifyEQ(oper.getOperands()[0], oper.getOperands()[1]);
      case Selector.GT:
        return new OperatorImpl(Selector.LE, oper.getOperands()[0], oper.getOperands()[1]);
      case Selector.LT:
        return new OperatorImpl(Selector.GE, oper.getOperands()[0], oper.getOperands()[1]);
      case Selector.GE:
        return new OperatorImpl(Selector.LT, oper.getOperands()[0], oper.getOperands()[1]);
      case Selector.LE:
        return new OperatorImpl(Selector.GT, oper.getOperands()[0], oper.getOperands()[1]);
      default:
        return new OperatorImpl(Selector.NOT, tree);
      }
    }
docs: Subroutine of simplifyTree to handle NOT nodes