aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper/PatternBuilder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-09 17:09:54 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-09 17:09:54 +1300
commit4e82a2e0e6e8ea2fa09435e51392e9614d869677 (patch)
tree65e0c8026f5bff220dd581986c8c7d153f0e7e90 /src/org/traccar/helper/PatternBuilder.java
parentdd2ff7183729388033bfdd03eeb464a59de229ae (diff)
downloadtrackermap-server-4e82a2e0e6e8ea2fa09435e51392e9614d869677.tar.gz
trackermap-server-4e82a2e0e6e8ea2fa09435e51392e9614d869677.tar.bz2
trackermap-server-4e82a2e0e6e8ea2fa09435e51392e9614d869677.zip
Refactor GoSafe decoder implementation
Diffstat (limited to 'src/org/traccar/helper/PatternBuilder.java')
-rw-r--r--src/org/traccar/helper/PatternBuilder.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/org/traccar/helper/PatternBuilder.java b/src/org/traccar/helper/PatternBuilder.java
index e8f5c605a..0105bf7a6 100644
--- a/src/org/traccar/helper/PatternBuilder.java
+++ b/src/org/traccar/helper/PatternBuilder.java
@@ -21,6 +21,10 @@ public class PatternBuilder {
private final StringBuilder pattern = new StringBuilder();
+ public interface Builder {
+ void build(PatternBuilder builder);
+ }
+
public PatternBuilder xpr(String s) {
pattern.append(s);
return this;
@@ -60,6 +64,14 @@ public class PatternBuilder {
return not(s).txt(s);
}
+ public PatternBuilder groupBegin() {
+ return xpr("(?:");
+ }
+
+ public PatternBuilder groupEnd(boolean optional) {
+ return xpr(optional ? ")?" : ")");
+ }
+
public Pattern compile() {
return Pattern.compile(pattern.toString(), Pattern.DOTALL);
}