From a5776572482505a8b6171a641878ff6f9bb42d41 Mon Sep 17 00:00:00 2001 From: Kaj Koivunen <kalakoiv@jyu.fi> Date: Mon, 13 Mar 2023 11:29:02 +0200 Subject: [PATCH] eksplisiittiset paluutyypit julkiselle API:lle --- src/main/kotlin/DictionaryParser.kt | 9 ++++----- src/main/kotlin/guru/kake/xmlp/XMLParser.kt | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/DictionaryParser.kt b/src/main/kotlin/DictionaryParser.kt index 0ee7ea5..f19e367 100644 --- a/src/main/kotlin/DictionaryParser.kt +++ b/src/main/kotlin/DictionaryParser.kt @@ -2,7 +2,6 @@ package guru.kake.ronove import guru.kake.xmlp.XMLParser import java.io.FileInputStream -import javax.xml.namespace.QName import javax.xml.stream.XMLEventReader import javax.xml.stream.XMLInputFactory import javax.xml.stream.events.XMLEvent @@ -21,12 +20,12 @@ class Character(var literal: String = "") : Comparable<Character> { override fun equals(other: Any?): Boolean { if (other is Character) { - return this.literal == other.literal + return literal == other.literal } return super.equals(other) } - override fun compareTo(other: Character) = this.literal.compareTo(other.literal) + override fun compareTo(other: Character): Int = literal.compareTo(other.literal) override fun hashCode(): Int = literal.hashCode() } @@ -51,11 +50,11 @@ class Phrase(var japanese: String) : Comparable<Phrase> { override fun equals(other: Any?): Boolean { if (other is Phrase) { - return this.japanese == other.japanese + return japanese == other.japanese } return super.equals(other) } - override fun compareTo(other: Phrase) = this.japanese.compareTo(other.japanese) + override fun compareTo(other: Phrase): Int = japanese.compareTo(other.japanese) override fun hashCode(): Int = japanese.hashCode() } class Sense { diff --git a/src/main/kotlin/guru/kake/xmlp/XMLParser.kt b/src/main/kotlin/guru/kake/xmlp/XMLParser.kt index 8c25317..952da59 100644 --- a/src/main/kotlin/guru/kake/xmlp/XMLParser.kt +++ b/src/main/kotlin/guru/kake/xmlp/XMLParser.kt @@ -20,7 +20,7 @@ class XMLParser private constructor(path: String) { * @param path path to file * @param init lambda to execute on each XML event */ - fun parse(path: String, init: XMLParser.() -> Unit) = XMLParser(path).init(init) + fun parse(path: String, init: XMLParser.() -> Unit): Unit = XMLParser(path).init(init) } private val factory: XMLInputFactory = XMLInputFactory.newInstance() -- GitLab