From e1925a35ce309a3cf99c47c8cea599cd53d22b5c Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 29 Aug 2017 10:10:15 +0500 Subject: Rename variables and parameters to skip filtering --- src/org/traccar/FilterHandler.java | 22 +++++++++++----------- test/org/traccar/FilterHandlerTest.java | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/org/traccar/FilterHandler.java b/src/org/traccar/FilterHandler.java index 08be43f65..f63fd17dd 100644 --- a/src/org/traccar/FilterHandler.java +++ b/src/org/traccar/FilterHandler.java @@ -29,8 +29,8 @@ public class FilterHandler extends BaseDataHandler { private boolean filterStatic; private int filterDistance; private int filterMaxSpeed; - private long filterLimit; - private boolean keepAlarms; + private long skipLimit; + private boolean skipAlarms; public void setFilterInvalid(boolean filterInvalid) { this.filterInvalid = filterInvalid; @@ -64,12 +64,12 @@ public class FilterHandler extends BaseDataHandler { this.filterMaxSpeed = filterMaxSpeed; } - public void setFilterLimit(long filterLimit) { - this.filterLimit = filterLimit; + public void setSkipLimit(long skipLimit) { + this.skipLimit = skipLimit; } - public void setKeepAlarms(boolean keepAlarms) { - this.keepAlarms = keepAlarms; + public void setSkipAlarms(boolean skipAlarms) { + this.skipAlarms = skipAlarms; } public FilterHandler() { @@ -83,8 +83,8 @@ public class FilterHandler extends BaseDataHandler { filterStatic = config.getBoolean("filter.static"); filterDistance = config.getInteger("filter.distance"); filterMaxSpeed = config.getInteger("filter.maxSpeed"); - filterLimit = config.getLong("filter.limit") * 1000; - keepAlarms = config.getBoolean("filter.keepAlarms"); + skipLimit = config.getLong("filter.skipLimit") * 1000; + skipAlarms = config.getBoolean("filter.skipAlarms"); } } @@ -139,14 +139,14 @@ public class FilterHandler extends BaseDataHandler { } private boolean skipLimit(Position position, Position last) { - if (filterLimit != 0 && last != null) { - return (position.getFixTime().getTime() - last.getFixTime().getTime()) > filterLimit; + if (skipLimit != 0 && last != null) { + return (position.getFixTime().getTime() - last.getFixTime().getTime()) > skipLimit; } return false; } private boolean skipAlarms(Position position) { - return keepAlarms && position.getAttributes().containsKey(Position.KEY_ALARM); + return skipAlarms && position.getAttributes().containsKey(Position.KEY_ALARM); } private boolean filter(Position position) { diff --git a/test/org/traccar/FilterHandlerTest.java b/test/org/traccar/FilterHandlerTest.java index a2019f81f..e91566635 100644 --- a/test/org/traccar/FilterHandlerTest.java +++ b/test/org/traccar/FilterHandlerTest.java @@ -27,7 +27,7 @@ public class FilterHandlerTest extends BaseTest { filtingHandler.setFilterStatic(true); filtingHandler.setFilterDistance(10); filtingHandler.setFilterMaxSpeed(500); - filtingHandler.setFilterLimit(10); + filtingHandler.setSkipLimit(10); } @After @@ -77,7 +77,7 @@ public class FilterHandlerTest extends BaseTest { assertNotNull(passingHandler.decode(null, null, position)); position.set(Position.KEY_ALARM, Position.ALARM_GENERAL); - filtingHandler.setKeepAlarms(true); + filtingHandler.setSkipAlarms(true); assertNotNull(filtingHandler.decode(null, null, position)); } -- cgit v1.2.3