private UidRange parseUidRange(String range) throws DecodingException {
  int pos=range.indexOf(':');
  try {
    if (pos == -1) {
      if (range.length() == 1 && range.charAt(0) == '*') {
        return new UidRange(MessageUid.MAX_VALUE);
      }
 else {
        long value=parseUnsignedInteger(range);
        return new UidRange(MessageUid.of(value));
      }
    }
 else {
      long val1=parseUnsignedInteger(range.substring(0,pos));
      long val2=parseUnsignedInteger(range.substring(pos + 1));
      if (val1 == Long.MAX_VALUE && val2 == Long.MAX_VALUE) {
        return new UidRange(MessageUid.MAX_VALUE);
      }
 else       if (val1 <= val2) {
        return new UidRange(MessageUid.of(val1),MessageUid.of(val2));
      }
 else       if (val1 == Long.MAX_VALUE) {
        return new UidRange(MessageUid.of(val2),MessageUid.MAX_VALUE);
      }
 else {
        return new UidRange(MessageUid.of(val2),MessageUid.of(val1));
      }
    }
  }
 catch (  NumberFormatException e) {
    throw new DecodingException(HumanReadableText.INVALID_MESSAGESET,"Invalid message set.",e);
  }
}

private UidRange parseUidRange ( String range ) throws DecodingException { int pos = range . indexOf ( ':' ) ; try { if ( pos == - 1 ) { if ( range . length ( ) == 1 && range . charAt ( 0 ) == '*' ) { return new UidRange ( MessageUid . MAX_VALUE ) ; } else { long value = parseUnsignedInteger ( range ) ; return new UidRange ( MessageUid . of ( value ) ) ; } } else { long val1 = parseUnsignedInteger ( range . substring ( 0 , pos ) ) ; long val2 = parseUnsignedInteger ( range . substring ( pos + 1 ) ) ; if ( val1 == Long . MAX_VALUE && val2 == Long . MAX_VALUE ) { return new UidRange ( MessageUid . MAX_VALUE ) ; } else if ( val1 <= val2 ) { return new UidRange ( MessageUid . of ( val1 ) , MessageUid . of ( val2 ) ) ; } else if ( val1 == Long . MAX_VALUE ) { return new UidRange ( MessageUid . of ( val2 ) , MessageUid . MAX_VALUE ) ; } else { return new UidRange ( MessageUid . of ( val2 ) , MessageUid . of ( val1 ) ) ; } } } catch ( NumberFormatException e ) { throw new DecodingException ( HumanReadableText . INVALID_MESSAGESET , "Invalid message set." , e ) ; } }
parse a range which use a " : " as delimiter
