summaryrefslogtreecommitdiffstats
path: root/Src/PyCatcher/src/filters.py
diff options
context:
space:
mode:
Diffstat (limited to 'Src/PyCatcher/src/filters.py')
-rw-r--r--Src/PyCatcher/src/filters.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/Src/PyCatcher/src/filters.py b/Src/PyCatcher/src/filters.py
new file mode 100644
index 0000000..6247aac
--- /dev/null
+++ b/Src/PyCatcher/src/filters.py
@@ -0,0 +1,31 @@
+class Filter:
+ def __init__(self):
+ self.is_active = False
+ self.params = {}
+
+ def execute(self, station_list):
+ raise NotImplementedError('Filter not yet implemented')
+
+class ARFCNFilter(Filter):
+ def execute(self, station_list):
+ filtered_list = []
+ low = self.params['from']
+ high = self.params['to']
+ for station in station_list:
+ if station.arfcn <= high and station.arfcn >= low:
+ filtered_list.append(station)
+ return filtered_list
+
+class ProviderFilter(Filter):
+ def execute(self, station_list):
+ filtered_list = []
+ providers = [x.strip() for x in self.params['providers'].split(',')]
+ for station in station_list:
+ if station.provider in providers:
+ filtered_list.append(station)
+ return filtered_list
+
+#FIXME: provide extra abstraction for parameterless filters (on/off filters)
+class FoundFilter(Filter):
+ def execute(self, station_list):
+ pass \ No newline at end of file