public void applyHits()

in src/com/intellij/rt/coverage/data/ClassData.java [284:342]


  public void applyHits() {
    int[] hits = CommonArrayUtil.getIntArray(myHitsMask);
    if (hits == null) return;

    for (int i = 0; i < hits.length; ++i) {
      if (hits[i] < 0 || hits[i] > MAX_HITS) {
        hits[i] = MAX_HITS;
      }
    }
    try {
      for (LineData lineData : myLinesArray) {
        if (lineData == null) continue;
        int lineId = lineData.getId();
        if (lineId != -1) {
          lineData.setHits(lineData.getHits() + hits[lineId]);
        }

        JumpData[] jumps = lineData.getJumps();
        if (jumps != null) {
          for (JumpData jumpData : jumps) {
            if (jumpData == null) continue;
            int trueId = jumpData.getId(true);
            if (trueId != -1) {
              jumpData.setTrueHits(jumpData.getTrueHits() + hits[trueId]);
            }
            int falseId = jumpData.getId(false);
            if (falseId != -1) {
              jumpData.setFalseHits(jumpData.getFalseHits() + hits[falseId]);
            }
          }
        }

        SwitchData[] switches = lineData.getSwitches();
        if (switches != null) {
          for (SwitchData switchData : switches) {
            if (switchData == null) continue;
            int defaultId = switchData.getId(-1);
            if (defaultId != -1) {
              switchData.setDefaultHits(switchData.getDefaultHits() + hits[defaultId]);
            }
            int[] switchHits = switchData.getHits();
            for (int i = 0; i < switchHits.length; i++) {
              int caseId = switchData.getId(i);
              if (caseId == -1) continue;
              switchHits[i] += hits[caseId];
            }
            switchData.setKeysAndHits(switchData.getKeys(), switchHits);
          }
        }
      }
      if (myHitsMask instanceof int[]) {
        Arrays.fill((int[]) myHitsMask, 0);
      } else if (myHitsMask instanceof boolean[]) {
        Arrays.fill((boolean[]) myHitsMask, false);
      }
    } catch (Throwable e) {
      ErrorReporter.warn("Unexpected error during applying hits data to class " + getName(), e);
    }
  }