public boolean allWheresClosed() {
        return whereStack.size() == 1;
    }
adds an SQL condition to the where clause which will always lead to an "include" of lines, never to an "exclude".
Normally this will be an SQl-Expression always evaluating to "true".
However, if we are currently inside a NOT, then it will be an SQL-Expression always evaluating to "false" (hence "true" when negated).
This method handles also multilevel NOTs (e.g. inside a NOT(NOT(NOT(x))) it will use "false"-expression, inside NOT(NOT(NOT(NOT(x)))) is will use "true"-expression
main/src/main/java/cgeo/geocaching/storage/SqlBuilder.java