Use custom Matcher to find and replace properties

The simplest way to find and replace properties in Strings is using a
Pattern Matcher. However, implementing a specialized Matcher using
simpler String primitives is faster, so do so using an API that looks
and feels as simple as the Pattern Matcher API.

In a sample walking ancestors use case, this caching and saves a small
but measurable amount of the total time. In the case of a task.config
which walks all dependencies for a change when run with status:open
--no-limit --task--applicable the gain can be seen below.

Before this change: 8m7s 3m16s 3m26s 3m16s 3m21s
After this change: 2m34s 2m28s 2m40s 2m34s 2m39s

Change-Id: Ief2d6a24f6952828214f55a4a4cf9ea0f3768f42
2 files changed