ELSE IF are nested IFs

I've been adding more metrics to Meaxure, lately the DCOND metric. DCOND is the deepness of condition nesting, currently only implemented for IFs, but not for switch or the ternary operator. Deeply nested IF statements are most often a source for bugs because of their complexity.

When I've run the first test, DCOND was very high for some classes. I took a look and wondered when I only found some ELSE-IF constructs, but no nested IF statements. For example:

if (a) {
       a
} else if (b) {
       b
} else if (c) {
       c
} else {
       d
}

Naturally one would assume the flow has a DCOND of one, because there is only one level of condition nesting. But the ELSE-IF construct is just short for:

if (a) {
       a
} else {
       if (b) {
               b
       } else {
               if (c) {
                       c
               } else {
                       d
               }
       }
}

This clearly shows that the block has a DCOND of 3 because the IFs depend on the one before. After trying for some hours to reimplement the DCOND metric to show 1 for the first case, I came to the conclusion this is no bug and DCOND should be 3. What a relief, no code needs to be written.