private Counter writeClass()

in java6-utils/src/com/intellij/rt/coverage/report/XMLCoverageReport.java [364:400]


  private Counter writeClass(ProjectData project, ClassData classData, Map<LineData, Counter> lineCounters) throws XMLStreamException {
    final ClassInstructions classInstructions = project.getInstructions().get(classData.getName());
    myOut.writeStartElement(CLASS_TAG);
    final String className = ClassNameUtil.convertToInternalName(classData.getName());
    myOut.writeAttribute("name", className);
    String sourceName = classData.getSource();
    if (sourceName != null && !sourceName.isEmpty()) {
      myOut.writeAttribute(SOURCEFILE_NAME_TAG, sourceName);
      newLine();
      List<LineData> lines = myFiles.get(sourceName);
      if (lines == null) {
        lines = new ArrayList<LineData>();
        myFiles.put(sourceName, lines);
      }
      LineData[] linesArray = (LineData[]) classData.getLines();
      if (linesArray != null) {
        for (LineData line : linesArray) {
          if (line == null) continue;
          lines.add(line);
        }
      }
    } else {
      newLine();
    }
    final Counter counter = new Counter();
    Map<String, List<LineData>> methods = classData.mapLinesToMethods();
    for (Map.Entry<String, List<LineData>> methodEntry : methods.entrySet()) {
      final Counter methodCounter = writeMethod(classInstructions, methodEntry.getKey(), methodEntry.getValue(), lineCounters);
      counter.add(methodCounter);
    }
    counter.totalClasses = 1;
    if (counter.coveredMethods > 0) counter.coveredClasses = 1;
    writeCounter(counter, INSTRUCTION_MASK | LINE_MASK | BRANCH_MASK | METHOD_MASK);
    myOut.writeEndElement();
    newLine();
    return counter;
  }