@@ -58,12 +58,12 @@ module DenseRank<DenseRankInputSig Input> {
58
58
rnk = rank [ result ] ( int rnk0 | rnk0 = getRank ( _) | rnk0 )
59
59
}
60
60
61
- /** Gets the dense rank of `r `. */
62
- int denseRank ( Ranked r ) { result = rankRank ( r , getRank ( r ) ) }
61
+ /** Gets the `Ranked` value for which the dense rank is `rnk `. */
62
+ Ranked denseRank ( int rnk ) { rnk = rankRank ( result , getRank ( result ) ) }
63
63
}
64
64
65
- /** Provides the input to `DenseRank2 `. */
66
- signature module DenseRankInputSig2 {
65
+ /** Provides the input to `DenseRank1 `. */
66
+ signature module DenseRankInputSig1 {
67
67
/** A ranking context. */
68
68
bindingset [ this ]
69
69
class C ;
@@ -77,25 +77,23 @@ signature module DenseRankInputSig2 {
77
77
}
78
78
79
79
/** Same as `DenseRank`, but allows for a context consisting of one element. */
80
- module DenseRank2 < DenseRankInputSig2 Input> {
80
+ module DenseRank1 < DenseRankInputSig1 Input> {
81
81
private import Input
82
82
83
83
private int rankRank ( C c , Ranked r , int rnk ) {
84
84
rnk = getRank ( c , r ) and
85
85
rnk = rank [ result ] ( int rnk0 | rnk0 = getRank ( c , _) | rnk0 )
86
86
}
87
87
88
- /** Gets the dense rank of `r` in the context provided by `c`. */
89
- int denseRank ( C c , Ranked r ) {
90
- exists ( int rnk |
91
- result = rankRank ( c , r , rnk ) and
92
- rnk = getRank ( c , r )
93
- )
94
- }
88
+ /**
89
+ * Gets the `Ranked` value for which the dense rank in the context provided by
90
+ * `c` is `rnk`.
91
+ */
92
+ Ranked denseRank ( C c , int rnk ) { rnk = rankRank ( c , result , getRank ( c , result ) ) }
95
93
}
96
94
97
- /** Provides the input to `DenseRank3 `. */
98
- signature module DenseRankInputSig3 {
95
+ /** Provides the input to `DenseRank2 `. */
96
+ signature module DenseRankInputSig2 {
99
97
/** A ranking context. */
100
98
bindingset [ this ]
101
99
class C1 ;
@@ -113,19 +111,19 @@ signature module DenseRankInputSig3 {
113
111
}
114
112
115
113
/** Same as `DenseRank`, but allows for a context consisting of two elements. */
116
- module DenseRank3 < DenseRankInputSig3 Input> {
114
+ module DenseRank2 < DenseRankInputSig2 Input> {
117
115
private import Input
118
116
119
117
private int rankRank ( C1 c1 , C2 c2 , Ranked r , int rnk ) {
120
118
rnk = getRank ( c1 , c2 , r ) and
121
119
rnk = rank [ result ] ( int rnk0 | rnk0 = getRank ( c1 , c2 , _) | rnk0 )
122
120
}
123
121
124
- /** Gets the dense rank of `r` in the context provided by `c1` and `c2`. */
125
- int denseRank ( C1 c1 , C2 c2 , Ranked r ) {
126
- exists ( int rnk |
127
- result = rankRank ( c1 , c2 , r , rnk ) and
128
- rnk = getRank ( c1 , c2 , r )
129
- )
122
+ /**
123
+ * Gets the ` Ranked` value for which the dense rank in the context provided by
124
+ * `c1` and `c2` is `rnk`.
125
+ */
126
+ Ranked denseRank ( C1 c1 , C2 c2 , int rnk ) {
127
+ rnk = rankRank ( c1 , c2 , result , getRank ( c1 , c2 , result ) )
130
128
}
131
129
}
0 commit comments