Added comments to abstract class "Detector"
This commit is contained in:
parent
f9797f2dca
commit
fdb0036ea6
@ -1,14 +1,17 @@
|
|||||||
package com.example.ueberwachungssystem;
|
package com.example.ueberwachungssystem;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
|
||||||
abstract public class Detector {
|
abstract public class Detector {
|
||||||
private OnDetectionListener listener;
|
private OnDetectionListener listener;
|
||||||
|
|
||||||
|
/** Constructor - takes context of current activity */
|
||||||
public Detector(Context context) {};
|
public Detector(Context context) {};
|
||||||
|
|
||||||
|
|
||||||
|
/** On Detection Listener - runs when violation is reported */
|
||||||
public interface OnDetectionListener {
|
public interface OnDetectionListener {
|
||||||
void onDetection(@NonNull DetectionReport detectionReport);
|
void onDetection(@NonNull DetectionReport detectionReport);
|
||||||
}
|
}
|
||||||
@ -16,6 +19,8 @@ abstract public class Detector {
|
|||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Triggers onDetectionListener - call this to trigger violation/alarm */
|
||||||
private void reportViolation(String detectorID, String detectionType, float amplitude) {
|
private void reportViolation(String detectorID, String detectionType, float amplitude) {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
DetectionReport detectionReport = new DetectionReport(detectorID, detectionType, amplitude);
|
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();
|
public abstract void startDetection();
|
||||||
|
|
||||||
|
/** Stops Detection (abstract method: needs to be overridden in child class) */
|
||||||
public abstract void stopDetection();
|
public abstract void stopDetection();
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user