Code with Finding: |
class NameAnalyzer {
/**
* Generates an HTML report
*
* @return The report
*/
String getHtmlReport() {
StringBuilder sb = new StringBuilder();
sb.append("<html><body><style type=\"text/css\">"
+ "body, td, p {font-family: Arial; font-size: 83%} "
+ "ul {margin-top:2px; margin-left:0px; padding-left:1em;} "
+ "li {margin-top:3px; margin-left:24px; padding-left:0px;"
+ "padding-bottom: 4px}</style>");
sb.append("OVERALL STATS<ul>");
appendListItem(sb, "Total Names: " + countOf(TriState.BOTH, TriState.BOTH));
appendListItem(sb, "Total Classes: "
+ countOf(TriState.TRUE, TriState.BOTH));
appendListItem(sb, "Total Static Functions: "
+ countOf(TriState.FALSE, TriState.BOTH));
appendListItem(sb, "Referenced Names: "
+ countOf(TriState.BOTH, TriState.TRUE));
appendListItem(sb, "Referenced Classes: "
+ countOf(TriState.TRUE, TriState.TRUE));
appendListItem(sb, "Referenced Functions: "
+ countOf(TriState.FALSE, TriState.TRUE));
sb.append("</ul>");
sb.append("ALL NAMES<ul>\n");
for (JsName node : allNames.values()) {
sb.append("<li>" + nameAnchor(node.name) + "<ul>");
if (node.prototypeNames.size() > 0) {
sb.append("<li>PROTOTYPES: ");
Iterator<String> protoIter = node.prototypeNames.iterator();
while (protoIter.hasNext()) {
sb.append(protoIter.next());
if (protoIter.hasNext()) {
sb.append(", ");
}
}
}
if (referenceGraph.hasNode(node)) {
List<DiGraphEdge<JsName, RefType>> refersTo =
referenceGraph.getOutEdges(node);
if (refersTo.size() > 0) {
sb.append("<li>REFERS TO: ");
Iterator<DiGraphEdge<JsName, RefType>> toIter = refersTo.iterator();
while (toIter.hasNext()) {
sb.append(nameLink(toIter.next().getDestination().getValue().name));
if (toIter.hasNext()) {
sb.append(", ");
}
}
}
List<DiGraphEdge<JsName, RefType>> referencedBy =
referenceGraph.getInEdges(node);
if (referencedBy.size() > 0) {
sb.append("<li>REFERENCED BY: ");
Iterator<DiGraphEdge<JsName, RefType>> fromIter = refersTo.iterator();
while (fromIter.hasNext()) {
sb.append(
nameLink(fromIter.next().getDestination().getValue().name));
if (fromIter.hasNext()) {
sb.append(", ");
}
}
}
}
sb.append("</li>");
sb.append("</ul></li>");
}
sb.append("</ul>");
sb.append("</body></html>");
return sb.toString();
}
}
|