1
1
import cpp
2
2
3
- /**
4
- * Describes whether a relation is 'strict' (that is, a `<` or `>`
5
- * relation) or 'non-strict' (a `<=` or `>=` relation).
6
- */
7
- newtype RelationStrictness =
3
+ private newtype TRelationStrictness =
8
4
/**
9
5
* Represents that a relation is 'strict' (that is, a `<` or `>` relation).
10
6
*/
@@ -14,6 +10,19 @@ newtype RelationStrictness =
14
10
*/
15
11
Nonstrict ( )
16
12
13
+ /**
14
+ * Describes whether a relation is 'strict' (that is, a `<` or `>`
15
+ * relation) or 'non-strict' (a `<=` or `>=` relation).
16
+ */
17
+ class RelationStrictness extends TRelationStrictness {
18
+ /* Gets the string representation of this relation strictness. */
19
+ string toString ( ) {
20
+ this = Strict ( ) and result = "strict"
21
+ or
22
+ this = Nonstrict ( ) and result = "non-strict"
23
+ }
24
+ }
25
+
17
26
/**
18
27
* Describes whether a relation is 'greater' (that is, a `>` or `>=`
19
28
* relation) or 'lesser' (a `<` or `<=` relation).
@@ -105,10 +114,10 @@ predicate relOpWithSwap(
105
114
*
106
115
* This allows for the relation to be either as written, or with its
107
116
* arguments reversed; for example, if `rel` is `x < 5` then
108
- * `relOpWithSwapAndNegate(rel, x, 5, Lesser(), Strict(), true)`,
109
- * `relOpWithSwapAndNegate(rel, 5, x, Greater(), Strict(), true)`,
110
- * `relOpWithSwapAndNegate(rel, x, 5, Greater(), Nonstrict(), false)` and
111
- * `relOpWithSwapAndNegate(rel, 5, x, Lesser(), Nonstrict(), false)` hold.
117
+ * - `relOpWithSwapAndNegate(rel, x, 5, Lesser(), Strict(), true)`,
118
+ * - `relOpWithSwapAndNegate(rel, 5, x, Greater(), Strict(), true)`,
119
+ * - `relOpWithSwapAndNegate(rel, x, 5, Greater(), Nonstrict(), false)` and
120
+ * - `relOpWithSwapAndNegate(rel, 5, x, Lesser(), Nonstrict(), false)` hold.
112
121
*/
113
122
predicate relOpWithSwapAndNegate (
114
123
RelationalOperation rel , Expr a , Expr b , RelationDirection dir , RelationStrictness strict ,
0 commit comments