From fdb0036ea6bca1ddc8191069709e9c8ab221c1d7 Mon Sep 17 00:00:00 2001 From: Bastian Kohler Date: Thu, 25 May 2023 10:19:21 +0200 Subject: [PATCH] Added comments to abstract class "Detector" --- .../com/example/ueberwachungssystem/Detector.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/example/ueberwachungssystem/Detector.java b/app/src/main/java/com/example/ueberwachungssystem/Detector.java index 2d83cfe..d09fe1f 100644 --- a/app/src/main/java/com/example/ueberwachungssystem/Detector.java +++ b/app/src/main/java/com/example/ueberwachungssystem/Detector.java @@ -1,14 +1,17 @@ package com.example.ueberwachungssystem; import android.content.Context; - import androidx.annotation.NonNull; + abstract public class Detector { private OnDetectionListener listener; + /** Constructor - takes context of current activity */ public Detector(Context context) {}; + + /** On Detection Listener - runs when violation is reported */ public interface OnDetectionListener { void onDetection(@NonNull DetectionReport detectionReport); } @@ -16,6 +19,8 @@ abstract public class Detector { this.listener = listener; } + + /** Triggers onDetectionListener - call this to trigger violation/alarm */ private void reportViolation(String detectorID, String detectionType, float amplitude) { if (listener != null) { DetectionReport detectionReport = new DetectionReport(detectorID, detectionType, amplitude); @@ -25,6 +30,10 @@ abstract public class Detector { } } + + /** Starts Detection (abstract method: needs to be overridden in child class) */ public abstract void startDetection(); + + /** Stops Detection (abstract method: needs to be overridden in child class) */ public abstract void stopDetection(); } \ No newline at end of file