aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-25 11:06:34 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-25 11:06:34 +1300
commit957740cfb5d74098971a8d4186eda4f9383774d8 (patch)
treed8fb3df0658a9a0ca45ee8a073aca3e82740eb1b /src/org/traccar/helper
parent8fe177bd27196a3924e4ef8e835ba9dac14975c3 (diff)
downloadtrackermap-server-957740cfb5d74098971a8d4186eda4f9383774d8.tar.gz
trackermap-server-957740cfb5d74098971a8d4186eda4f9383774d8.tar.bz2
trackermap-server-957740cfb5d74098971a8d4186eda4f9383774d8.zip
Refactor Totem protocol decoder
Diffstat (limited to 'src/org/traccar/helper')
-rw-r--r--src/org/traccar/helper/DateBuilder.java19
-rw-r--r--src/org/traccar/helper/PatternBuilder.java11
2 files changed, 7 insertions, 23 deletions
diff --git a/src/org/traccar/helper/DateBuilder.java b/src/org/traccar/helper/DateBuilder.java
index 094dfff16..77c6821aa 100644
--- a/src/org/traccar/helper/DateBuilder.java
+++ b/src/org/traccar/helper/DateBuilder.java
@@ -60,16 +60,6 @@ public class DateBuilder {
return setDate(year, month, day);
}
- @Deprecated
- public DateBuilder setDate(String year, String month, String day) {
- return setDate(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day));
- }
-
- @Deprecated
- public DateBuilder setDateReverse(String day, String month, String year) {
- return setDate(year, month, day);
- }
-
public DateBuilder setCurrentDate() {
Calendar now = Calendar.getInstance(calendar.getTimeZone());
return setYear(now.get(Calendar.YEAR)).setMonth(now.get(Calendar.MONTH)).setDay(now.get(Calendar.DAY_OF_MONTH));
@@ -104,19 +94,10 @@ public class DateBuilder {
return setHour(hour).setMinute(minute).setSecond(second);
}
- @Deprecated
- public DateBuilder setTime(String hour, String minute, String second) {
- return setTime(Integer.parseInt(hour), Integer.parseInt(minute), Integer.parseInt(second));
- }
-
public DateBuilder setTime(int hour, int minute, int second, int millis) {
return setHour(hour).setMinute(minute).setSecond(second).setMillis(millis);
}
- public DateBuilder setDateTime(int year, int month, int day, int hour, int minute, int second) {
- return setDate(year, month, day).setTime(hour, minute, second);
- }
-
public Date getDate() {
return calendar.getTime();
}
diff --git a/src/org/traccar/helper/PatternBuilder.java b/src/org/traccar/helper/PatternBuilder.java
index 5d9d3afa8..4ce4295dd 100644
--- a/src/org/traccar/helper/PatternBuilder.java
+++ b/src/org/traccar/helper/PatternBuilder.java
@@ -33,6 +33,8 @@ public class PatternBuilder {
}
public PatternBuilder expression(String s) {
+ s = s.replaceAll("\\|$", "\\\\|"); // special case for delimiter
+
fragments.add(s);
return this;
}
@@ -63,6 +65,11 @@ public class PatternBuilder {
return this;
}
+ public PatternBuilder or() {
+ fragments.add("|");
+ return this;
+ }
+
public PatternBuilder groupBegin() {
return expression("(?:");
}
@@ -75,10 +82,6 @@ public class PatternBuilder {
return expression(")" + s);
}
- public PatternBuilder or() {
- return expression("|");
- }
-
public Pattern compile() {
return Pattern.compile(toString(), Pattern.DOTALL);
}