- TOURNAMENT {
- @Override
- public String format(String target, RegexParams params) {
- if (params.getPageId() != null) {
- target = target.replace(
- RegexParams.PAGE_ID,
- params.getPageId()
- );
+ FIND,
+ SPLIT,
+ BLOCK;
+
+ public static RegexMatcher matcher(RegexType type, String match) {
+ return Factory.create(
+ type,
+ match
+ );
+ }
+
+ public static RegexMatcher matcher(String startMatch, String endMatch) {
+ return Factory.create(
+ startMatch,
+ endMatch
+ );
+ }
+
+ static class Factory {
+
+ static RegexMatcher create(RegexType type, String match) {
+ switch (type) {
+ case FIND:
+ return new RegexFinder(match);
+ case SPLIT:
+ return new RegexSplitter(match);
+ case BLOCK:
+ return new RegexBlockFinder(match, match);