| 1 | |
package net.sf.statcvs.reports; |
| 2 | |
|
| 3 | |
import java.util.Iterator; |
| 4 | |
|
| 5 | |
import net.sf.statcvs.Messages; |
| 6 | |
import net.sf.statcvs.model.Author; |
| 7 | |
import net.sf.statcvs.output.ReportConfig; |
| 8 | |
import net.sf.statcvs.reportmodel.AuthorColumn; |
| 9 | |
import net.sf.statcvs.reportmodel.IntegerColumn; |
| 10 | |
import net.sf.statcvs.reportmodel.Table; |
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
public class TopDevelopersTableReport extends AbstractLocTableReport implements TableReport { |
| 20 | 0 | private Table table = null; |
| 21 | |
|
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
public TopDevelopersTableReport(final ReportConfig config) { |
| 28 | 0 | super(config); |
| 29 | 0 | } |
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
public void calculate() { |
| 35 | 0 | if (this.table != null) { |
| 36 | 0 | return; |
| 37 | |
} |
| 38 | |
String summary; |
| 39 | 0 | if (getDeveloperCount() > 10) { |
| 40 | 0 | summary = Messages.getString("TOP_AUTHORS_TABLE_SUMMARY1"); |
| 41 | |
} else { |
| 42 | 0 | summary = Messages.getString("TOP_AUTHORS_TABLE_SUMMARY2"); |
| 43 | |
} |
| 44 | 0 | table = new Table(summary); |
| 45 | 0 | final AuthorColumn authors = new AuthorColumn(); |
| 46 | 0 | final IntegerColumn linesOfCode = new IntegerColumn(Messages.getString("COLUMN_LOC")); |
| 47 | 0 | linesOfCode.setShowPercentages(true); |
| 48 | 0 | table.addColumn(authors); |
| 49 | 0 | table.addColumn(linesOfCode); |
| 50 | 0 | table.setKeysInFirstColumn(true); |
| 51 | |
|
| 52 | 0 | calculateChangesAndLinesPerDeveloper(getContent().getRevisions()); |
| 53 | 0 | int lines = 0; |
| 54 | 0 | final Iterator it = getLinesMap().iteratorSortedByValueReverse(); |
| 55 | 0 | while (it.hasNext()) { |
| 56 | 0 | final Author author = (Author) it.next(); |
| 57 | 0 | authors.addValue(author); |
| 58 | 0 | linesOfCode.addValue(getLinesMap().get(author)); |
| 59 | 0 | lines++; |
| 60 | 0 | if (lines == 10) { |
| 61 | 0 | break; |
| 62 | |
} |
| 63 | 0 | } |
| 64 | 0 | linesOfCode.setSum(getLinesMap().sum()); |
| 65 | 0 | } |
| 66 | |
|
| 67 | |
|
| 68 | |
|
| 69 | |
|
| 70 | |
public Table getTable() { |
| 71 | 0 | return table; |
| 72 | |
} |
| 73 | |
} |