code: public static void normalizeRanges(List<Range> ranges) {
          int i, todo, max;
          Range current, op, and;
  
          todo = 0;
          while (todo < ranges.size()) {
              // take the first range, and-it with all others and
              // append fractions to the end.
              current = (Range) ranges.get(todo);
              max = ranges.size(); // don't grow max inside the for-loop
              for (i = todo + 1; i < max; i++) {
                  op = (Range) ranges.get(i);
                  and = current.and(op);
                  if (and != null) {
                      current.remove(and, ranges);
                      op.remove(and, ranges);
  
                      ranges.remove(i);
                      i--;
                      max--;
  
                      current = and;
                  }
              }
              ranges.set(todo, current);
              todo++;
          }
      }
docs: @param ranges in-out argument
  
  TODO:
  o  expensive, the list is modified ...
  *  states that touch each other are not merged