# Global Metrics

path: .metrics.cognitive.average
old: 0.8732394366197183
new: 3.7142857142857144
path: .metrics.cognitive.sum
old: 62.0
new: 26.0
path: .metrics.halstead.estimated_program_length
old: 2383.0121647351702
new: 256.9778536030677
path: .metrics.halstead.difficulty
old: 83.89852398523985
new: 82.94
path: .metrics.halstead.n1
old: 37.0
new: 29.0
path: .metrics.halstead.bugs
old: 5.711709598505031
new: 1.0321689558247569
path: .metrics.halstead.N2
old: 1229.0
new: 143.0
path: .metrics.halstead.time
old: 124611.6235994744
new: 9572.72463133484
path: .metrics.halstead.level
old: 0.011919160820706794
new: 0.012056908608632746
path: .metrics.halstead.N1
old: 2005.0
new: 218.0
path: .metrics.halstead.length
old: 3234.0
new: 361.0
path: .metrics.halstead.effort
old: 2243009.224790539
new: 172309.04336402714
path: .metrics.halstead.n2
old: 271.0
new: 25.0
path: .metrics.halstead.vocabulary
old: 308.0
new: 54.0
path: .metrics.halstead.volume
old: 26734.787672607312
new: 2077.514388281012
path: .metrics.halstead.purity_ratio
old: 0.7368621412291807
new: 0.7118500099807968
path: .metrics.loc.cloc
old: 19.0
new: 4.0
path: .metrics.loc.ploc
old: 552.0
new: 58.0
path: .metrics.loc.sloc
old: 691.0
new: 69.0
path: .metrics.loc.blank
old: 120.0
new: 7.0
path: .metrics.loc.lloc
old: 168.0
new: 37.0
path: .metrics.mi.mi_sei
old: -85.1370345957371
new: 28.585190161772605
path: .metrics.mi.mi_original
old: -27.485213853247583
new: 58.3150518726666
path: .metrics.mi.mi_visual_studio
old: 0.0
new: 34.1023695161793
path: .metrics.nexits.average
old: 0.7887323943661971
new: 0.8571428571428571
path: .metrics.nexits.sum
old: 56.0
new: 6.0
path: .metrics.nargs.average
old: 0.8591549295774648
new: 0.5714285714285714
path: .metrics.nargs.sum
old: 61.0
new: 4.0
path: .metrics.nom.total
old: 71.0
new: 7.0
path: .metrics.nom.functions
old: 71.0
new: 7.0
path: .metrics.cyclomatic.average
old: 1.5636363636363635
new: 2.375
path: .metrics.cyclomatic.sum
old: 172.0
new: 19.0

# Spaces Data

## Minimal test - lines (10, 10)

path: .spaces[3].metrics.halstead.level
old: null
new: 0.2
path: .spaces[3].metrics.halstead.n2
old: 1.0
new: 4.0
path: .spaces[3].metrics.halstead.bugs
old: 0.0
new: 0.013261740231564564
path: .spaces[3].metrics.halstead.vocabulary
old: 1.0
new: 12.0
path: .spaces[3].metrics.halstead.time
old: 0.0
new: 13.941520836137832
path: .spaces[3].metrics.halstead.n1
old: 0.0
new: 8.0
path: .spaces[3].metrics.halstead.difficulty
old: 0.0
new: 5.0
path: .spaces[3].metrics.halstead.effort
old: 0.0
new: 250.94737505048096
path: .spaces[3].metrics.halstead.volume
old: 0.0
new: 50.18947501009619
path: .spaces[3].metrics.halstead.N1
old: 0.0
new: 9.0
path: .spaces[3].metrics.halstead.purity_ratio
old: null
new: 2.2857142857142856
path: .spaces[3].metrics.halstead.estimated_program_length
old: null
new: 32.0
path: .spaces[3].metrics.halstead.length
old: 1.0
new: 14.0
path: .spaces[3].metrics.halstead.N2
old: 1.0
new: 5.0
path: .spaces[3].metrics.nargs.average
old: null
new: 1.0
path: .spaces[3].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[3].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[3].metrics.loc.lloc
old: 0.0
new: 1.0
path: .spaces[3].metrics.mi.mi_sei
old: null
new: 141.39357265873247
path: .spaces[3].metrics.mi.mi_visual_studio
old: null
new: 87.95778492016159
path: .spaces[3].metrics.mi.mi_original
old: null
new: 150.40781221347632
path: .spaces[3].metrics.nexits.average
old: null
new: 1.0
path: .spaces[3].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[3].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[3].metrics.nom.functions
old: 0.0
new: 1.0

