docs: @SuppressWarnings( "fallthrough" )
      protected Constraint rewrite( QueryContext context,
                                    List<Comparison> comparisons ) {
          // Look for the lower bound (greater-than) and upper bound (less-than) ...
          Comparison lessThan = null;
          Comparison greaterThan = null;
          List<Comparison> notNeeded = new LinkedList<Comparison>();
          boolean inclusive = false;
          for (Comparison comparison : comparisons) {
              switch (comparison.operator()) {
                  case GREATER_THAN_OR_EQUAL_TO:
                      inclusive = true;
                  case GREATER_THAN:
                      if (greaterThan != null) {
                          // Find the smallest value ...
                          Comparison newGreaterThan = getComparison(context, greaterThan, comparison, true);
                          notNeeded.add(newGreaterThan == greaterThan ? comparison : greaterThan);
                          greaterThan = newGreaterThan;
                      } else {
                          greaterThan = comparison;
                      }
                      break;
                  case LESS_THAN_OR_EQUAL_TO:
                      inclusive = true;
                  case LESS_THAN:
                      if (lessThan != null) {
                          // Find the largest value ...
                          Comparison newLessThan = getComparison(context, lessThan, comparison, false);
                          notNeeded.add(newLessThan == lessThan ? comparison : lessThan);
                          greaterThan = newLessThan;
                      } else {
                          lessThan = comparison;
                      }
                      break;
                  default:
                      assert false;
                      return null;
              }
          }
          if (lessThan == null || greaterThan == null) return null;
  
          // Create the new Comparison ...
          Constraint result = null;
  
          // Compute the difference between the lessThan value and greaterThan value ...
          int diff = compareStaticOperands(context, greaterThan, lessThan);
          if (diff == 0) {
              // The static operands are equivalent ...
              if (inclusive) {
                  // At least one of the sides was inclusive, meaning the constraints were something
                  // like 'x >= 2 AND x < 2', so we can replace these with an equality constraint ...
                  result = new Comparison(lessThan.getOperand1(), Operator.EQUAL_TO, lessThan.getOperand2());
                  notNeeded.add(lessThan);
                  notNeeded.add(greaterThan);
              } else {
                  // Neither is inclusive, so really the constraints are not needed anymore.
                  // And, because the constraints conflict, the whole access will return no nodes.
                  // So return the placeholder ...
                  return CONFLICTING_CONSTRAINT;
              }
          } else if (diff < 0) {
              // The range is valid as is ...
              boolean lowerInclusive = greaterThan.operator() == Operator.GREATER_THAN_OR_EQUAL_TO;
              boolean upperInclusive = lessThan.operator() == Operator.LESS_THAN_OR_EQUAL_TO;
              result = new Between(lessThan.getOperand1(), greaterThan.getOperand2(), lessThan.getOperand2(), lowerInclusive,
                                   upperInclusive);
              notNeeded.add(lessThan);
              notNeeded.add(greaterThan);
          } else {
              // The range is actually something like 'x < 2 AND x > 4', which can never happen ...
              return CONFLICTING_CONSTRAINT;
          }
  
          // Now null out those comparison objects that are not needed ...
          nullReference(comparisons, notNeeded);
          return result;
      }