forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComplexCondition.java
More file actions
33 lines (31 loc) · 853 Bytes
/
ComplexCondition.java
File metadata and controls
33 lines (31 loc) · 853 Bytes
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
class ComplexCondition {
public boolean bad(boolean a, boolean b, boolean c) {
if (a && (b || !c)
|| b && (a || !c)
|| c && (a || !b)) {
return true;
} else {
return (a && !b) || (b && !c) || (a && !c) || (a && b || c);
}
}
public boolean ok(boolean a, boolean b, boolean c) {
if (a && b && c && !a && !b && !c) {
return true;
} else {
return (a && !b) || (b && !c) || (a && !c) || (a && b && c);
}
}
public boolean lengthy(boolean a, boolean b, boolean c) {
return ok(
new ComplexCondition() {
// Imagine there was stuff here...
}.ok(a || b, b || c, c || a),
new ComplexCondition() {
// ... and here ...
}.ok(a || b, b || c, c || a),
new ComplexCondition() {
// ... and here.
}.ok(a || b, b || c, c || a)
);
}
};