@VisibleForTesting
  boolean contains(TokenRange range, Token token, boolean isStart) {
    if (range.isEmpty()) {
      return false;
    }
    if (range.getEnd().equals(minToken)) {
      if (range.getStart().equals(minToken)) { // ]min, min] = full ring, contains everything
        return true;
      } else if (token.equals(minToken)) {
        return !isStart;
      } else {
        return isStart
            ? token.compareTo(range.getStart()) >= 0
            : token.compareTo(range.getStart()) > 0;
      }
    } else {
      boolean isAfterStart =
          isStart ? token.compareTo(range.getStart()) >= 0 : token.compareTo(range.getStart()) > 0;
      boolean isBeforeEnd =
          isStart ? token.compareTo(range.getEnd()) < 0 : token.compareTo(range.getEnd()) <= 0;
      return range.isWrappedAround()
          ? isAfterStart || isBeforeEnd //  ####]----]####
          : isAfterStart && isBeforeEnd; // ----]####]----
    }
  }
@ VisibleForTesting boolean contains ( TokenRange range , Token token , boolean isStart ) { if ( range . isEmpty ( ) ) { return false ; } if ( range . getEnd ( ) . equals ( minToken ) ) { if ( range . getStart ( ) . equals ( minToken ) ) { return true ; } else if ( token . equals ( minToken ) ) { return ! isStart ; } else { return isStart ? token . compareTo ( range . getStart ( ) ) >= 0 : token . compareTo ( range . getStart ( ) ) > 0 ; } } else { boolean isAfterStart = isStart ? token . compareTo ( range . getStart ( ) ) >= 0 : token . compareTo ( range . getStart ( ) ) > 0 ; boolean isBeforeEnd = isStart ? token . compareTo ( range . getEnd ( ) ) < 0 : token . compareTo ( range . getEnd ( ) ) <= 0 ; return range . isWrappedAround ( ) ? isAfterStart || isBeforeEnd : isAfterStart && isBeforeEnd ; } }
* ]1,2] does not contain 1, but it contains the start of ]1,3]