@@ -33,7 +33,23 @@ final class NotEqualOperation extends EqualityOperationImpl {
3333/**
3434 * A relational comparison operation, that is, one of `<=`, `<`, `>`, or `>=`.
3535 */
36- abstract private class RelationalOperationImpl extends BinaryExpr , ComparisonOperationImpl { }
36+ abstract private class RelationalOperationImpl extends BinaryExpr , ComparisonOperationImpl {
37+ /**
38+ * Gets the operand on the "greater" (or "greater-or-equal") side
39+ * of this relational expression, that is, the side that is larger
40+ * if the overall expression evaluates to `true`; for example on
41+ * `x <= 20` this is the `20`, and on `y > 0` it is `y`.
42+ */
43+ abstract Expr getGreaterOperand ( ) ;
44+
45+ /**
46+ * Gets the operand on the "lesser" (or "lesser-or-equal") side
47+ * of this relational expression, that is, the side that is smaller
48+ * if the overall expression evaluates to `true`; for example on
49+ * `x <= 20` this is `x`, and on `y > 0` it is the `0`.
50+ */
51+ abstract Expr getLesserOperand ( ) ;
52+ }
3753
3854final class RelationalOperation = RelationalOperationImpl ;
3955
@@ -42,25 +58,41 @@ final class RelationalOperation = RelationalOperationImpl;
4258 */
4359final class LessThanOperation extends RelationalOperationImpl , BinaryExpr {
4460 LessThanOperation ( ) { this .getOperatorName ( ) = "<" }
61+
62+ override Expr getGreaterOperand ( ) { result = this .getRhs ( ) }
63+
64+ override Expr getLesserOperand ( ) { result = this .getLhs ( ) }
4565}
4666
4767/**
48- * The greater than comparison operation, `>? `.
68+ * The greater than comparison operation, `>`.
4969 */
5070final class GreaterThanOperation extends RelationalOperationImpl , BinaryExpr {
5171 GreaterThanOperation ( ) { this .getOperatorName ( ) = ">" }
72+
73+ override Expr getGreaterOperand ( ) { result = this .getLhs ( ) }
74+
75+ override Expr getLesserOperand ( ) { result = this .getRhs ( ) }
5276}
5377
5478/**
5579 * The less than or equal comparison operation, `<=`.
5680 */
5781final class LessOrEqualOperation extends RelationalOperationImpl , BinaryExpr {
5882 LessOrEqualOperation ( ) { this .getOperatorName ( ) = "<=" }
83+
84+ override Expr getGreaterOperand ( ) { result = this .getRhs ( ) }
85+
86+ override Expr getLesserOperand ( ) { result = this .getLhs ( ) }
5987}
6088
6189/**
6290 * The less than or equal comparison operation, `>=`.
6391 */
6492final class GreaterOrEqualOperation extends RelationalOperationImpl , BinaryExpr {
6593 GreaterOrEqualOperation ( ) { this .getOperatorName ( ) = ">=" }
94+
95+ override Expr getGreaterOperand ( ) { result = this .getLhs ( ) }
96+
97+ override Expr getLesserOperand ( ) { result = this .getRhs ( ) }
6698}
0 commit comments