### Code

    int IntCount::getCount(int pos) { return iPair[pos].cnt; }

## Minimal test - lines (13, 17)

path: .spaces[5].metrics.nargs.average
old: null
new: 0.0
path: .spaces[5].metrics.loc.ploc
old: 1.0
new: 5.0
path: .spaces[5].metrics.loc.sloc
old: 1.0
new: 5.0
path: .spaces[5].metrics.loc.lloc
old: 0.0
new: 3.0
path: .spaces[5].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[5].metrics.halstead.N1
old: 0.0
new: 13.0
path: .spaces[5].metrics.halstead.difficulty
old: 0.0
new: 6.3
path: .spaces[5].metrics.halstead.vocabulary
old: 1.0
new: 14.0
path: .spaces[5].metrics.halstead.N2
old: 1.0
new: 7.0
path: .spaces[5].metrics.halstead.n1
old: 0.0
new: 9.0
path: .spaces[5].metrics.halstead.estimated_program_length
old: null
new: 40.13896548741762
path: .spaces[5].metrics.halstead.level
old: null
new: 0.15873015873015872
path: .spaces[5].metrics.halstead.effort
old: 0.0
new: 479.7267201792581
path: .spaces[5].metrics.halstead.volume
old: 0.0
new: 76.14709844115208
path: .spaces[5].metrics.halstead.length
old: 1.0
new: 20.0
path: .spaces[5].metrics.halstead.n2
old: 1.0
new: 5.0
path: .spaces[5].metrics.halstead.bugs
old: 0.0
new: 0.020427161279358765
path: .spaces[5].metrics.halstead.time
old: 0.0
new: 26.651484454403228
path: .spaces[5].metrics.halstead.purity_ratio
old: null
new: 2.006948274370881
path: .spaces[5].metrics.mi.mi_visual_studio
old: null
new: 71.44282897451455
path: .spaces[5].metrics.mi.mi_original
old: null
new: 122.1672375464199
path: .spaces[5].metrics.mi.mi_sei
old: null
new: 100.65103563471568
path: .spaces[5].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[5].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[5].metrics.nexits.average
old: null
new: 0.0

### Code

    void IntCount::clear() {
      delete[] iPair;
      iPair = new IntPair[0];
      numInts = 0;
    }

## Minimal test - lines (8, 8)

