From 19d4f15ac891e1a684be456d544ef32d6b276dcd Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 29 Aug 2017 10:02:04 +0500 Subject: Mark out functions to skip filtering --- src/org/traccar/FilterHandler.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/org/traccar/FilterHandler.java b/src/org/traccar/FilterHandler.java index bcc958e59..08be43f65 100644 --- a/src/org/traccar/FilterHandler.java +++ b/src/org/traccar/FilterHandler.java @@ -138,13 +138,17 @@ public class FilterHandler extends BaseDataHandler { return false; } - private boolean filterLimit(Position position, Position last) { + private boolean skipLimit(Position position, Position last) { if (filterLimit != 0 && last != null) { return (position.getFixTime().getTime() - last.getFixTime().getTime()) > filterLimit; } return false; } + private boolean skipAlarms(Position position) { + return keepAlarms && position.getAttributes().containsKey(Position.KEY_ALARM); + } + private boolean filter(Position position) { StringBuilder filterType = new StringBuilder(); @@ -154,7 +158,7 @@ public class FilterHandler extends BaseDataHandler { last = Context.getIdentityManager().getLastPosition(position.getDeviceId()); } - if (filterLimit(position, last) || keepAlarms && position.getAttributes().containsKey(Position.KEY_ALARM)) { + if (skipLimit(position, last) || skipAlarms(position)) { return false; } -- cgit v1.2.3