diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-09 17:09:54 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-09 17:09:54 +1300 |
commit | 4e82a2e0e6e8ea2fa09435e51392e9614d869677 (patch) | |
tree | 65e0c8026f5bff220dd581986c8c7d153f0e7e90 /src/org/traccar/helper | |
parent | dd2ff7183729388033bfdd03eeb464a59de229ae (diff) | |
download | traccar-server-4e82a2e0e6e8ea2fa09435e51392e9614d869677.tar.gz traccar-server-4e82a2e0e6e8ea2fa09435e51392e9614d869677.tar.bz2 traccar-server-4e82a2e0e6e8ea2fa09435e51392e9614d869677.zip |
Refactor GoSafe decoder implementation
Diffstat (limited to 'src/org/traccar/helper')
-rw-r--r-- | src/org/traccar/helper/PatternBuilder.java | 12 |
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); } |