path: .spaces[1].metrics.mi.mi_sei
old: 80.10458028356923
new: 145.63125671373976
path: .spaces[1].metrics.mi.mi_original
old: 107.92551994927192
new: 153.34515096830847
path: .spaces[1].metrics.mi.mi_visual_studio
old: 63.11433915162101
new: 89.67552688205174
path: .spaces[1].metrics.halstead.time
old: 98.85460389891205
new: 5.547368752524046
path: .spaces[1].metrics.halstead.bugs
old: 0.048946880175176656
new: 0.007174392059877131
path: .spaces[1].metrics.halstead.purity_ratio
old: 0.6894364599751013
new: 2.405720494933692
path: .spaces[1].metrics.halstead.N1
old: 29.0
new: 7.0
path: .spaces[1].metrics.halstead.N2
old: 22.0
new: 2.0
path: .spaces[1].metrics.halstead.vocabulary
old: 13.0
new: 9.0
path: .spaces[1].metrics.halstead.n2
old: 7.0
new: 2.0
path: .spaces[1].metrics.halstead.length
old: 51.0
new: 9.0
path: .spaces[1].metrics.halstead.effort
old: 1779.3828701804168
new: 99.85263754543284
path: .spaces[1].metrics.halstead.n1
old: 6.0
new: 7.0
path: .spaces[1].metrics.halstead.volume
old: 188.7224256251957
new: 28.52932501298081
path: .spaces[1].metrics.halstead.difficulty
old: 9.428571428571429
new: 3.5
path: .spaces[1].metrics.halstead.estimated_program_length
old: 35.161259458730164
new: 21.651484454403228
path: .spaces[1].metrics.halstead.level
old: 0.10606060606060606
new: 0.2857142857142857
path: .spaces[1].metrics.nexits.average
old: null
new: 0.0
path: .spaces[1].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[1].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[1].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[1].metrics.nargs.average
old: null
new: 0.0
path: .spaces[1].metrics.loc.sloc
old: 9.0
new: 1.0
path: .spaces[1].metrics.loc.lloc
old: 0.0
new: 1.0
path: .spaces[1].metrics.loc.ploc
old: 9.0
new: 1.0

### Code

    IntCount::~IntCount() { delete[] iPair; }

## Minimal test - lines (9, 9)

path: .spaces[2].metrics.halstead.n2
old: 1.0
new: 2.0
path: .spaces[2].metrics.halstead.bugs
old: 0.0
new: 0.0057689982812296325
path: .spaces[2].metrics.halstead.volume
old: 0.0
new: 24.0
path: .spaces[2].metrics.halstead.estimated_program_length
old: null
new: 17.509775004326936
path: .spaces[2].metrics.halstead.purity_ratio
old: null
new: 2.188721875540867
path: .spaces[2].metrics.halstead.level
old: null
new: 0.3333333333333333
path: .spaces[2].metrics.halstead.n1
old: 0.0
new: 6.0
path: .spaces[2].metrics.halstead.effort
old: 0.0
new: 72.0
path: .spaces[2].metrics.halstead.time
old: 0.0
new: 4.0
path: .spaces[2].metrics.halstead.N2
old: 1.0
new: 2.0
path: .spaces[2].metrics.halstead.vocabulary
old: 1.0
new: 8.0
path: .spaces[2].metrics.halstead.length
old: 1.0
new: 8.0
path: .spaces[2].metrics.halstead.difficulty
old: 0.0
new: 3.0
path: .spaces[2].metrics.halstead.N1
old: 0.0
new: 6.0
path: .spaces[2].metrics.mi.mi_original
old: null
new: 154.24412008219068
path: .spaces[2].metrics.mi.mi_visual_studio
old: null
new: 90.2012398141466
path: .spaces[2].metrics.mi.mi_sei
old: null
new: 146.92819499625
path: .spaces[2].metrics.nargs.average
old: null
new: 0.0
path: .spaces[2].metrics.loc.lloc
old: 0.0
new: 1.0
path: .spaces[2].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[2].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[2].metrics.nexits.average
old: null
new: 1.0
path: .spaces[2].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[2].metrics.nom.total
old: 0.0
new: 1.0

### Code

    int IntCount::getSize() { return numInts; }

## Minimal test - lines (7, 7)

