Description:
This measure is used as an input to the Halstead Software Science metrics. It counts the number of operands used in a class.
Example:
01 public class Class1 {
02 public void x(boolean v) {
03 int i;
04 if (v) {i = 1;}
05 else {i = 2;}
06 switch(i){
07 case 1:
08 case 2:
09 default:;
10 }
11 try {
12 while(v){
13 v = false;
14 int r = 1;
15 Boolean b = new Boolean(true);
16 i = i*i+r;
17 break;
18 }
19 } catch (Exception e) {
20 throw e;
21 }
22 }
23 }
| Line | N1 | n1 | N2 | n2 |
| 04 | if, = | if, = | v, i, 1 | v, i, 1 |
| 05 | = | i, 2 | 2 | |
| 06 | switch | switch | i | |
| 12 | loop | loop | v | |
| 13 | = | v, false | false | |
| 14 | = | 1 | ||
| 15 | =, new, call | new, call | Boolean, true | Boolean, true |
| 16 | =, *, + | *, + | i, i, i, r | r |
| 20 | throw | throw | e | e |
| Total | 14 | 9 | 17 | 9 |
Where