aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/helper/PatternUtil.java26
-rw-r--r--test/org/traccar/helper/PatternUtilTest.java2
2 files changed, 11 insertions, 17 deletions
diff --git a/src/org/traccar/helper/PatternUtil.java b/src/org/traccar/helper/PatternUtil.java
index 88c3f053b..f665eb30d 100644
--- a/src/org/traccar/helper/PatternUtil.java
+++ b/src/org/traccar/helper/PatternUtil.java
@@ -25,20 +25,13 @@ public final class PatternUtil {
}
public static class MatchResult {
- private String pattern;
- private String matched;
- private String remaining;
+ private String patternMatch;
+ private String patternTail;
+ private String stringMatch;
+ private String stringTail;
- public String getPattern() {
- return this.pattern;
- }
-
- public String getMatched() {
- return this.matched;
- }
-
- public String getRemaining() {
- return this.remaining;
+ public String getPatternMatch() {
+ return patternMatch;
}
}
@@ -50,9 +43,10 @@ public final class PatternUtil {
try {
Matcher matcher = Pattern.compile("(" + pattern.substring(0, i) + ").*").matcher(input);
if (matcher.matches()) {
- result.pattern = pattern.substring(0, i);
- result.matched = matcher.group(1);
- result.remaining = input.substring(matcher.group(1).length());
+ result.patternMatch = pattern.substring(0, i);
+ result.patternTail = pattern.substring(i);
+ result.stringMatch = matcher.group(1);
+ result.stringTail = input.substring(matcher.group(1).length());
}
} catch (PatternSyntaxException error) {
Log.warning(error);
diff --git a/test/org/traccar/helper/PatternUtilTest.java b/test/org/traccar/helper/PatternUtilTest.java
index bb1349363..b6b05e88c 100644
--- a/test/org/traccar/helper/PatternUtilTest.java
+++ b/test/org/traccar/helper/PatternUtilTest.java
@@ -9,7 +9,7 @@ public class PatternUtilTest {
@Test
public void testCheckPattern() {
- assertEquals("ab", PatternUtil.checkPattern("abc", "abd").getPattern());
+ assertEquals("ab", PatternUtil.checkPattern("abc", "abd").getPatternMatch());
}