code: public int matches(Replaceable text,
                         int[] offset,
                         int limit,
                         boolean incremental) {
          int start = offset[0];
          int count = 0;
          while (count < maxCount) {
              int pos = offset[0];
              int m = matcher.matches(text, offset, limit, incremental);
              if (m == U_MATCH) {
                  ++count;
                  if (pos == offset[0]) {
                      // If offset has not moved we have a zero-width match.
                      // Don't keep matching it infinitely.
                      break;
                  }
              } else if (incremental && m == U_PARTIAL_MATCH) {
                  return U_PARTIAL_MATCH;
              } else {
                  break;
              }
          }
          if (incremental && offset[0] == limit) {
              return U_PARTIAL_MATCH;
          }
          if (count >= minCount) {
              return U_MATCH;
          }
          offset[0] = start;
          return U_MISMATCH;
      }
docs: Implement UnicodeMatcher API.