public SortKey thenByDouble(double value, double start, double end, int levels) {
    assert levels > 0 : "levels must be > 0 got " + levels;
    if (start > end) {
      return thenByDouble(start - value, end, start, levels);
    }
    if (value < start || value > end) {
      value = Math.clamp(value, start, end);
    }

    int intVal = doubleRangeToInt(value, start, end, levels);
    return accumulate(intVal, 0, levels);
  }
Adds a field to this sort key where if all previous values are equal, then elements where {@code value == start}
sort before elements where {@code value == end} and the range {@code [min, max]} is broken into {@code levels}
discrete levels.
planetiler-core/src/main/java/com/onthegomap/planetiler/util/SortKey.java