Skip to content

Commit

Permalink
Benchmarks: rename Implementations.Pattern.compile to matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
sjamesr committed Aug 21, 2019
1 parent bd19785 commit 86028a5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void setup() {

@Benchmark
public void matched(Blackhole bh) {
Implementations.Matcher matcher = pattern.compile(repeat("a", repeats));
Implementations.Matcher matcher = pattern.matcher(repeat("a", repeats));
boolean matches = matcher.matches();
if (!matches) {
throw new AssertionError();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void setup() {

@Benchmark
public void matched(Blackhole bh) {
Implementations.Matcher matcher = pattern.compile("password");
Implementations.Matcher matcher = pattern.matcher("password");
boolean matches = matcher.matches();
if (!matches) {
throw new AssertionError();
Expand All @@ -40,7 +40,7 @@ public void matched(Blackhole bh) {

@Benchmark
public void notMatched(Blackhole bh) {
Implementations.Matcher matcher = pattern.compile("l0ngpassword");
Implementations.Matcher matcher = pattern.matcher("l0ngpassword");
boolean matches = matcher.matches();
if (matches) {
throw new AssertionError();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void setup() {

@Benchmark
public void findPhoneNumbers(Blackhole bh) {
Implementations.Matcher matcher = pattern.compile(html);
Implementations.Matcher matcher = pattern.matcher(html);
int count = 0;
while (matcher.find()) {
bh.consume(matcher.group());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static Pattern compile(Implementations impl, String pattern) {
}
}

public abstract Matcher compile(String str);
public abstract Matcher matcher(String str);

public static class JdkPattern extends Pattern {

Expand All @@ -85,7 +85,7 @@ public JdkPattern(String pattern) {
}

@Override
public Matcher compile(String str) {
public Matcher matcher(String str) {
return new Matcher.JdkMatcher(pattern.matcher(str));
}
}
Expand All @@ -99,7 +99,7 @@ public Re2Pattern(String pattern) {
}

@Override
public Matcher compile(String str) {
public Matcher matcher(String str) {
return new Matcher.Re2Matcher(pattern.matcher(str));
}
}
Expand Down

0 comments on commit 86028a5

Please sign in to comment.