@@ -27,11 +27,11 @@ signature module CondensedListSig {
27
27
*
28
28
* For instance, if connecting variables defined in a file, the index will be the line number of
29
29
* the variable in the file.
30
- *
30
+ *
31
31
* The sparse index (which may have gaps) is used to determine the ordering of the items in the
32
32
* condensed list. Once the condensed list is created, the items in the list will automatically be
33
33
* assigned a dense index (which has no gaps).
34
- *
34
+ *
35
35
* There must be no duplicate indices for the same division for correctness.
36
36
*/
37
37
int getSparseIndex ( Division d , Item l ) ;
@@ -40,7 +40,7 @@ signature module CondensedListSig {
40
40
/**
41
41
* A module to take orderable data (which may not be continuous) and condense it into one or more
42
42
* dense lists, with one such list per specified division.
43
- *
43
+ *
44
44
* To instantiate this module, you need to provide a `CondensedListSig` module that
45
45
* specifies the spare index and division of the items to be connected.
46
46
*
@@ -67,7 +67,9 @@ signature module CondensedListSig {
67
67
module Condense< CondensedListSig Config> {
68
68
newtype TList =
69
69
THead ( Config:: Item l , Config:: Division t ) { denseRank ( t , l ) = 1 } or
70
- TCons ( ListEntry prev , Config:: Item l ) { prev .getDenseIndex ( ) = denseRank ( prev .getDivision ( ) , l ) - 1 }
70
+ TCons ( ListEntry prev , Config:: Item l ) {
71
+ prev .getDenseIndex ( ) = denseRank ( prev .getDivision ( ) , l ) - 1
72
+ }
71
73
72
74
private module DenseRankConfig implements DenseRankInputSig2 {
73
75
class Ranked = Config:: Item ;
@@ -86,22 +88,18 @@ module Condense<CondensedListSig Config> {
86
88
exists ( ListEntry prev | this = TCons ( prev , _) and result = prev .getDivision ( ) )
87
89
}
88
90
89
- string toString ( ) {
90
- result = getItem ( ) .toString ( ) + " [index " + getDenseIndex ( ) + "]"
91
- }
91
+ string toString ( ) { result = getItem ( ) .toString ( ) + " [index " + getDenseIndex ( ) + "]" }
92
92
93
93
Config:: Item getItem ( ) {
94
94
this = THead ( result , _)
95
95
or
96
96
this = TCons ( _, result )
97
97
}
98
98
99
- int getDenseIndex ( ) {
100
- result = denseRank ( getDivision ( ) , getItem ( ) )
101
- }
99
+ int getDenseIndex ( ) { result = denseRank ( getDivision ( ) , getItem ( ) ) }
102
100
103
101
ListEntry getPrev ( ) { this = TCons ( result , _) }
104
102
105
103
ListEntry getNext ( ) { result .getPrev ( ) = this }
106
104
}
107
- }
105
+ }
0 commit comments