-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskBlinkList.java
More file actions
108 lines (94 loc) · 5.02 KB
/
Copy pathTaskBlinkList.java
File metadata and controls
108 lines (94 loc) · 5.02 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
public class TaskBlinkList {
private List<Blink> blinks;
public TaskBlinkList() {
this.blinks = new ArrayList<Blink>();
}
public void addBlink(Blink blink) {
blinks.add(blink);
}
public List<Blink> search(
boolean fiftyPercentStartTimeCriterion_Specified,
String fiftyPercentStartTimeCriterion_ComparisonString,
int fiftyPercentStartTimeCriterion_Value,
boolean fiftyPercentEndTimeCriterion_Specified,
String fiftyPercentEndTimeCriterion_ComparisonString,
int fiftyPercentEndTimeCriterion_Value,
boolean fiftyPercentWindowDurationCriterion_Specified,
String fiftyPercentWindowDurationCriterion_ComparisonString,
int fiftyPercentWindowDurationCriterion_Value,
boolean amplitudeCriterion_Specified,
String amplitudeCriterion_ComparisonString,
int amplitudeCriterion_Value,
boolean styleCriterion_Specified,
BlinkStyle styleCriterion_Value,
boolean gazeShiftCriterion_Specified,
BlinkGazeAssociation gazeShiftCriterion_Value) {
List<Blink> matchingBlinks = new ArrayList<Blink>();
for (Iterator<Blink> i = blinks.iterator(); i.hasNext(); ) {
Blink checkBlink = i.next();
// If a 50% start time criterion is specified for the search, then
// if the checkBlink doesn't match the specified criterion, we can
// move on to the next blink.
if (fiftyPercentStartTimeCriterion_Specified) {
if (fiftyPercentStartTimeCriterion_ComparisonString.equals(">")) {
if (!(checkBlink.getFiftyPercentStartTime() > fiftyPercentStartTimeCriterion_Value)) continue;
} else { // comparison string is "<"
if (!(checkBlink.getFiftyPercentStartTime() < fiftyPercentStartTimeCriterion_Value)) continue;
}
}
// If a 50% end time criterion is specified for the search, then
// if the checkBlink doesn't match the specified criterion, we can
// move on to the next blink.
if (fiftyPercentEndTimeCriterion_Specified) {
if (fiftyPercentEndTimeCriterion_ComparisonString.equals(">")) {
if (!(checkBlink.getFiftyPercentEndTime() > fiftyPercentEndTimeCriterion_Value)) continue;
} else { // comparison string is "<"
if (!(checkBlink.getFiftyPercentEndTime() < fiftyPercentEndTimeCriterion_Value)) continue;
}
}
// If a 50% window duration criterion is specified for the search,
// then if the checkBlink doesn't match the specified criterion, we can
// move on to the next blink.
if (fiftyPercentWindowDurationCriterion_Specified) {
if (fiftyPercentWindowDurationCriterion_ComparisonString.equals(">")) {
if (!(checkBlink.getFiftyPercentEndTime() - checkBlink.getFiftyPercentStartTime() >
fiftyPercentWindowDurationCriterion_Value)) continue;
} else { // comparison string is "<"
if (!(checkBlink.getFiftyPercentEndTime() - checkBlink.getFiftyPercentStartTime() <
fiftyPercentWindowDurationCriterion_Value)) continue;
}
}
// If an amplitude criterion is specified for the search,
// then if the checkBlink doesn't match the specified criterion, we can
// move on to the next blink.
if (amplitudeCriterion_Specified) {
if (amplitudeCriterion_ComparisonString.equals(">")) {
if (!(checkBlink.getAmplitude() > amplitudeCriterion_Value)) continue;
} else { // comparison string is "<"
if (!(checkBlink.getAmplitude() < amplitudeCriterion_Value)) continue;
}
}
// If a style criterion is specified for the search,
// then if the checkBlink doesn't match the specified style, we can
// move on to the next blink.
if (styleCriterion_Specified) {
if (!(checkBlink.getStyle() == styleCriterion_Value)) continue;
}
// If an associated gaze shift criterion is specified for the search,
// then if the checkBlink doesn't match the specified associated gaze shift, we can
// move on to the next blink.
if (gazeShiftCriterion_Specified) {
if (!(checkBlink.getGazeAssociation() == gazeShiftCriterion_Value)) continue;
}
// If we get here, the checkBlink has passed all the tests and should be added
// to our list of matching blinks.
matchingBlinks.add(checkBlink);
}
// When we get here, we've gone through all the blinks in this list and checked to see if they
// match all the specified criteria.
return matchingBlinks;
}
}