switched code to use nicer iteration over Map

This commit is contained in:
James Strachan
2012-04-12 15:04:30 +01:00
parent 57a5e81db8
commit 5802a6f0ba
4 changed files with 17 additions and 24 deletions
@@ -44,10 +44,8 @@ abstract class Tag(val name : String) : Element() {
builder.append("<")
builder.append(name)
if (!attributes.isEmpty()) {
for (e in attributes.entrySet()) {
if (e != null) {
builder.append(" ${e.getKey()}=\"${e.getValue()}\"")
}
for (e in attributes) {
builder.append(" ${e.key}=\"${e.value}\"")
}
}
if (children.isEmpty()) {
@@ -70,20 +70,15 @@ class KDocConfig() {
* Resolves a link to the given class name
*/
fun resolveLink(packageName: String): String {
// TODO should be able to do something like
// for (e in packageUrls.filterNotNull()) {
val entrySet = packagePrefixToUrls.entrySet()
if (entrySet != null) {
for (e in entrySet) {
val p = e?.getKey()
val url = e?.getValue()
if (p != null && url != null) {
if (packageName.startsWith(p)) {
return url
}
for (e in packagePrefixToUrls) {
val p = e.key
val url = e.value
if (p != null && url != null) {
if (packageName.startsWith(p)) {
return url
}
}
}
}
if (missingPackageUrls.add(packageName)) {
println("Warning: could not find external link to package: $packageName")
}
@@ -96,8 +96,8 @@ ${stylesheets()}
<TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont">Extensions</FONT>&nbsp;
<FONT CLASS="FrameItemFont">
<BR>""")
for (e in map.entrySet()) {
val c = e?.getKey()
for (e in map) {
val c = e.key
if (c != null) {
println("""<A HREF="${extensionsHref(pkg, c)}" title="extensions functions on class ${c.name} from ${pkg.name}" target="classFrame"><I>${c.name}</I></A>
<BR>""")
@@ -136,9 +136,9 @@ ${pkg.detailedDescription(this)}
""")
val groupMap = pkg.groupClassMap()
for (e in groupMap.entrySet()) {
val group = e?.getKey() ?: "Other"
val list = e?.getValue()
for (e in groupMap) {
val group = e.key ?: "Other"
val list = e.value
if (list != null) {
println(""" <h3>$group</h3>
@@ -275,13 +275,13 @@ Copyright &#169; 2010-2012. All Rights Reserved.
<B>Extensions Summary</B></FONT></TH>
</TR>""")
for (e in map.entrySet()) {
val c = e?.getKey()
for (e in map) {
val c = e.key
if (c != null) {
println("""<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="${extensionsHref(pkg, c)}" title="extensions on ${pkg.name}">${c.name}</A></B></TD>
<TD>""")
val list = e?.getValue()
val list = e.value
if (list != null) {
val functions = filterDuplicateNames(list)
for (f in functions) {