@@ -76,36 +76,37 @@ class MetricClass extends Class {
7676 dependsOnClassSimple ( this , result )
7777 }
7878
79- /* -------- HENDERSON-SELLERS LACK OF COHESION IN METHODS -------- */
80-
81- /* The aim of this metric is to try and determine whether a class
82- represents one abstraction (good) or multiple abstractions (bad).
83- If a class represents multiple abstractions, it should be split
84- up into multiple classes.
85-
86- In the Henderson-Sellers method, this is measured as follows:
87- M = set of methods in class
88- F = set of fields in class
89- r(f) = number of methods that access field f
90- <r> = mean of r(f) over f in F
91- The lack of cohesion is then given by
92-
93- <r> - |M|
94- ---------
95- 1 - |M|
96-
97- We follow the Eclipse metrics plugin by restricting M to methods
98- that access some field in the same class, and restrict F to
99- fields that are read by methods in the same class.
100-
101- Classes where the value of this metric is higher than 0.9 ought
102- to be scrutinised for possible splitting. Here is a query
103- to find such classes:
104-
105- from MetricRefType t, float loc
106- where loc = t.getLackOfCohesionHS() and loc > 0.9
107- select t, loc order by loc desc
108- */
79+ /*
80+ * -------- HENDERSON-SELLERS LACK OF COHESION IN METHODS --------
81+
82+ * The aim of this metric is to try and determine whether a class
83+ * represents one abstraction (good) or multiple abstractions (bad).
84+ * If a class represents multiple abstractions, it should be split
85+ * up into multiple classes.
86+
87+ * In the Henderson-Sellers method, this is measured as follows:
88+ * M = set of methods in class
89+ * F = set of fields in class
90+ * r(f) = number of methods that access field f
91+ * <r> = mean of r(f) over f in F
92+ * The lack of cohesion is then given by
93+
94+ * <r> - |M|
95+ * ---------
96+ * 1 - |M|
97+
98+ * We follow the Eclipse metrics plugin by restricting M to methods
99+ * that access some field in the same class, and restrict F to
100+ * fields that are read by methods in the same class.
101+
102+ * Classes where the value of this metric is higher than 0.9 ought
103+ * to be scrutinised for possible splitting. Here is a query
104+ * to find such classes:
105+
106+ * from MetricRefType t, float loc
107+ * where loc = t.getLackOfCohesionHS() and loc > 0.9
108+ * select t, loc order by loc desc
109+ */
109110
110111 /** Holds if `func` accesses field `f` defined in the same type. */
111112 predicate accessesLocalField ( Function func , Field f ) {
@@ -143,23 +144,23 @@ class MetricClass extends Class {
143144 )
144145 }
145146
146- /* -------- CHIDAMBER AND KEMERER LACK OF COHESION IN METHODS ------------ */
147+ /*
148+ * -------- CHIDAMBER AND KEMERER LACK OF COHESION IN METHODS ------------
147149
148- / * The aim of this metric is to try and determine whether a class
149- represents one abstraction (good) or multiple abstractions (bad).
150- If a class represents multiple abstractions, it should be split
151- up into multiple classes.
150+ * The aim of this metric is to try and determine whether a class
151+ * represents one abstraction (good) or multiple abstractions (bad).
152+ * If a class represents multiple abstractions, it should be split
153+ * up into multiple classes.
152154
153- In the Chidamber and Kemerer method, this is measured as follows:
154- n1 = number of pairs of distinct methods in a class that do *not*
155- have at least one commonly accessed field
156- n2 = number of pairs of distinct methods in a class that do
157- have at least one commonly accessed field
158- lcom = ((n1 - n2)/2 max 0)
155+ * In the Chidamber and Kemerer method, this is measured as follows:
156+ * n1 = number of pairs of distinct methods in a class that do *not*
157+ * have at least one commonly accessed field
158+ * n2 = number of pairs of distinct methods in a class that do
159+ * have at least one commonly accessed field
160+ * lcom = ((n1 - n2)/2 max 0)
159161
160- We divide by 2 because each pair (m1,m2) is counted twice in n1 and n2.
161-
162- */
162+ * We divide by 2 because each pair (m1,m2) is counted twice in n1 and n2.
163+ */
163164
164165 /** Holds if `f` should be excluded from the CK cohesion computation. */
165166 predicate ignoreLackOfCohesionCK ( Function f ) {
@@ -206,7 +207,9 @@ class MetricClass extends Class {
206207 )
207208 }
208209
209- /* ----------------- RESPONSE FOR A CLASS --------------------------------- */
210+ /*
211+ * ----------------- RESPONSE FOR A CLASS ---------------------------------
212+ */
210213
211214 /**
212215 * Gets the _response_ for this class. This estimates the number of
@@ -217,7 +220,9 @@ class MetricClass extends Class {
217220 result = sum ( MemberFunction f | f .getDeclaringType ( ) = this | count ( Call call | call .getEnclosingFunction ( ) = f ) )
218221 }
219222
220- /* ----------------- SPECIALIZATION INDEX -------------------------------- */
223+ /*
224+ * ----------------- SPECIALIZATION INDEX --------------------------------
225+ */
221226
222227 /**
223228 * Gets a function that should be excluded when reporting the number of
@@ -259,7 +264,7 @@ class MetricClass extends Class {
259264 }
260265
261266 /*
262- * HALSTEAD METRICS
267+ * ----------------- HALSTEAD METRICS ------------------------------------
263268 */
264269
265270 /**
0 commit comments