This commit is contained in:
Horis
2023-08-23 12:42:14 +08:00
parent 788a5b5d08
commit fa03b08d3e
@@ -1,18 +1,17 @@
package io.legado.app.ui.book.read.page.entities
@Suppress("unused")
@Suppress("unused", "MemberVisibilityCanBePrivate")
data class TextParagraph(
var num: Int,
val textLines: ArrayList<TextLine> = arrayListOf(),
) : Iterable<TextLine> {
) {
val text: String get() = textLines.joinToString("") { it.text }
val length: Int get() = text.length
val chapterIndices: IntRange get() = first().chapterPosition..last().chapterPosition + last().charSize
val chapterPosition: Int get() = first().chapterPosition
val realNum: Int get() = first().paragraphNum
val isParagraphEnd: Boolean get() = last().isParagraphEnd
val firstLine: TextLine get() = textLines.first()
val lastLine: TextLine get() = textLines.last()
val chapterIndices: IntRange get() = firstLine.chapterPosition..lastLine.chapterPosition + lastLine.charSize
val chapterPosition: Int get() = firstLine.chapterPosition
val realNum: Int get() = firstLine.paragraphNum
val isParagraphEnd: Boolean get() = lastLine.isParagraphEnd
override fun iterator(): Iterator<TextLine> {
return textLines.iterator()
}
}