-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.java
44 lines (28 loc) · 1.18 KB
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import java.util.ArrayList;
public class Main{
// to hold dummy data
static ArrayList<Double[]> sensorData = new ArrayList<>();
static UnusualValueDetector unusualValueDetector;
public static void main(String[] args) {
initializeDummyData();
unusualValueDetector = new UnusualValueDetector(new StandardDeviationMean());
sensorData.forEach( (value) -> {
double x = value[0], y = value[1], z = value[2];
unusualValueDetector.analyzeMotionSensorData(x, y, z);
if(unusualValueDetector.isValueUnusual())
System.out.println("unusual value = "
+ Math.floor(unusualValueDetector.getResultant()*100)/100
+" [this is usage of 'UnusualValueDetector' class without any responder]"
);
});
}
public static void initializeDummyData(){
// add some dummy data, this is supposed to come from sensor
for(int i=0;i<10;i++) {
double x = Math.random()*10;
double y = Math.random()*10;
double z = Math.random()*10;
sensorData.add( new Double[] {x, y, z} );
}
}
}