static Matcher optimize(Matcher matcher) {
    Matcher m = matcher;
    Matcher opt = optimizeSinglePass(m);
    for (int i = 0; !m.equals(opt) && i < MAX_ITERATIONS; ++i) {
      m = opt;
      opt = optimizeSinglePass(m);
    }
    return opt;
  }
static Matcher optimize ( Matcher matcher ) { Matcher m = matcher ; Matcher opt = optimizeSinglePass ( m ) ; for ( int i = 0 ; ! m . equals ( opt ) && i < MAX_ITERATIONS ; ++ i ) { m = opt ; opt = optimizeSinglePass ( m ) ; } return opt ; }
Return a new instance of the matcher that has been optimized.