1
+ /**
2
+ * Provides classes representing comparison operators.
3
+ */
4
+
1
5
import python
2
6
3
7
/** A class representing the six comparison operators, ==, !=, <, <=, > and >=. */
@@ -34,6 +38,7 @@ class CompareOp extends int {
34
38
this = ge ( ) and result = le ( )
35
39
}
36
40
41
+ /** Gets the textual representation of `this`. */
37
42
string repr ( ) {
38
43
this = eq ( ) and result = "=="
39
44
or
@@ -48,6 +53,7 @@ class CompareOp extends int {
48
53
this = ge ( ) and result = ">="
49
54
}
50
55
56
+ /** Holds if `op` is the `Cmpop` corresponding to `this`. */
51
57
predicate forOp ( Cmpop op ) {
52
58
op instanceof Eq and this = eq ( )
53
59
or
@@ -70,16 +76,22 @@ class CompareOp extends int {
70
76
}
71
77
}
72
78
79
+ /** The `CompareOp` for "equals". */
73
80
CompareOp eq ( ) { result = 1 }
74
81
82
+ /** The `CompareOp` for "not equals". */
75
83
CompareOp ne ( ) { result = 2 }
76
84
85
+ /** The `CompareOp` for "less than". */
77
86
CompareOp lt ( ) { result = 3 }
78
87
88
+ /** The `CompareOp` for "less than or equal to". */
79
89
CompareOp le ( ) { result = 4 }
80
90
91
+ /** The `CompareOp` for "greater than". */
81
92
CompareOp gt ( ) { result = 5 }
82
93
94
+ /** The `CompareOp` for "greater than or equal to". */
83
95
CompareOp ge ( ) { result = 6 }
84
96
85
97
/* Workaround precision limits in floating point numbers */
0 commit comments