Changed Tuple usage to Pair usage in kdoc

This commit is contained in:
Svetlana Isakova
2012-09-08 00:35:05 +04:00
parent 47b3d4edd4
commit c12fd3f0e6
6 changed files with 12 additions and 12 deletions
@@ -33,7 +33,7 @@ var JFrame.title: String
var JFrame.size: Pair<Int, Int>
get() = Pair(getSize().sure().getWidth().toInt(), getSize().sure().getHeight().toInt())
set(dim) {
setSize(Dimension(dim._1, dim._2))
setSize(Dimension(dim.first, dim.second))
}
var JFrame.height: Int
@@ -115,8 +115,8 @@ class Html2CompilerPlugin(private val compilerArguments: KDocArguments) : Doclet
}
for (t in splitPsi(psiFile)) {
val text = t._1
val psi = t._2
val text = t.first
val psi = t.second
span(className = classForPsi(psi)) {
print(text.escapeHtml())
}
@@ -31,8 +31,8 @@ private fun splitPsiImpl(psi: PsiElement, listBuilder: ImmutableArrayListBuilder
}
}
fun splitPsi(psi: PsiElement): List<Pair(String, PsiElement)> {
val listBuilder = listBuilder<Pair(String, PsiElement)>()
fun splitPsi(psi: PsiElement): List<Pair<String, PsiElement>> {
val listBuilder = listBuilder<Pair<String, PsiElement>>()
splitPsiImpl(psi, listBuilder)
return listBuilder.build()
}
@@ -774,7 +774,7 @@ class TemplateLinkRenderer(val annotated: KAnnotated, val template: KDocTemplate
// TODO even hacker than the above hack!
val link = hackedLinks.get(text)
if (link != null) {
href = annotated.model.config.resolveLink(link._1) + link._2
href = annotated.model.config.resolveLink(link.first) + link.second
}
}
if (href != null) {
@@ -10,9 +10,9 @@ abstract class HtmlTemplate() : TextTemplate() {
content: () -> Unit) {
val allAttributesBuilder = listBuilder<Pair<String, String>>()
if (style != null)
allAttributesBuilder.add(Pair("style", style))
allAttributesBuilder.add(Pair<String, String>("style", style))
if (className != null)
allAttributesBuilder.add(Pair("class", className))
allAttributesBuilder.add(Pair<String, String>("class", className))
// TODO: add addAll to ListBuilder
for (attribute in attributes)
@@ -26,7 +26,7 @@ abstract class HtmlTemplate() : TextTemplate() {
}
else {
// TODO: escape values
"<$tagName ${allAttributes.map { t -> "${t._1}='${t._2.escapeHtml()}'" }.makeString(" ")}>"
"<$tagName ${allAttributes.map { t -> "${t.first}='${t.second.escapeHtml()}'" }.makeString(" ")}>"
}
)
content()
@@ -79,9 +79,9 @@ abstract class HtmlTemplate() : TextTemplate() {
fun a(href: String? = null, name: String? = null, content: () -> Unit) {
val attributes = listBuilder<Pair<String, String>>()
if (href != null)
attributes.add(Pair("href", href))
attributes.add(Pair<String, String>("href", href))
if (name != null)
attributes.add(Pair("name", name))
attributes.add(Pair<String, String>("name", name))
tag(tagName = "a", attributes = attributes.build(), content = content)
}
}
@@ -51,7 +51,7 @@ class PsiUtilsTest {
[Test]
fun splitPsi() {
val file = createFile("class Foo")
val items: List<String> = splitPsi(file).map { t -> t._1 }
val items: List<String> = splitPsi(file).map { t -> t.first }
Assert.assertEquals(arrayList("class", " ", "Foo"), items)
}