Skip to content
Permalink
Browse files
[JENKINS-13235] use commas in numbers for readability
  • Loading branch information
ssogabe committed May 19, 2012
1 parent 158024d commit 7ef65b2d7888071638791195a964119d4340117e
@@ -6,8 +6,10 @@
*/
public interface Countable {

public int getLineCount();
int getLineCount();

public String getName();
String getLineCountString();

String getName();

}
@@ -1,5 +1,6 @@
package hudson.plugins.sloccount.model;

import hudson.plugins.sloccount.util.StringUtil;
import java.io.Serializable;

/**
@@ -22,6 +23,10 @@ public int getLineCount() {
return this.lineCount;
}

public String getLineCountString() {
return StringUtil.grouping(getLineCount());
}

public String getName() {
return this.name;
}
@@ -1,5 +1,6 @@
package hudson.plugins.sloccount.model;

import hudson.plugins.sloccount.util.StringUtil;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@@ -10,7 +11,7 @@
*
* @author lordofthepigs
*/
public abstract class FileContainer implements Serializable {
public abstract class FileContainer implements Countable, Serializable {

private Map<String, File> files = new LinkedHashMap<String, File>();
private int lineCount = 0;
@@ -27,6 +28,10 @@ public File getFile(String name){
public int getFileCount(){
return this.files.size();
}

public String getFileCountString() {
return StringUtil.grouping(getFileCount());
}

public void addFile(File file){
this.files.put(file.getName(), file);
@@ -36,4 +41,9 @@ public void addFile(File file){
public int getLineCount(){
return this.lineCount;
}

public String getLineCountString() {
return StringUtil.grouping(getLineCount());
}

}
@@ -1,12 +1,10 @@
package hudson.plugins.sloccount.model;

import java.io.Serializable;

/**
*
* @author lordofthepigs
*/
public class Folder extends FileContainer implements Countable, Serializable {
public class Folder extends FileContainer {

private String name;

@@ -1,12 +1,10 @@
package hudson.plugins.sloccount.model;

import java.io.Serializable;

/**
*
* @author lordofthepigs
*/
public class Language extends FileContainer implements Countable, Serializable {
public class Language extends FileContainer {

private String name;

@@ -1,6 +1,5 @@
package hudson.plugins.sloccount.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@@ -10,7 +9,7 @@
*
* @author lordofthepigs
*/
public class SloccountReport extends FileContainer implements Serializable {
public class SloccountReport extends FileContainer {

private Map<String, Folder> folders = new LinkedHashMap<String, Folder>();
private Map<String, Language> languages = new LinkedHashMap<String, Language>();
@@ -175,4 +174,9 @@ public void simplifyNames(){
f.simplifyName(root);
}
}

public String getName() {
return "SlocCount Report";
}

}
@@ -0,0 +1,18 @@
package hudson.plugins.sloccount.util;

/**
* Utility
*
* @author ssogabe
*/
public class StringUtil {

private StringUtil() {
//
}

public static String grouping(int value) {
return String.format("%,d", value);
}

}
@@ -15,15 +15,15 @@
<tr>
<td class="pane">${container.name}</td>
<td class="pane">${container.language}</td>
<td class="pane number" data="${container.lineCount}">${container.lineCount}</td>
<td class="pane number" data="${container.lineCount}">${container.lineCountString}</td>
<td class="pane"><st:include page="/tabview/distribution-graph.jelly" /></td>
</tr>
</j:forEach>
<tfoot>
<tr class="sortbottom">
<td class="pane-header">${%Total}</td>
<td class="pane-header"> </td>
<td class="pane-header number" data="${it.report.lineCount}">${it.report.lineCount}</td>
<td class="pane-header number" data="${it.report.lineCount}">${it.report.lineCountString}</td>
<td class="pane-header"> </td>
</tr>
</tfoot>
@@ -14,16 +14,16 @@
<j:forEach var="container" items="${it.report.folders}">
<tr>
<td class="pane"><a href="folderResult/${container.urlName}">${container.name}</a></td>
<td class="pane number" data="${container.fileCount}">${container.fileCount}</td>
<td class="pane number" data="${container.lineCount}">${container.lineCount}</td>
<td class="pane number" data="${container.fileCount}">${container.fileCountString}</td>
<td class="pane number" data="${container.lineCount}">${container.lineCountString}</td>
<td class="pane"><st:include page="/tabview/distribution-graph.jelly" /></td>
</tr>
</j:forEach>
<tfoot>
<tr class="sortbottom">
<td class="pane-header">${%Total}</td>
<td class="pane-header"> </td>
<td class="pane-header number" data="${it.report.lineCount}">${it.report.lineCount}</td>
<td class="pane-header number" data="${it.report.lineCount}">${it.report.lineCountString}</td>
<td class="pane-header"> </td>
</tr>
</tfoot>
@@ -14,16 +14,16 @@
<j:forEach var="container" items="${it.report.languages}">
<tr>
<td class="pane"><a href="languageResult/${container.name}">${container.name}</a></td>
<td class="pane number" data="${container.fileCount}">${container.fileCount}</td>
<td class="pane number" data="${container.lineCount}">${container.lineCount}</td>
<td class="pane number" data="${container.fileCount}">${container.fileCountString}</td>
<td class="pane number" data="${container.lineCount}">${container.lineCountString}</td>
<td class="pane"><st:include page="/tabview/distribution-graph.jelly" /></td>
</tr>
</j:forEach>
<tfoot>
<tr class="sortbottom">
<td class="pane-header">${%Total}</td>
<td class="pane-header"> </td>
<td class="pane-header number" data="${it.report.lineCount}">${it.report.lineCount}</td>
<td class="pane-header number" data="${it.report.lineCount}">${it.report.lineCountString}</td>
<td class="pane-header"> </td>
</tr>
</tfoot>

0 comments on commit 7ef65b2

Please sign in to comment.