Strip out Kotlin

I just simply need DI too much, and I don't want to have a Java shell class for everything in Kotlin.
This commit is contained in:
Bradlee Speice
2014-09-09 00:10:12 -04:00
parent 24a384d30e
commit 13417b2ad5
7 changed files with 181 additions and 102 deletions

View File

@ -1,66 +0,0 @@
package org.bspeice.minimalbible.service.osisparser
import org.crosswire.jsword.book.OSISUtil
import org.xml.sax.Attributes
import org.xml.sax.helpers.DefaultHandler
import java.util.ArrayDeque
import org.crosswire.jsword.passage.Verse
/**
* Parse the OSIS SAX to an object we can actually use.
* Technically we don't need the verse reference currently, but it will make persisting
* everything easier later.
*/
class OsisParser(verse: Verse) : DefaultHandler() {
var content: VerseContent = VerseContent()
val doWrite: ArrayDeque<Boolean> = ArrayDeque()
val verse: Verse = verse
// Android Studio complains, but the override below compiles since the java
// has a @NotNull contract
override fun startElement(uri: String, localName: String,
qName: String, attributes: Attributes) {
val name = getName(localName, qName)
if (name.equals(OSISUtil.OSIS_ELEMENT_VERSE)) {
doWrite.push(true)
content.id = getId(attributes)
} else {
doWrite.push(false)
}
}
// Android Studio complains, but the override below compiles since the java
// has a @NotNull contract
override fun endElement(uri: String?, localName: String, qName: String) {
doWrite.pop()
}
override fun characters(ch: CharArray?, start: Int, length: Int) {
if (ch != null && doWrite.peek() as Boolean)
content.appendContent(String(ch))
}
fun getName(eName: String?, qName: String): String {
if (eName != null && eName.length > 0)
return eName
else
return qName
}
fun getId(attrs: Attributes?): Int {
if (attrs == null)
return 0
val osisId: String? = attrs.getValue("", OSISUtil.OSIS_ELEMENT_VERSE)
if (osisId == null)
return 0
val parts: Array<String> = osisId.split("\\.")
return parts[parts.size - 1].toInt()
}
}

View File

@ -1,23 +0,0 @@
package org.bspeice.minimalbible.service.osisparser
import java.util.ArrayList
/**
* Created by bspeice on 9/7/14.
*/
class VerseContent() {
public var id: Int = 0
public var content: String = ""
public var chapterTitle: String = ""
public var paraTitle: String = ""
public var references: List<VerseReference> = ArrayList()
public fun appendContent(content: String) {
this.content += content
}
public fun toJson() {
}
}

View File

@ -1,12 +0,0 @@
package org.bspeice.minimalbible.service.osisparser
import org.crosswire.jsword.passage.Verse
/**
* Created by bspeice on 9/7/14.
*/
class VerseReference(verse: Verse, index: Int) {
public val verse: Verse = verse
public val index: Int = index
}