public StringBuffer _generatePattern(StringBuffer result,boolean escapeUnprintable,boolean includeStrings){
  result.append('[');
  int count=getRangeCount();
  if (count > 1 && getRangeStart(0) == MIN_VALUE && getRangeEnd(count - 1) == MAX_VALUE) {
    result.append('^');
    for (int i=1; i < count; ++i) {
      int start=getRangeEnd(i - 1) + 1;
      int end=getRangeStart(i) - 1;
      _appendToPat(result,start,escapeUnprintable);
      if (start != end) {
        if ((start + 1) != end) {
          result.append('-');
        }
        _appendToPat(result,end,escapeUnprintable);
      }
    }
  }
 else {
    for (int i=0; i < count; ++i) {
      int start=getRangeStart(i);
      int end=getRangeEnd(i);
      _appendToPat(result,start,escapeUnprintable);
      if (start != end) {
        if ((start + 1) != end) {
          result.append('-');
        }
        _appendToPat(result,end,escapeUnprintable);
      }
    }
  }
  if (includeStrings && strings.size() > 0) {
    Iterator<String> it=strings.iterator();
    while (it.hasNext()) {
      result.append('{');
      _appendToPat(result,it.next(),escapeUnprintable);
      result.append('}');
    }
  }
  return result.append(']');
}

public StringBuffer _generatePattern ( StringBuffer result , boolean escapeUnprintable , boolean includeStrings ) { result . append ( '[' ) ; int count = getRangeCount ( ) ; if ( count > 1 && getRangeStart ( 0 ) == MIN_VALUE && getRangeEnd ( count - 1 ) == MAX_VALUE ) { result . append ( '^' ) ; for ( int i = 1 ; i < count ; ++ i ) { int start = getRangeEnd ( i - 1 ) + 1 ; int end = getRangeStart ( i ) - 1 ; _appendToPat ( result , start , escapeUnprintable ) ; if ( start != end ) { if ( ( start + 1 ) != end ) { result . append ( '-' ) ; } _appendToPat ( result , end , escapeUnprintable ) ; } } } else { for ( int i = 0 ; i < count ; ++ i ) { int start = getRangeStart ( i ) ; int end = getRangeEnd ( i ) ; _appendToPat ( result , start , escapeUnprintable ) ; if ( start != end ) { if ( ( start + 1 ) != end ) { result . append ( '-' ) ; } _appendToPat ( result , end , escapeUnprintable ) ; } } } if ( includeStrings && strings . size ( ) > 0 ) { Iterator < String > it = strings . iterator ( ) ; while ( it . hasNext ( ) ) { result . append ( '{' ) ; _appendToPat ( result , it . next ( ) , escapeUnprintable ) ; result . append ( '}' ) ; } } return result . append ( ']' ) ; }
generate and append a string representation of this set to result . this does not use this . pat , the cleaned up copy of the string passed to applypattern ( ) .