path: .spaces[0].metrics.loc.ploc
old: 9.0
new: 1.0
path: .spaces[0].metrics.loc.sloc
old: 9.0
new: 1.0
path: .spaces[0].metrics.nargs.average
old: null
new: 0.0
path: .spaces[0].metrics.mi.mi_visual_studio
old: 63.11433915162101
new: 88.65827457239088
path: .spaces[0].metrics.mi.mi_original
old: 107.92551994927192
new: 151.6056495187884
path: .spaces[0].metrics.mi.mi_sei
old: 80.10458028356923
new: 143.12168659889798
path: .spaces[0].metrics.nexits.average
old: null
new: 0.0
path: .spaces[0].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[0].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[0].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[0].metrics.halstead.n2
old: 7.0
new: 5.0
path: .spaces[0].metrics.halstead.N2
old: 22.0
new: 5.0
path: .spaces[0].metrics.halstead.difficulty
old: 9.428571428571429
new: 2.5
path: .spaces[0].metrics.halstead.n1
old: 6.0
new: 5.0
path: .spaces[0].metrics.halstead.length
old: 51.0
new: 12.0
path: .spaces[0].metrics.halstead.N1
old: 29.0
new: 7.0
path: .spaces[0].metrics.halstead.level
old: 0.10606060606060606
new: 0.4
path: .spaces[0].metrics.halstead.purity_ratio
old: 0.6894364599751013
new: 1.9349400790728015
path: .spaces[0].metrics.halstead.volume
old: 188.7224256251957
new: 39.86313713864835
path: .spaces[0].metrics.halstead.time
old: 98.85460389891205
new: 5.5365468248122705
path: .spaces[0].metrics.halstead.bugs
old: 0.048946880175176656
new: 0.007165058383377737
path: .spaces[0].metrics.halstead.estimated_program_length
old: 35.161259458730164
new: 23.21928094887362
path: .spaces[0].metrics.halstead.effort
old: 1779.3828701804168
new: 99.65784284662088
path: .spaces[0].metrics.halstead.vocabulary
old: 13.0
new: 10.0

### Code

    IntCount::IntCount() : numInts(0), iPair(nullptr) {}

## Minimal test - lines (11, 11)

path: .spaces[4].metrics.nargs.average
old: null
new: 1.0
path: .spaces[4].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[4].metrics.halstead.time
old: 0.0
new: 13.941520836137832
path: .spaces[4].metrics.halstead.difficulty
old: 0.0
new: 5.0
path: .spaces[4].metrics.halstead.N1
old: 0.0
new: 9.0
path: .spaces[4].metrics.halstead.length
old: 1.0
new: 14.0
path: .spaces[4].metrics.halstead.n2
old: 1.0
new: 4.0
path: .spaces[4].metrics.halstead.vocabulary
old: 1.0
new: 12.0
path: .spaces[4].metrics.halstead.purity_ratio
old: null
new: 2.2857142857142856
path: .spaces[4].metrics.halstead.level
old: null
new: 0.2
path: .spaces[4].metrics.halstead.N2
old: 1.0
new: 5.0
path: .spaces[4].metrics.halstead.estimated_program_length
old: null
new: 32.0
path: .spaces[4].metrics.halstead.bugs
old: 0.0
new: 0.013261740231564564
path: .spaces[4].metrics.halstead.n1
old: 0.0
new: 8.0
path: .spaces[4].metrics.halstead.effort
old: 0.0
new: 250.94737505048096
path: .spaces[4].metrics.halstead.volume
old: 0.0
new: 50.18947501009619
path: .spaces[4].metrics.mi.mi_visual_studio
old: null
new: 87.95778492016159
path: .spaces[4].metrics.mi.mi_original
old: null
new: 150.40781221347632
path: .spaces[4].metrics.mi.mi_sei
old: null
new: 141.39357265873247
path: .spaces[4].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[4].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[4].metrics.loc.lloc
old: 0.0
new: 1.0
path: .spaces[4].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[4].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[4].metrics.nexits.average
old: null
new: 1.0

### Code

    int IntCount::getIndex(int pos) { return iPair[pos].idx; }

## Minimal test - lines (19, 69)

path: .spaces[6].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[6].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[6].metrics.nargs.average
old: null
new: 2.0
path: .spaces[6].metrics.nargs.sum
old: 0.0
new: 2.0
path: .spaces[6].metrics.nexits.average
old: null
new: 3.0
path: .spaces[6].metrics.nexits.sum
old: 0.0
new: 3.0
path: .spaces[6].metrics.mi.mi_sei
old: null
new: 32.02263471088386
path: .spaces[6].metrics.mi.mi_original
old: null
new: 66.36190851914637
path: .spaces[6].metrics.mi.mi_visual_studio
old: null
new: 38.8081336369277
path: .spaces[6].metrics.halstead.effort
old: 0.0
new: 142323.52858143763
path: .spaces[6].metrics.halstead.n1
old: 0.0
new: 27.0
path: .spaces[6].metrics.halstead.vocabulary
old: 1.0
new: 44.0
path: .spaces[6].metrics.halstead.bugs
old: 0.0
new: 0.9086498243471544
path: .spaces[6].metrics.halstead.estimated_program_length
old: null
new: 197.8688308596694
path: .spaces[6].metrics.halstead.n2
old: 1.0
new: 17.0
path: .spaces[6].metrics.halstead.N2
old: 1.0
new: 116.0
path: .spaces[6].metrics.halstead.purity_ratio
old: null
new: 0.6991831479140261
path: .spaces[6].metrics.halstead.volume
old: 0.0
new: 1545.0191480743551
path: .spaces[6].metrics.halstead.N1
old: 0.0
new: 167.0
path: .spaces[6].metrics.halstead.difficulty
old: 0.0
new: 92.11764705882354
path: .spaces[6].metrics.halstead.level
old: null
new: 0.010855683269476371
path: .spaces[6].metrics.halstead.time
old: 0.0
new: 7906.862698968758
path: .spaces[6].metrics.halstead.length
old: 1.0
new: 283.0
path: .spaces[6].metrics.cyclomatic.sum
old: 1.0
new: 12.0
path: .spaces[6].metrics.cyclomatic.average
old: 1.0
new: 12.0
path: .spaces[6].metrics.loc.blank
old: 0.0
new: 3.0
path: .spaces[6].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[6].metrics.loc.lloc
old: 0.0
new: 30.0
path: .spaces[6].metrics.loc.ploc
old: 1.0
new: 47.0
path: .spaces[6].metrics.loc.sloc
old: 1.0
new: 51.0
path: .spaces[6].metrics.cognitive.sum
old: 0.0
new: 26.0
path: .spaces[6].metrics.cognitive.average
old: null
new: 26.0

### Code

    int IntCount::countAdd(int index, int increment) {
      if (numInts) {
        // Do a binary search to find the element
        int divPoint = 0;

        if (index > iPair[numInts - 1].idx) {
          divPoint = numInts;
        } else if (index < iPair[0].idx) {
          divPoint = 0;
        } else {
          int low = 0, high = numInts - 1;
          int mid = (low + high) / 2;
          while (1) {
            mid = (low + high) / 2;

            if (index < iPair[mid].idx) {
              high = mid;
            } else if (index > iPair[mid].idx) {
              if (mid < numInts - 1 && index < iPair[mid + 1].idx) {
                divPoint = mid + 1;
                break;
              } else {
                low = mid + 1;
              }
            } else if (index == iPair[mid].idx) {
              return iPair[mid].cnt += increment;
            }
          }
        }

        int i;
        IntPair* tpair = new IntPair[numInts + 1];
        for (i = 0; i < divPoint; i++) {
          tpair[i] = iPair[i];
        }
        for (i = divPoint; i < numInts; i++) {
          tpair[i + 1] = iPair[i];
        }
        ++numInts;
        delete[] iPair;
        iPair = tpair;
        iPair[divPoint].idx = index;
        iPair[divPoint].cnt = increment;
        return increment;
      } else {
        iPair = new IntPair[1];
        numInts = 1;
        iPair[0].idx = index;
        return iPair[0].cnt = increment;
      }
    }